allow setting material property by name

This commit is contained in:
Nick Fisher
2024-09-13 15:20:45 +08:00
parent 2eb7cc286b
commit f18f04734d
4 changed files with 60 additions and 0 deletions

View File

@@ -943,4 +943,16 @@ extern "C"
{
((SceneManager *)sceneManager)->removeStencilHighlight(entityId);
}
EMSCRIPTEN_KEEPALIVE void set_material_property_float(void *const sceneManager, EntityId entity, int materialIndex, const char* property, float value) {
((SceneManager *)sceneManager)->setMaterialProperty(entity, materialIndex, property, value);
}
EMSCRIPTEN_KEEPALIVE void set_material_property_float4(void *const sceneManager, EntityId entity, int materialIndex, const char* property, float4 value) {
filament::math::float4 filamentValue { value.x, value.y, value.z, value.w };
((SceneManager *)sceneManager)->setMaterialProperty(entity, materialIndex, property, filamentValue);
}
}