Class Light
This class represents all properties of a light.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public abstract class Light : Component, IDependencyObject
Constructors
Light()
Initializes a new instance of the Light class.
Declaration
public Light()
Fields
ShadowMapManager
The instance of the shadow map manager.
Declaration
protected ShadowMapProvider ShadowMapManager
Field Value
Type | Description |
---|---|
ShadowMapProvider |
Transform
Transforms 2D or 3D.
Declaration
[BindComponent(true, true, BindComponentSource.Owner, null, true)]
public Transform3D Transform
Field Value
Type | Description |
---|---|
Transform3D |
boundingFrustum
The bounding frustum.
Declaration
protected BoundingFrustum boundingFrustum
Field Value
Type | Description |
---|---|
BoundingFrustum |
color
The color.
Declaration
protected LinearColor color
Field Value
Type | Description |
---|---|
LinearColor |
projection
The projection.
Declaration
protected Matrix4x4 projection
Field Value
Type | Description |
---|---|
Matrix4x4 |
renderProjection
The projection.
Declaration
protected Matrix4x4 renderProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
renderViewProjection
The view projection.
Declaration
protected Matrix4x4 renderViewProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
shadowBias
The depth bias.
Declaration
protected float shadowBias
Field Value
Type | Description |
---|---|
float |
shadowOpacity
The opacity of the shadow. 0 represents transparent and 1 represents opaque.
Declaration
protected float shadowOpacity
Field Value
Type | Description |
---|---|
float |
view
The view.
Declaration
protected Matrix4x4 view
Field Value
Type | Description |
---|---|
Matrix4x4 |
viewProjection
The view projection.
Declaration
protected Matrix4x4 viewProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
Properties
BoundingFrustum
Gets the light-bounding frustum.
Declaration
public BoundingFrustum BoundingFrustum { get; }
Property Value
Type | Description |
---|---|
BoundingFrustum |
CascadeCount
Gets the number of cascades associated with this light.
Declaration
public abstract int CascadeCount { get; }
Property Value
Type | Description |
---|---|
int |
Color
Gets or sets the light color.
Declaration
public virtual Color Color { get; set; }
Property Value
Type | Description |
---|---|
Color | The diffuse color. |
Intensity
Gets or sets the light intensity.
Declaration
public virtual float Intensity { get; set; }
Property Value
Type | Description |
---|---|
float |
IsShadowEnabled
Gets or sets a value indicating whether shadows are enabled.
Declaration
[RenderProperty(Tag = 1, CustomPropertyName = "Shadow enabled")]
public virtual bool IsShadowEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
LightDrawContext
Gets the associated light draw context.
Declaration
public LightDrawContext LightDrawContext { get; }
Property Value
Type | Description |
---|---|
LightDrawContext |
LightType
Gets the type of light.
Declaration
public abstract LightType LightType { get; }
Property Value
Type | Description |
---|---|
LightType |
LinearColor
Gets or sets the light color in linear space.
Declaration
public LinearColor LinearColor { get; set; }
Property Value
Type | Description |
---|---|
LinearColor |
Projection
Gets the projection matrix.
Declaration
public Matrix4x4 Projection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
RenderProjection
Gets the render projection matrix.
Declaration
public Matrix4x4 RenderProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
RenderViewProjection
Gets the rendered view projection.
Declaration
public Matrix4x4 RenderViewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
ShadowBias
Gets or sets the shadow's depth bias.
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Shadow Bias")]
public virtual float ShadowBias { get; set; }
Property Value
Type | Description |
---|---|
float |
ShadowOpacity
Gets or sets the shadow's opacity value. This property must be in the range of 0.0 (transparent) to 1.0 (opaque). The default value is 0.0.
Declaration
[RenderPropertyAsFInput(AsSlider = true, MaxLimit = 1, MinLimit = 0, AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Shadow Opacity")]
public virtual float ShadowOpacity { get; set; }
Property Value
Type | Description |
---|---|
float |
View
Gets the view matrix.
Declaration
public Matrix4x4 View { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
ViewProjection
Gets the view projection.
Declaration
public Matrix4x4 ViewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Methods
ComputeBoundingBox(out BoundingBox)
Computes the bounding box of the light.
Declaration
public abstract void ComputeBoundingBox(out BoundingBox boundingBox)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | boundingBox | The bounding box. |
FireOnShadowEnabledChanged()
Fires the OnShadowEnabledChanged event.
Declaration
protected void FireOnShadowEnabledChanged()
Intersects(ref BoundingBox)
Checks if the current light intersects with the specified bbox.
Declaration
public abstract bool Intersects(ref BoundingBox aabb)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | aabb | The frustum. |
Returns
Type | Description |
---|---|
bool | Whether the light is inside the frustum view. |
Intersects(ref BoundingFrustum)
Checks if the current light is inside the specified frustum.
Declaration
public abstract bool Intersects(ref BoundingFrustum frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustum | frustum | The frustum. |
Returns
Type | Description |
---|---|
bool | Whether the light is inside the frustum view. |
OnAttached()
Attaches the camera to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if everything is OK. |
Overrides
OnDetach()
Detaches the camera from the system.
Declaration
protected override void OnDetach()
Overrides
Events
OnColorChanged
Event fires when the color of the light changes.
Declaration
public event EventHandler<Color> OnColorChanged
Event Type
Type | Description |
---|---|
EventHandler<Color> |
OnIntensityChanged
Event fired when the intensity of the light changes.
Declaration
public event EventHandler<float> OnIntensityChanged
Event Type
Type | Description |
---|---|
EventHandler<float> |
OnShadowEnabledChanged
OnShadowEnabledChanged is called when the light shadow enable property changes.
Declaration
public event EventHandler<bool> OnShadowEnabledChanged
Event Type
Type | Description |
---|---|
EventHandler<bool> |