Class TAbstractLightNode

Unit

Declaration

type TAbstractLightNode = class(TAbstractChildNode)

Description

Base class for all VRML / X3D light nodes.

Note that even the old VRML 1.0 light nodes inherit from this. Although they interpret some bits differently ("ambientIntensity" < 0 has special meaning). But most of the fields behave identically, they only have different default values.

Hierarchy

Overview

Methods

Protected procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;
Protected procedure MiddleTraverse(StateStack: TX3DGraphTraverseStateStack); override;
Protected function GetProjectionLocationLocal: TVector3; virtual;
Protected procedure SetProjectionLocationLocal(const Value: TVector3); virtual;
Protected function GetProjectionDirectionLocal: TVector3; virtual;
Protected procedure SetProjectionDirectionLocal(const Value: TVector3); virtual;
Public procedure CreateNode; override;
Public function ProjectionMatrix: TMatrix4; virtual;
Public function ModelviewMatrix: TMatrix4; virtual;
Public function ModelviewRotationMatrix: TMatrix4; virtual;
Public function GetProjectorMatrix: TMatrix4;
Public procedure GetView(out Pos, Dir, Side, Up: TVector3);
Public procedure Box3DDistances(const Box: TBox3D; out MinDistance, MaxDistance: Single); virtual; abstract;
Public function CreateLightInstance(State: TX3DGraphTraverseState): TLightInstance;
Public procedure UpdateLightInstanceState( var LightInstance: TLightInstance; State: TX3DGraphTraverseState);
Public procedure UpdateLightInstance( var LightInstance: TLightInstance); virtual;
Public function TransformationChange: TNodeTransformationChange; override;
Public function Scope: TLightScope; virtual;
Public function PositionAndDirection: TVector4; virtual; abstract;
Public procedure SetEffects(const Value: array of TEffectNode);

Properties

Public property FdOn: TSFBool read FFdOn;
Public property FdIntensity: TSFFloat read FFdIntensity;
Public property FdColor: TSFColor read FFdColor;
Public property FdAmbientIntensity: TSFFloat read FFdAmbientIntensity;
Public property FdGlobal: TSFBool read FFdGlobal;
Public property FdShadowVolumes: TSFBool read FFdShadowVolumes;
Public property FdShadowVolumesMain: TSFBool read FFdShadowVolumesMain;
Public property FdShowProxyGeometry: TSFBool read FFdShowProxyGeometry;
Public property FdProjectionNear: TSFFloat read FFdProjectionNear;
Public property FdProjectionFar: TSFFloat read FFdProjectionFar;
Public property FdUp: TSFVec3f read FFdUp;
Public property FdDefaultShadowMap: TSFNode read FFdDefaultShadowMap;
Public property FdShadows: TSFBool read FFdShadows;
Public property FdEffects: TMFNode read FFdEffects;
Public property Transform: TMatrix4 read FTransform;
Public property InvertedTransform: TMatrix4 read FInvertedTransform;
Public property ProjectionLocationLocal: TVector3 read GetProjectionLocationLocal write SetProjectionLocationLocal;
Public property ProjectionDirectionLocal: TVector3 read GetProjectionDirectionLocal write SetProjectionDirectionLocal;
Public property ProjectionSceneLocation: TVector3 read GetProjectionSceneLocation write SetProjectionSceneLocation;
Public property ProjectionSceneDirection: TVector3 read GetProjectionSceneDirection write SetProjectionSceneDirection;
Public property AmbientIntensity: Single read GetAmbientIntensity write SetAmbientIntensity;
Public property Color: TCastleColorRGB read GetColor write SetColor;
Public property Global: boolean read GetGlobal write SetGlobal;
Public property Intensity: Single read GetIntensity write SetIntensity;
Public property IsOn: boolean read GetIsOn write SetIsOn;
Public property Shadows: boolean read GetShadows write SetShadows;
Public property ShadowVolumes: boolean read GetShadowVolumes write SetShadowVolumes;
Public property ShadowVolumesMain: boolean read GetShadowVolumesMain write SetShadowVolumesMain;
Public property ProjectionNear: Single read GetProjectionNear write SetProjectionNear;
Public property ProjectionFar: Single read GetProjectionFar write SetProjectionFar;
Public property Up: TVector3 read GetUp write SetUp;
Public property DefaultShadowMap: TGeneratedShadowMapNode read GetDefaultShadowMap write SetDefaultShadowMap;

Description

Methods

Protected procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;
 
Protected procedure MiddleTraverse(StateStack: TX3DGraphTraverseStateStack); override;
 
Protected function GetProjectionLocationLocal: TVector3; virtual;
 
Protected procedure SetProjectionLocationLocal(const Value: TVector3); virtual;
 
Protected function GetProjectionDirectionLocal: TVector3; virtual;
 
Protected procedure SetProjectionDirectionLocal(const Value: TVector3); virtual;
 
Public procedure CreateNode; override;
 
Public function ProjectionMatrix: TMatrix4; virtual;

Matrices for rendering shadow map from this light. Identity in this class, override for subclasses able to do shadow mapping.

Public function ModelviewMatrix: TMatrix4; virtual;
 
Public function ModelviewRotationMatrix: TMatrix4; virtual;
 
Public function GetProjectorMatrix: TMatrix4;
 
Public procedure GetView(out Pos, Dir, Side, Up: TVector3);
 
Public procedure Box3DDistances(const Box: TBox3D; out MinDistance, MaxDistance: Single); virtual; abstract;

