Class DirectionalLight3D
An directional light in 3D space. TODO: Create an uniform for the bias
public class DirectionalLight3D : Light, IIdentifier, ISerialization
- Inheritance
-
DirectionalLight3D
- Implements
- Inherited Members
Constructors
DirectionalLight3D()
Initializes a new instance of the DirectionalLight3D class.
public DirectionalLight3D()
DirectionalLight3D(Vector3, Vector4, float)
Creates a new instance of the DirectionalLight3D class.
public DirectionalLight3D(Vector3 direction, Vector4 color, float intensity)
Parameters
Properties
Ambient
The ambient color of the light.
public Vector3 Ambient { get; set; }
Property Value
Bias
The Bias of the light shadow map.
public float Bias { get; set; }
Property Value
Direction
The direction of the light.
public Vector3 Direction { get; set; }
Property Value
HasShadowMap
Gets a value indicating whether this object supports a shadow map.
public override bool HasShadowMap { get; }
Property Value
Specular
The specular color of the light.
public Vector3 Specular { get; set; }
Property Value
Methods
Deserialize(JObject, SerializationContext, Func<JObject, bool>)
Populates the properties of the current instance from the specified JSON object using the provided serialization context.
public override void Deserialize(JObject obj, SerializationContext serializationContext, Func<JObject, bool> callback = null)
Parameters
objJObjectserializationContextSerializationContextA SerializationContext that provides context or settings for the deserialization process.
callbackFunc<JObject, bool>
Remarks
This method updates the state of the current object based on the values found in
jObject. All expected properties must be present in the JSON object for correct
deserialization.
Dispose(IRenderDevice)
Releases all resources used by the shadow map associated with the directional light.
public override void Dispose(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe rendering device to use when disposing of resources. Cannot be null.
Init(IRenderDevice)
Initializes the shadow map resources for the directional light using the specified render device.
public override void Init(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe render device used to create the shadow map render target. Cannot be null.
Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)
Serializes the current light object to a JSON representation suitable for storage or transmission.
public override void Serialize(JsonWriter writer, SerializationContext serializationContext, Action<JsonWriter> callback = null)
Parameters
writerJsonWriterserializationContextSerializationContextThe context that provides information and services required for serialization.
callbackAction<JsonWriter>
Remarks
The returned JSON object includes type information and key light properties such as color, position, intensity, shadow map size, direction, ambient, specular, and bias. This method is typically used to persist or transfer light configuration data.