addLight method
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,
override
Add a light to the scene.
See LightManager.h for details
Note that sunAngularRadius
is in degrees,
whereas spotLightConeInner
and spotLightConeOuter
are in radians
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 {
final entityId = _module.ccall(
"add_light",
"int",
[
"void*".toJS,
"uint8_t".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"float".toJS,
"bool".toJS
].toJS,
[
_viewer,
type.index.toJS,
colour.toJS,
intensity.toJS,
posX.toJS,
posY.toJS,
posZ.toJS,
dirX.toJS,
dirY.toJS,
dirZ.toJS,
falloffRadius.toJS,
spotLightConeInner.toJS,
spotLightConeOuter.toJS,
sunAngularRadius.toJS,
sunHaloSize.toJS,
sunHaloFallof.toJS,
castShadows.toJS
].toJS,
null) as JSNumber;
if (entityId.toDartInt == -1) {
throw Exception("Failed to add light");
}
return entityId.toDartInt;
}