Class Light
This class represent all properties for 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 shadow map manager instance.
Declaration
protected ShadowMapProvider ShadowMapManager
Field Value
| Type | Description |
|---|---|
| ShadowMapProvider |
Transform
Transform 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 represent transparent and 1 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 to 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 color of the diffuse. |
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 enable.
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 light type.
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 render view projection.
Declaration
public Matrix4x4 RenderViewProjection { get; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4 |
ShadowBias
Gets or sets the shadows depthBias.
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 shadows opacity value, this property must be in the range 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)
Compute the bounding box of the light.
Declaration
public abstract void ComputeBoundingBox(out BoundingBox boundingBox)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | boundingBox | The bounding box. |
FireOnShadowEnabledChanged()
Fire the OnShadowEnabledChanged event.
Declaration
protected void FireOnShadowEnabledChanged()
Intersects(ref BoundingBox)
Check if the current light intersect 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 frustum view. |
Intersects(ref BoundingFrustum)
Check 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 frustum view. |
OnAttached()
Attach the camera to the system.
Declaration
protected override bool OnAttached()
Returns
| Type | Description |
|---|---|
| bool | True if all is OK. |
Overrides
OnDetach()
Detach the camera to the system.
Declaration
protected override void OnDetach()
Overrides
Events
OnColorChanged
Event fired when the color of the light has been changed.
Declaration
public event EventHandler<Color> OnColorChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<Color> |
OnIntensityChanged
Event fired when the intensity of the light has been changed.
Declaration
public event EventHandler<float> OnIntensityChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<float> |
OnShadowEnabledChanged
OnShadowEnabledChanged is called when the light shadow enable property changed.
Declaration
public event EventHandler<bool> OnShadowEnabledChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<bool> |