Table of Contents

Class PointLight3D

Namespace
LibGFX.Graphics.Lights
Assembly
LibGFX.dll

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

position Vector3
color Vector4
range float
intesity float

Properties

Ambient

The ambient color of the light.

public Vector4 Ambient { get; set; }

Property Value

Vector4

Constant

The constant of the light. It get calculated based on the range and intensity.

public float Constant { get; }

Property Value

float

HasShadowMap

Determines if the light has a shadow map.

public override bool HasShadowMap { get; }

Property Value

bool

Intensity

The intensity of the light.

public override float Intensity { get; set; }

Property Value

float

Linear

The linear attenuation of the light. It get calculated based on the range and intensity.

public float Linear { get; }

Property Value

float

Quadratic

The quadratic attenuation of the light. It get calculated based on the range and intensity.

public float Quadratic { get; }

Property Value

float

Range

The range of the light.

public float Range { get; set; }

Property Value

float

Specular

The specular color of the light.

public Vector4 Specular { get; set; }

Property Value

Vector4

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

obj JObject
serializationContext SerializationContext

The context to use during deserialization, providing additional information or services required for the process.

callback Func<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

renderer IRenderDevice

The 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

minThreshold float

Returns

(Vector3 min, Vector3 max)

Init(IRenderDevice)

Initializes the object using the specified render device.

public override void Init(IRenderDevice renderer)

Parameters

renderer IRenderDevice

The 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

writer JsonWriter
serializationContext SerializationContext

The context that provides information and services required for the serialization process.

callback Action<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()

Returns

PointLight3DData