LightComponent

Reusable light behavior that can be attached to any Node.

Properties

Type

(LightType) { get; set } = LightType.Point: Gets or sets how the light emits. A Directional light ignores the node's position and shines along its forward axis.

Intensity

(float) { get; set } = 1f: Gets or sets the intensity of the light. A point light's contribution falls off with distance squared, so a scene lit from d units away needs roughly d² here; a directional light does not attenuate, so useful values are near 1.

Color

(Vector4) { get; set } = new(1f): Gets or sets the color of the light as RGBA.

Public Methods

CreatePointLight

public static LightComponent CreatePointLight(float intensity, Vector4 color)

Creates a configured point light component.

Parameters:

  • intensity (float): The light intensity.
  • color (Vector4): The light color.

Returns: LightComponent

  • A configured LightComponent.

CreateDirectionalLight

public static LightComponent CreateDirectionalLight(float intensity, Vector4 color)

Creates a configured directional light, for a sun or a moon. The direction comes from the node's orientation, so rotate the node to aim it.

Parameters:

  • intensity (float): The light intensity. Directional light does not attenuate.
  • color (Vector4): The light color.

Returns: LightComponent

  • A configured LightComponent.