feat: expose setCastShadows/setReceiveShadows
This commit is contained in:
@@ -12,37 +12,13 @@ extern "C"
|
||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setPriority(TRenderableManager *tRenderableManager, EntityId entityId, int priority);
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *RenderableManager_getMaterialInstanceAt(TRenderableManager *tRenderableManager, EntityId entityId, int primitiveIndex);
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isRenderable(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||
|
||||
// New boolean methods
|
||||
|
||||
/**
|
||||
* Checks if the given entity has a renderable component
|
||||
*/
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_hasComponent(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||
|
||||
/**
|
||||
* Returns true if this manager has no components
|
||||
*/
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_empty(TRenderableManager *tRenderableManager);
|
||||
|
||||
/**
|
||||
* Returns whether a light channel is enabled on a specified renderable
|
||||
*/
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_getLightChannel(TRenderableManager *tRenderableManager, EntityId entityId, unsigned int channel);
|
||||
|
||||
/**
|
||||
* Checks if the renderable can cast shadows
|
||||
*/
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isShadowCaster(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||
|
||||
/**
|
||||
* Checks if the renderable can receive shadows
|
||||
*/
|
||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setCastShadows(TRenderableManager *tRenderableManager, EntityId entityId, bool castShadows);
|
||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setReceiveShadows(TRenderableManager *tRenderableManager, EntityId entityId, bool receiveShadows);
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isShadowReceiver(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||
|
||||
/**
|
||||
* Returns whether large-scale fog is enabled for this renderable
|
||||
*/
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_getFogEnabled(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -72,21 +72,45 @@ namespace thermion
|
||||
const auto &entity = utils::Entity::import(entityId);
|
||||
auto renderableInstance = renderableManager->getInstance(entity);
|
||||
if (!renderableInstance.isValid()) {
|
||||
Log("Error: invalid renderable");
|
||||
return false;
|
||||
}
|
||||
return renderableManager->isShadowCaster(renderableInstance);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setCastShadows(TRenderableManager *tRenderableManager, EntityId entityId, bool enabled) {
|
||||
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||
const auto &entity = utils::Entity::import(entityId);
|
||||
auto renderableInstance = renderableManager->getInstance(entity);
|
||||
if (!renderableInstance.isValid()) {
|
||||
Log("Error: invalid renderable");
|
||||
return;
|
||||
}
|
||||
return renderableManager->setCastShadows(renderableInstance, enabled);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isShadowReceiver(TRenderableManager *tRenderableManager, EntityId entityId) {
|
||||
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||
const auto &entity = utils::Entity::import(entityId);
|
||||
auto renderableInstance = renderableManager->getInstance(entity);
|
||||
if (!renderableInstance.isValid()) {
|
||||
Log("Error: invalid renderable");
|
||||
return false;
|
||||
}
|
||||
return renderableManager->isShadowReceiver(renderableInstance);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setReceiveShadows(TRenderableManager *tRenderableManager, EntityId entityId, bool enabled) {
|
||||
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||
const auto &entity = utils::Entity::import(entityId);
|
||||
auto renderableInstance = renderableManager->getInstance(entity);
|
||||
if (!renderableInstance.isValid()) {
|
||||
Log("Error: invalid renderable");
|
||||
return;
|
||||
}
|
||||
return renderableManager->setReceiveShadows(renderableInstance, enabled);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_getFogEnabled(TRenderableManager *tRenderableManager, EntityId entityId) {
|
||||
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||
const auto &entity = utils::Entity::import(entityId);
|
||||
|
||||
Reference in New Issue
Block a user