Class TSpotLightNode

Unit

Declaration

type TSpotLightNode = class(TAbstractPositionalLightNode)

Description

Light source that emits light from a specific point along a specific direction constrained within a cone.

Hierarchy

Overview

Methods

Protected function GetProjectionLocationLocal: TVector3; override;
Protected procedure SetProjectionLocationLocal(const Value: TVector3); override;
Protected function GetProjectionDirectionLocal: TVector3; override;
Protected procedure SetProjectionDirectionLocal(const Value: TVector3); override;
Public class function ForVRMLVersion(const Version: TX3DVersion): boolean; override;
Public procedure UpdateLightInstance(var LightInstance: TLightInstance); override;
Public function ProjectionMatrix: TMatrix4; override;
Public function ModelviewMatrix: TMatrix4; override;
Public function ModelviewRotationMatrix: TMatrix4; override;
Public procedure Box3DDistances(const Box: TBox3D; out MinDistance, MaxDistance: Single); override;
Public function SpotCutoffDeg: Single;
Public function SpotCosCutoff: Single;
Public function SpotExponentApproximate: Single;
Public function EffectiveProjectionAngle: Single;
Public procedure CreateNode; override;
Public class function ClassX3DType: String; override;

Properties

Public property FdBeamWidth: TSFFloat read FFdBeamWidth;
Public property BeamWidth: Single read GetBeamWidth write SetBeamWidth;
Public property FdCutOffAngle: TSFFloat read FFdCutOffAngle;
Public property CutOffAngle: Single read GetCutOffAngle write SetCutOffAngle;
Public property FdDirection: TSFVec3f read FFdDirection;
Public property Direction: TVector3 read GetDirection write SetDirection;
Public property FdProjectionAngle: TSFFloat read FFdProjectionAngle;
Public property ProjectionAngle: Single read GetProjectionAngle write SetProjectionAngle;

Description

Methods

Protected function GetProjectionLocationLocal: TVector3; override;

This item has no description.

Protected procedure SetProjectionLocationLocal(const Value: TVector3); override;

This item has no description.

Protected function GetProjectionDirectionLocal: TVector3; override;

This item has no description.

Protected procedure SetProjectionDirectionLocal(const Value: TVector3); override;

This item has no description.

Public class function ForVRMLVersion(const Version: TX3DVersion): boolean; override;

This item has no description. Showing description inherited from TX3DNode.ForVRMLVersion.

Some nodes are present only in specific VRML/X3D version. This functions decides it.

For example some nodes can only work in VRML < 2.0, some others only in VRML >= 2.0. There are even some pairs of nodes: for example TConeNode_1 works with VRML < 2.0, TConeNode works with VRML >= 2.0.

NodesManager will use this.

Default implementation of this function returns always True. Generally, I don't try to set this too aggresively — in other words, for all cases when it's sensible, I allow nodes to be used in every VRML/X3D version, even when official specification doesn't. This means that when reading VRML 1.0 files actually a large part of VRML 2.0 is allowed too, and also while reading VRML 2.0 many constructs from VRML 1.0 (officially no longer present in VRML 2.0) are allowed too. I'm trying to support what I call a "sum of VRML 1.0 and 2.0".

In practice I only use this function when various VRML/X3D versions specify the same node name but

  • With different fields.

    For example Cone and Cylinder have slightly different fields, due to the fact that VRML 2.0 resigned from using TSFBitMask fields.

  • With different behavior.

    For example definitions of Sphere for VRML 1.0 and 2.0 are practically equal. However, the behavior from where to take texture and material info is different — in VRML 1.0 we take last Texture2, Material etc. nodes, while in VRML 2.0 we look in parent Shape's "appearance" field. So once again two different Sphere classes are needed.

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

This item has no description. Showing description inherited from TAbstractLightNode.UpdateLightInstance.

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

Public function ProjectionMatrix: TMatrix4; override;

This item has no description. Showing description inherited from TAbstractPunctualLightNode.ProjectionMatrix.

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

Public function ModelviewMatrix: TMatrix4; override;

This item has no description.

Public function ModelviewRotationMatrix: TMatrix4; override;

This item has no description.

Public procedure Box3DDistances(const Box: TBox3D; out MinDistance, MaxDistance: Single); override;

This item has no description. Showing description inherited from TAbstractPunctualLightNode.Box3DDistances.

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.

Public function SpotCutoffDeg: Single;

Spot cutoff angle (based on cutOffAngle).

Expressed in degrees, clamped to correct range (since user can input any value in VRML, and also conversion radians -> degrees could accidentally raise value slightly > 90, so cutOffAngle = 1.5708 is in degrees 90.0002104591, which would cause OpenGL fixed-function error).

Public function SpotCosCutoff: Single;

This item has no description.

Public function SpotExponentApproximate: Single;

Approximate spot exponent that could be used to render this spot light. Do not use this, unless you really have to. X3D spot light should have a linear fallback, from beamWidth to cutOffAngle, and there is no sensible way to approximate it by an exponent. Use this only if you have to render spot light with exponent, e.g. for OpenGL fixed-function pipeline.

Public function EffectiveProjectionAngle: Single;

Projection angle, from ProjectionAngle or 2 * CutOffAngle. See https://castle-engine.io/x3d_extensions_shadow_maps.php .

Public procedure CreateNode; override;

Create node fields and events.

Public class function ClassX3DType: String; override;

This item has no description. Showing description inherited from TX3DNode.ClassX3DType.

Node type name in VRML/X3D, for this class. Normal VRML/X3D node classes should override this to return something non-empty, and then X3DType automatically will return the same value.

Empty for classes that don't have a hardcoded VRML/X3D node name, like a special TX3DUnknownNode. Such special classes should override then X3DType to return actual non-empty name there.

You usually should call X3DType. The only use of this method is that it works on classes (it's "class function"), without needing at actual instance.

Properties

Public property FdBeamWidth: TSFFloat read FFdBeamWidth;

Internal wrapper for property BeamWidth. This wrapper API may change, we advise to access simpler BeamWidth instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart).

Public property BeamWidth: Single read GetBeamWidth write SetBeamWidth;

This item has no description.

Public property FdCutOffAngle: TSFFloat read FFdCutOffAngle;

Internal wrapper for property CutOffAngle. This wrapper API may change, we advise to access simpler CutOffAngle instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart).

Public property CutOffAngle: Single read GetCutOffAngle write SetCutOffAngle;

This item has no description.

Public property FdDirection: TSFVec3f read FFdDirection;

Internal wrapper for property Direction. This wrapper API may change, we advise to access simpler Direction instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart).

Public property Direction: TVector3 read GetDirection write SetDirection;

This item has no description.

Public property FdProjectionAngle: TSFFloat read FFdProjectionAngle;

Internal wrapper for property ProjectionAngle. This wrapper API may change, we advise to access simpler ProjectionAngle instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart).

Public property ProjectionAngle: Single read GetProjectionAngle write SetProjectionAngle;

This item has no description.


Generated by PasDoc 0.16.0-snapshot.