add cubemap methods to BackgroundImage
This commit is contained in:
@@ -72,6 +72,16 @@ class BackgroundImage extends ThermionAsset {
|
||||
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();
|
||||
|
||||
if (bundle.isCubemap()) {
|
||||
sampler ??=
|
||||
await FilamentApp.instance!.createTextureSampler() as FFITextureSampler;
|
||||
sampler ??= await FilamentApp.instance!.createTextureSampler()
|
||||
as FFITextureSampler;
|
||||
this.texture = texture;
|
||||
await mi.setParameterTexture(
|
||||
"cubeMap", texture as FFITexture, sampler as FFITextureSampler);
|
||||
await setBackgroundColor(1, 1, 1, 0);
|
||||
await mi.setParameterInt("showImage", 1);
|
||||
await mi.setParameterInt("isCubeMap", 1);
|
||||
|
||||
await setCubemapFace(0);
|
||||
width = await texture.getWidth();
|
||||
height = await texture.getHeight();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user