Class PointLight3D
Represents a point light in the scene.
public class PointLight3D : Light, IIdentifier, ISerialization
- Inheritance
-
PointLight3D
- Implements
- Inherited Members
Constructors
PointLight3D()
Initializes a new instance of the PointLight3D class with default property values.
public PointLight3D()
PointLight3D(Vector3, Vector4, float, float)
Creates a new instance of the PointLight3D class.
public PointLight3D(Vector3 position, Vector4 color, float range = 10, float intesity = 1)
Parameters
Properties
Ambient
The ambient color of the light.
public Vector4 Ambient { get; set; }
Property Value
Constant
The constant of the light. It get calculated based on the range and intensity.
public float Constant { get; }
Property Value
HasShadowMap
Determines if the light has a shadow map.
public override bool HasShadowMap { get; }
Property Value
Intensity
The intensity of the light.
public override float Intensity { get; set; }
Property Value
Linear
The linear attenuation of the light. It get calculated based on the range and intensity.
public float Linear { get; }
Property Value
Quadratic
The quadratic attenuation of the light. It get calculated based on the range and intensity.
public float Quadratic { get; }
Property Value
Range
The range of the light.
public float Range { get; set; }
Property Value
Specular
The specular color of the light.
public Vector4 Specular { get; set; }
Property Value
Methods
CalculateLightIntensitiy()
Sets the attenuation coefficients for the light based on a given range.
public void CalculateLightIntensitiy()
Deserialize(JObject, SerializationContext, Func<JObject, bool>)
Populates the object's properties from the specified JSON object using the provided serialization context.
public override void Deserialize(JObject obj, SerializationContext serializationContext, Func<JObject, bool> callback = null)
Parameters
objJObjectserializationContextSerializationContextThe context to use during deserialization, providing additional information or services required for the process.
callbackFunc<JObject, bool>
Dispose(IRenderDevice)
Releases all resources used by the object and performs any necessary cleanup using the specified render device.
public override void Dispose(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe render device to use for releasing graphics resources associated with this object. Cannot be null.
GetAABB(float)
Calculates the axis-aligned bounding box (AABB) of the light based on its range.
public (Vector3 min, Vector3 max) GetAABB(float minThreshold = 0.01)
Parameters
minThresholdfloat
Returns
Init(IRenderDevice)
Initializes the object using the specified render device.
public override void Init(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe render device to use for initialization. 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 the serialization process.
callbackAction<JsonWriter>
Remarks
The returned JSON object includes all relevant properties needed to reconstruct the light's state. The format is intended for interoperability with systems that consume or persist light definitions in JSON.
ToStruct()
Converts the light data to a structure for use in the shader.
public PointLight3DData ToStruct()