addLight method

  1. @override
Future<ThermionEntity> addLight(
  1. LightType type,
  2. double colour,
  3. double intensity,
  4. double posX,
  5. double posY,
  6. double posZ,
  7. double dirX,
  8. double dirY,
  9. double dirZ, {
  10. double falloffRadius = 1.0,
  11. double spotLightConeInner = pi / 8,
  12. double spotLightConeOuter = pi / 4,
  13. double sunAngularRadius = 0.545,
  14. double sunHaloSize = 10.0,
  15. double sunHaloFallof = 80.0,
  16. bool castShadows = true,
})
override

Implementation

@override
Future<ThermionEntity> addLight(
    LightType type,
    double colour,
    double intensity,
    double posX,
    double posY,
    double posZ,
    double dirX,
    double dirY,
    double dirZ,
    {double falloffRadius = 1.0,
    double spotLightConeInner = pi / 8,
    double spotLightConeOuter = pi / 4,
    double sunAngularRadius = 0.545,
    double sunHaloSize = 10.0,
    double sunHaloFallof = 80.0,
    bool castShadows = true}) async {
  var entity = await withIntCallback((callback) => add_light_ffi(
      _viewer!,
      type.index,
      colour,
      intensity,
      posX,
      posY,
      posZ,
      dirX,
      dirY,
      dirZ,
      falloffRadius,
      spotLightConeInner,
      spotLightConeOuter,
      sunAngularRadius = 0.545,
      sunHaloSize = 10.0,
      sunHaloFallof = 80.0,
      castShadows,
      callback));
  if (entity == _FILAMENT_ASSET_ERROR) {
    throw Exception("Failed to add light to scene");
  }

  _scene!.registerLight(entity);
  return entity;
}