| Description | Hierarchy | Fields | Methods | Properties |
type TVRMLGraphTraverseState = class(TObject)
This describes current "state" (current transformation and such) when traversing VRML graph.
For VRML >= 2.0 this could be smaller, as VRML >= 2.0 doesn't need to keep track of all these LastNodes. But we want to handle VRML 1.0 100% correctly still, so there we are.
Node'y ktore trafiaja na liste LastNodes (bo sa wsrod TraverseStateLastNodesClasses) nie moga wplywac w zaden inny sposob na stan tej klasy podczas wykonywania Traverse w Before/Middle/After Traverse. Innymi slowy, gwarantuje sie ze zmiana wartosci na jakims polu jkaiegos node'a z grupy LastNodesKinds nie wplynie w zaden sposob na sposob w jaki powinien byc renderowany shape ktorego State nie zawiera danego LastNode'a. Korzystam z tego w TFLatScene.ChangedFields.
Podobnie swiatla trafiaja na ActiveLights i w zaden inny sposob nie moga zmieniac State trawersowania.
![]() |
function CurrentActiveLights: TDynActiveLightArray; |
![]() |
constructor CreateCopy(Source: TVRMLGraphTraverseState); |
![]() |
constructor Create(const ADefaultLastNodes: TTraverseStateLastNodes); overload; |
![]() |
constructor Create; overload; |
![]() |
destructor Destroy; override; |
![]() |
function Equals(SecondValue: TVRMLGraphTraverseState): boolean; |
![]() |
function EqualsNoTransform(SecondValue: TVRMLGraphTraverseState): boolean; |
![]() |
function Texture: TNodeGeneralTexture; |
![]() |
property LastNodes: TTraverseStateLastNodes read FLastNodes; |
![]() |
VRML1ActiveLights: TDynActiveLightArray; |
|
Lights active in this state, two separate versions for each VRML flavor needed here. VRML2ActiveLights should be for any VRML >= 2 (including X3D), VRML 2.0 may have more lights active (since DirectionalLight affects all siblings, and other lights affect potentially all). But VRML 2.0 may also have some lights less, since some lights are limited by radius and may be determined to not light here. Also, note that VRML2ActiveLights cannot be fully calculated in Traverse pass (contrary to everything else in TVRMLGraphTraverseState). DirectionalLights are calculated here, but positional lights have to be calculated later (VRML 2 spec says that they affect whole scene, based on their radius, and regardless of their position in VRML graph; so this is not possible to fill during Traverse call). See how UpdateVRML2ActiveLights in TVRMLFlatScene does this. | |
![]() |
VRML2ActiveLights: TDynActiveLightArray; |
|
Lights active in this state, two separate versions for each VRML flavor needed here.
VRML 2.0 may have more lights active (since DirectionalLight affects all siblings, and other lights affect potentially all). But VRML 2.0 may also have some lights less, since some lights are limited by radius and may be determined to not light here. Also, note that | |
![]() |
Transform: TMatrix4Single; |
|
Current transformation. | |
![]() |
InvertedTransform: TMatrix4Single; |
|
Inverted Transform matrix. This matrix is crucial for some special effects (for example, it's needed for calculating in tangent space for bump mapping). This is not calculated using any complex matrix inversion algorithms. Instead, this is calculated by updating this along the way, just like we calculate normal Transform. So it's simple, quick, and guaranteed to be correct assuming that user didn't use VRML 1.0 MatrixTransform along the way. That's why MatrixTransform node was removed from VRML 2.0, it breaks such things. Also, any scale with zero component along the way will make this partially invalid (we'll substitute identity in place of inverted scaling matrix). This is unavoidable, there's no reverse matrix for scaling with zero factor, since one resulting point may correpond to infinitely many source points (i.e., it's natural that such scaling function cannot be reversed). | |
![]() |
AverageScaleTransform: Single; |
|
This is a uniform scale caused by matrix Transform. I.e., if we could extract the scaling from Transform, then it would be This is calculated by updating it along the way, just like Transform is updated. This way it's calculated easily — contrary to the non-trivial operation of extracting a scale from a 4x4 matrix. It's also 100% correct, assuming that user didn't use VRML 1.0 MatrixTransform along the way. | |
![]() |
TextureTransform: TMatrix4Single; |
|
Current texture transformation. Usable only for VRML 1.0, in VRML 2.0 texture transformations don't accumulate like modelview transformations. | |
![]() |
ParentShape: TNodeShape; |
![]() |
function CurrentActiveLights: TDynActiveLightArray; |
|
This returns VRML1ActiveLights or VRML2ActiveLights, based on VRML flavor used to render with this state. More precisely, it checks "VRML flavor" by looking at ParentShape: when ParentShape is | |
![]() |
constructor CreateCopy(Source: TVRMLGraphTraverseState); |
![]() |
constructor Create(const ADefaultLastNodes: TTraverseStateLastNodes); overload; |
![]() |
constructor Create; overload; |
|
Standard create, with standard initial LastNodes state. This is equivalent to creating last nodes like TraverseState_CreateNodes(StateDefaultNodes) then creating this object with Create(StateDefaultNodes) When this object will be freed, such implicitly created StateDefaultNodes will be also freed (using TraverseState_FreeAndNilNodes). Note: while this constructor seems very comfortable, in some cases it's not useful, exactly because it frees at the end used StateDefaultNodes. Consider e.g. TVRMLFlatScene, that has to traverse all nodes and store the traversing result in a flat list: this means that it must save various TVRMLGraphTraverseState instances, that may have references to nodes from StateDefaultNodes. So it must have independent StateDefaultNodes field that "lives" for the whole lifetime of TVRMLFlatScene and is passed to each If you don't understand the note above then don't worry, you're probably fine with using this parameter-less constructor :) | |
![]() |
destructor Destroy; override; |
![]() |
function Equals(SecondValue: TVRMLGraphTraverseState): boolean; |
|
Compare with other TVRMLGraphTraverseState instance. The idea is that two states are equal if, when applied to the same VRML node, they "mean" the same thing, i.e. produce the same shape, behavior etc. So note that | |
![]() |
function EqualsNoTransform(SecondValue: TVRMLGraphTraverseState): boolean; |
|
This is like Equals but it ignores some fields that are ignored when rendering using TVRMLOpenGLRenderer.RenderShapeStateNoTransform. For example, it ignores Transform, AverageScaleTransform, InvertedTransform. | |
![]() |
function Texture: TNodeGeneralTexture; |
|
Returns proper texture node that should be used for nodes within this State, regardless whether this in VRML 1.0 or 2.0. Details: If ParentShape <> nil, this returns texture node taken from ParentShape.Texture (note that it may be nil, if Apperance of Appearance.Texture node is NULL in VRML). Otherwise it returns texture from LastNodes.Texture2. | |
![]() |
property LastNodes: TTraverseStateLastNodes read FLastNodes; |
|
nie, ParentsCount elementow Last* NIE odzwierciedla faktu ze sa one podlegle TVRMLRenderState. W ogole ten obiekt nie zajmuje sie zarzadzaniem tymi polami - on tylko przechowuje sobie ich wartosci. W szczegolnosci wiec gwarantowane jest ze obiekty nigdy nie beda nil ale ta gwarancja musi byc takze zapewniona przez kod ktory tworzy ten obiekt przez Create. | |