add cubemap methods to BackgroundImage
This commit is contained in:
@@ -72,6 +72,16 @@ class BackgroundImage extends ThermionAsset {
|
|||||||
await mi.setParameterInt("showImage", 0);
|
await mi.setParameterInt("showImage", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
Future setCubemapFace(int index) async {
|
||||||
|
if (index < 0 || index > 5) {
|
||||||
|
throw Exception("Incorrect cubemap face index");
|
||||||
|
}
|
||||||
|
await mi.setParameterInt("cubeMapFace", index);
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@@ -79,15 +89,15 @@ class BackgroundImage extends ThermionAsset {
|
|||||||
final texture = await bundle.createTexture();
|
final texture = await bundle.createTexture();
|
||||||
|
|
||||||
if (bundle.isCubemap()) {
|
if (bundle.isCubemap()) {
|
||||||
sampler ??=
|
sampler ??= await FilamentApp.instance!.createTextureSampler()
|
||||||
await FilamentApp.instance!.createTextureSampler() as FFITextureSampler;
|
as FFITextureSampler;
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
await mi.setParameterTexture(
|
await mi.setParameterTexture(
|
||||||
"cubeMap", texture as FFITexture, sampler as FFITextureSampler);
|
"cubeMap", texture as FFITexture, sampler as FFITextureSampler);
|
||||||
await setBackgroundColor(1, 1, 1, 0);
|
await setBackgroundColor(1, 1, 1, 0);
|
||||||
await mi.setParameterInt("showImage", 1);
|
await mi.setParameterInt("showImage", 1);
|
||||||
await mi.setParameterInt("isCubeMap", 1);
|
await mi.setParameterInt("isCubeMap", 1);
|
||||||
|
await setCubemapFace(0);
|
||||||
width = await texture.getWidth();
|
width = await texture.getWidth();
|
||||||
height = await texture.getHeight();
|
height = await texture.getHeight();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user