addLight now accepts a LightType enum; added support for setting falloff, spot light radius, sun radius & halo

This commit is contained in:
Nick Fisher
2024-05-21 13:23:23 +08:00
parent 173ff4be20
commit d7edf105c4
9 changed files with 224 additions and 30 deletions

View File

@@ -71,7 +71,24 @@ extern "C"
EMSCRIPTEN_KEEPALIVE void rotate_ibl(const void *const viewer, float *rotationMatrix);
EMSCRIPTEN_KEEPALIVE void remove_skybox(const void *const viewer);
EMSCRIPTEN_KEEPALIVE void remove_ibl(const void *const viewer);
EMSCRIPTEN_KEEPALIVE EntityId add_light(const void *const viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
EMSCRIPTEN_KEEPALIVE EntityId add_light(
const void *const viewer,
uint8_t type,
float colour,
float intensity,
float posX,
float posY,
float posZ,
float dirX,
float dirY,
float dirZ,
float falloffRadius,
float spotLightConeInner,
float spotLightConeOuter,
float sunAngularRadius,
float sunHaloSize,
float sunHaloFallof,
bool shadows);
EMSCRIPTEN_KEEPALIVE void remove_light(const void *const viewer, EntityId entityId);
EMSCRIPTEN_KEEPALIVE void clear_lights(const void *const viewer);
EMSCRIPTEN_KEEPALIVE EntityId load_glb(void *sceneManager, const char *assetPath, int numInstances);

View File

@@ -54,6 +54,12 @@ extern "C"
float dirX,
float dirY,
float dirZ,
float falloffRadius,
float spotLightConeInner,
float spotLightConeOuter,
float sunAngularRadius,
float sunHaloSize,
float sunHaloFallof,
bool shadows,
void (*callback)(EntityId));
EMSCRIPTEN_KEEPALIVE void remove_light_ffi(void *const viewer, EntityId entityId);

View File

@@ -127,7 +127,23 @@ namespace flutter_filament
void scrollEnd();
void pick(uint32_t x, uint32_t y, void (*callback)(EntityId entityId, int x, int y));
EntityId addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
EntityId addLight(
LightManager::Type t,
float colour,
float intensity,
float posX,
float posY,
float posZ,
float dirX,
float dirY,
float dirZ,
float falloffRadius,
float spotLightConeInner,
float spotLightConeOuter,
float sunAngularRadius,
float sunHaloSize,
float sunHaloFallof,
bool shadows);
void removeLight(EntityId entityId);
void clearLights();
void setPostProcessing(bool enabled);