Calculate distances between the given Box and this light source. This is intended to capture the depth distances where the box resides, useful for calculating e.g. depth ranges to capture in the shadow maps. Depending on light source type, various distance measures may be used, appropriate to light sources projection.

Always MinDistance <= MaxDistance. They may be negative when we measure along the light's direction.

Exceptions raised
EBox3DEmpty
When used with an empty box.
Public function CreateLightInstance(State: TX3DGraphTraverseState): TLightInstance;

Create TLightInstance record describing this light node under given State.

Public procedure UpdateLightInstanceState( var LightInstance: TLightInstance; State: TX3DGraphTraverseState);

Update TLightInstance record when lighting State changes. Assumes that LightInstance.Node = Self.

This will set LightInstance.Transform properties, and recalculate all LightInstance properties based on Transform.

Public procedure UpdateLightInstance( var LightInstance: TLightInstance); virtual;

Update TLightInstance record when lighting location/direction (and other properties precalculated on TLightInstance) change. Assumes that LightInstance.Node = Self.

Public function TransformationChange: TNodeTransformationChange; override;
 
Public function Scope: TLightScope; virtual;

Light scope. Default implementation returns lsGlobal or lsLocal, depending on "global" field value (this follows VRML/X3D >= 2.0 rules).

Public function PositionAndDirection: TVector4; virtual; abstract;

Position and direction expressed in homogeneous coordinates. For positional lights, the last component is always 1. For directional lights, the last component is always 0.

Note that this is expressed in the local light node coordinate system.

Public procedure SetEffects(const Value: array of TEffectNode);
 

Properties

Public property FdOn: TSFBool read FFdOn;
 
Public property FdIntensity: TSFFloat read FFdIntensity;
 
Public property FdColor: TSFColor read FFdColor;
 
Public property FdAmbientIntensity: TSFFloat read FFdAmbientIntensity;
 
Public property FdGlobal: TSFBool read FFdGlobal;
 
Public property FdShadowVolumes: TSFBool read FFdShadowVolumes;
 
Public property FdShadowVolumesMain: TSFBool read FFdShadowVolumesMain;
 
Public property FdShowProxyGeometry: TSFBool read FFdShowProxyGeometry;

showProxyGeometry field is an InstantReality extension, see [http://instant-reality.com/documentation/nodetype/Light/].

Public property FdProjectionNear: TSFFloat read FFdProjectionNear;

projectionNear / projectionFar / up are Kambi extensions, see [https://castle-engine.io/x3d_extensions_shadow_maps.php#section_light_parameters]

Public property FdProjectionFar: TSFFloat read FFdProjectionFar;
 
Public property FdUp: TSFVec3f read FFdUp;
 
Public property FdDefaultShadowMap: TSFNode read FFdDefaultShadowMap;
 
Public property FdShadows: TSFBool read FFdShadows;
 
Public property FdEffects: TMFNode read FFdEffects;
 
Public property Transform: TMatrix4 read FTransform;

Transformation of this light node. Beware: In X3D, light nodes can be instantiated many times within the scene, with different transformations, so this transformation property should not be used in general.

Use this only if you you know that light node occurs only once within the scene (see [https://castle-engine.io/x3d_extensions.php#section_ext_shadow_maps]). Or if you're fine with just getting an undefined transformation, for any of the light instances.

This value is calculated during traversing. Last BeforeTraverse call for this node sets this property. By default, it represents identity transformation.

Public property InvertedTransform: TMatrix4 read FInvertedTransform;
 
Public property ProjectionLocationLocal: TVector3 read GetProjectionLocationLocal write SetProjectionLocationLocal;

Light location, direction and up vectors, for projection. Useful when you think of lights as cameras (for shadow maps).

ProjectionDirectionLocal will always be exactly zero for a PointLight (that doesn't have a direction).

The GetView returns vectors in global (scene) space. It guarantees that Direction, Side and Up are normalized and orthogonal to each other.

Public property ProjectionDirectionLocal: TVector3 read GetProjectionDirectionLocal write SetProjectionDirectionLocal;
 
Public property ProjectionSceneLocation: TVector3 read GetProjectionSceneLocation write SetProjectionSceneLocation;
 
Public property ProjectionSceneDirection: TVector3 read GetProjectionSceneDirection write SetProjectionSceneDirection;
 
Public property AmbientIntensity: Single read GetAmbientIntensity write SetAmbientIntensity;
 
Public property Color: TCastleColorRGB read GetColor write SetColor;
 
Public property Global: boolean read GetGlobal write SetGlobal;
 
Public property Intensity: Single read GetIntensity write SetIntensity;
 
Public property IsOn: boolean read GetIsOn write SetIsOn;
 
Public property Shadows: boolean read GetShadows write SetShadows;
 
Public property ShadowVolumes: boolean read GetShadowVolumes write SetShadowVolumes;
 
Public property ShadowVolumesMain: boolean read GetShadowVolumesMain write SetShadowVolumesMain;
 
Public property ProjectionNear: Single read GetProjectionNear write SetProjectionNear;
 
Public property ProjectionFar: Single read GetProjectionFar write SetProjectionFar;
 
Public property Up: TVector3 read GetUp write SetUp;
 
Public property DefaultShadowMap: TGeneratedShadowMapNode read GetDefaultShadowMap write SetDefaultShadowMap;
 

Generated by PasDoc 0.15.0.