implement TSkybox and use setColor method to set the background color, rather than the image

This commit is contained in:
Nick Fisher
2025-06-18 13:01:25 +08:00
parent df393b075b
commit 42f9538040
11 changed files with 177 additions and 30 deletions

View File

@@ -636,7 +636,6 @@ external bool Texture_loadImage(
int level,
);
@ffi.Native<
ffi.Bool Function(
ffi.Pointer<TEngine>,
@@ -651,7 +650,6 @@ external bool Texture_loadImage(
ffi.Uint32,
ffi.Uint32,
ffi.Uint32,
ffi.Uint32,
ffi.Uint32)>(isLeaf: true)
external bool Texture_setImage(
ffi.Pointer<TEngine> tEngine,
@@ -664,7 +662,6 @@ external bool Texture_setImage(
int z_offset,
int width,
int height,
int channels,
int depth,
int bufferFormat,
int pixelDataType,
@@ -1618,6 +1615,11 @@ external int EntityManager_createEntity(
ffi.Pointer<TEntityManager> tEntityManager,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<TFence>)>(isLeaf: true)
external void Fence_waitAndDestroy(
ffi.Pointer<TFence> tFence,
);
@ffi.Native<ffi.Void Function()>(isLeaf: true)
external void RenderThread_create();
@@ -1941,6 +1943,14 @@ external void Engine_createFenceRenderThread(
onComplete,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<TFence>, ffi.Uint32, VoidCallback)>(
isLeaf: true)
external void Fence_waitAndDestroyRenderThread(
ffi.Pointer<TFence> tFence,
int requestId,
VoidCallback onComplete,
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<TEngine>, ffi.Pointer<TFence>, ffi.Uint32,
VoidCallback)>(isLeaf: true)
@@ -2507,7 +2517,6 @@ external void Texture_loadImageRenderThread(
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> onComplete,
);
@ffi.Native<
ffi.Void Function(
ffi.Pointer<TEngine>,
@@ -2945,6 +2954,17 @@ external bool GltfResourceLoader_loadResources(
ffi.Pointer<TFilamentAsset> tFilamentAsset,
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<TSkybox>, ffi.Double, ffi.Double, ffi.Double,
ffi.Double)>(isLeaf: true)
external void Skybox_setColor(
ffi.Pointer<TSkybox> tSkybox,
double r,
double g,
double b,
double a,
);
@ffi.Native<
ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId, ffi.Int,
ffi.Pointer<TMaterialInstance>)>(isLeaf: true)

View File

@@ -1956,6 +1956,13 @@ extension type NativeLibrary(JSObject _) implements JSObject {
Pointer<TGltfResourceLoader> tGltfResourceLoader,
Pointer<TFilamentAsset> tFilamentAsset,
);
external void _Skybox_setColor(
Pointer<TSkybox> tSkybox,
double r,
double g,
double b,
double a,
);
external int _RenderableManager_setMaterialInstanceAt(
Pointer<TRenderableManager> tRenderableManager,
EntityId entityId,
@@ -5509,6 +5516,17 @@ bool GltfResourceLoader_loadResources(
return result == 1;
}
void Skybox_setColor(
self.Pointer<TSkybox> tSkybox,
double r,
double g,
double b,
double a,
) {
final result = _lib._Skybox_setColor(tSkybox.cast(), r, g, b, a);
return result;
}
bool RenderableManager_setMaterialInstanceAt(
self.Pointer<TRenderableManager> tRenderableManager,
DartEntityId entityId,