CreateLight method

  1. @override
LightD CreateLight(
  1. LightType type,
  2. Vector3D position,
  3. Vector3D target,
  4. ColorD color,
  5. ShaderD shader,
)
override

Implementation

@override
LightD CreateLight(
  LightType type,
  Vector3D position,
  Vector3D target,
  ColorD color,
  ShaderD shader,
) => run(
  () => RaylibDebugLabels.CreateLight(type, position, target, color, shader),
  () {
    int index = _lightCount++;

    final light = LightD(
      enabled: true,
      type: type,
      position: position.copy(),
      target: target.copy(),
      color: color.copy(),
    );

    light.enabledLoc = rl.CoreD.GetShaderLocation(shader, "lights[$index].enabled");
    light.typeLoc = rl.CoreD.GetShaderLocation(shader, "lights[$index].type");
    light.positionLoc = rl.CoreD.GetShaderLocation(shader, "lights[$index].position");
    light.targetLoc = rl.CoreD.GetShaderLocation(shader, "lights[$index].target");
    light.colorLoc = rl.CoreD.GetShaderLocation(shader, "lights[$index].color");
    UpdateLightValues(shader, light);

    rl.Temp.Light$.PointerTo(light, '_RaylibLight_$index');

    return light;
  },
);