when getMaterialInstance/setMaterialInstance are called, if entity is not renderable, return false

if no entity is passed, iterate through all entities and use the first renderable entity
This commit is contained in:
Nick Fisher
2025-05-23 16:27:38 +08:00
parent 725f36a860
commit 195a625738
6 changed files with 80 additions and 19 deletions

View File

@@ -2876,9 +2876,9 @@ external bool GltfResourceLoader_loadResources(
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<TRenderableManager>, EntityId, ffi.Int,
ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId, ffi.Int,
ffi.Pointer<TMaterialInstance>)>(isLeaf: true)
external void RenderableManager_setMaterialInstanceAt(
external bool RenderableManager_setMaterialInstanceAt(
ffi.Pointer<TRenderableManager> tRenderableManager,
int entityId,
int primitiveIndex,
@@ -2894,6 +2894,13 @@ external ffi.Pointer<TMaterialInstance> RenderableManager_getMaterialInstanceAt(
int primitiveIndex,
);
@ffi.Native<ffi.Size Function(ffi.Pointer<TRenderableManager>, EntityId)>(
isLeaf: true)
external int RenderableManager_getPrimitiveCount(
ffi.Pointer<TRenderableManager> tRenderableManager,
int entityId,
);
@ffi.Native<ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId)>(
isLeaf: true)
external bool RenderableManager_isRenderable(