Class TAbstractPositionalLightNode

Unit

Declaration

type TAbstractPositionalLightNode = class(TAbstractPunctualLightNode)

Description

Base class for all positional lights.

Hierarchy

Overview

Methods

Public constructor Create(const AX3DName: string = ''; const ABaseUrl: string = ''); override;
Public function DistanceNeededForAttenuation: boolean;
Public function CalculateAttenuation(const DistanceToLight: Single): Single; overload;
Public function HasAttenuation: boolean;
Public function HasRadius: boolean; virtual;
Public procedure UpdateLightInstance(var LightInstance: TLightInstance); override;
Public function PositionAndDirection: TVector4; override;
Public procedure CreateNode; override;
Public class function ClassX3DType: string; override;

Properties

Public property SceneLocation: TVector3 read GetSceneLocation write SetSceneLocation;
Public property FdAttenuation: TSFVec3f read FFdAttenuation;
Public property Attenuation: TVector3 read GetAttenuation write SetAttenuation;
Public property FdLocation: TSFVec3f read FFdLocation;
Public property Location: TVector3 read GetLocation write SetLocation;
Public property FdRadius: TSFFloat read FFdRadius;
Public property Radius: Single read GetRadius write SetRadius;

Description

Methods

Public constructor Create(const AX3DName: string = ''; const ABaseUrl: string = ''); override;
 
Public function DistanceNeededForAttenuation: boolean;

Calculate light intensity drop because of the distance to the light. This follows the equation 1/max( attenuation[0] + ... ) from the VRML/X3D specification, it is the same as OpenGL attenuation.

Since calculating the DistanceToLight for the Attenuation method may be time-consuming in some situations, you can check DistanceNeededForAttenuation first. When the DistanceNeededForAttenuation returns False, then the value of DistanceToLight parameter is ignored (you can pass anything).

The DistanceToLight should be a distance in the light source local coordinate system. TODO: although our renderers currently ignore this: ray-tracer uses global coord system, OpenGL (fixed-function and shader) renderer uses eye coord system (should be equal to global coord system for normal cameras).

Public function CalculateAttenuation(const DistanceToLight: Single): Single; overload;
 
Public function HasAttenuation: boolean;

Is attenuation relevant. When False, you know that Attenuation function always returns 1, so there's no point in using it at all.

Public function HasRadius: boolean; virtual;

Should the "radius" field be taken into account.

Public procedure UpdateLightInstance(var LightInstance: TLightInstance); override;
 
Public function PositionAndDirection: TVector4; override;
 
Public procedure CreateNode; override;
 
Public class function ClassX3DType: string; override;
 

Properties

Public property SceneLocation: TVector3 read GetSceneLocation write SetSceneLocation;

Light location, expressed in scene (current TCastleScene) coordinates. Do not use this if the light node may be instantiated multiple times in the scene. The same warning as for Transform applies also here.

Public property FdAttenuation: TSFVec3f read FFdAttenuation;

Internal wrapper for property Attenuation. This wrapper API may change, we advise to access simpler Attenuation instead.

Public property Attenuation: TVector3 read GetAttenuation write SetAttenuation;
 
Public property FdLocation: TSFVec3f read FFdLocation;

Internal wrapper for property Location. This wrapper API may change, we advise to access simpler Location instead.

Public property Location: TVector3 read GetLocation write SetLocation;
 
Public property FdRadius: TSFFloat read FFdRadius;

Internal wrapper for property Radius. This wrapper API may change, we advise to access simpler Radius instead.

Public property Radius: Single read GetRadius write SetRadius;
 

Generated by PasDoc 0.16.0.