Class TAbstractBindableNode

Unit

Declaration

type TAbstractBindableNode = class(TAbstractChildNode)

Description

Abstract base type for all bindable children nodes.

Hierarchy

Overview

Methods

Protected procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;
Public constructor Create(const AX3DName: String = ''; const ABaseUrl: String = ''); override;
Public procedure CreateNode; override;
Public class function ClassX3DType: String; override;

Properties

Public property Bound: Boolean read FBound write SetBound;
Public property Transform: TMatrix4 read FTransform;
Public property TransformScale: Single read FTransformScale;
Public property EventSet_bind: TSFBoolEvent read FEventSet_bind;
Public property EventBindTime: TSFTimeEvent read FEventBindTime;
Public property EventIsBound: TSFBoolEvent read FEventIsBound;

Description

Methods

Protected procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;

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

Override these methods to determine what happens when given node is traversed during Traverse call. The main use of this is to operate on TX3DGraphTraverseStateStack.

Remember to always call inherited when overriding. In BeforeTraverse and MiddleTraverse you should call inherited at the beginning, in AfterTraverse inherited should be called at the end.

Besides changing StateStack.Top fields, you can do push/pop on the stack. Remember that if you do StateStack.Push in BeforeTraverse, and then you must call StateStack.Pop in AfterTraverse.

Public constructor Create(const AX3DName: String = ''; const ABaseUrl: String = ''); override;

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

Constructor. Initializes various properties:

  • Name, BaseUrl are initialized from given parameters.

  • The Fields, Events lists are filled in every descendant, to have all the fields/events defined by the specification.

  • DefaultContainerField, and other node-specific stuff, is filled in descendants. This is actually implemented in CreateNode, that is called at the end of this constructor.

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 Bound: Boolean read FBound write SetBound;

"Bound" node is the node currently used, for example the "bound" background determines the current background look. Setting this to True means that the node becomes the current node of the given type in the scene.

In every scene (TCastleScene), there are four "stacks" of bindable nodes:

  1. Viewpoints determine the camera position/orientation, field of view, orthographic/perspective projection etc.

  2. NavigationInfo determines the current navigation type, avatar size etc.

  3. Background determines the dispayed background (like a skybox or a simple solid color).

  4. Fog determines the current fog.

The top-most node of each stack is called "bound". If the scene is set as TCastleRootTransform.MainScene, then the "bound" node determines the camera, background or fog settings.

Setting this property to True sends an X3D event "set_bind := true". This adds the node to the stack, and makes sure it is at the top. Setting this to False pops the node from the stack. See the X3D specification about the "bindable nodes" foe details: http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/core.html#BindableChildrenNodes

Public property Transform: TMatrix4 read FTransform;

Transformation of this bindable node.

Bound nodes cannot be instantiated multiple number of times (this would make simple event like "set_bind" not possible, as it would not be known in what coordinate space the node is bound), so it's perfectly safe and comfortable to just keep their transformation here, a their property.

It is gathered during traversing. Last BeforeTraverse call for this node sets Transform properties. By default, these represent identity transformation.

Note that using TransformScale for bindable nodes like fog is a little simplification. Theoretically, the scale can be non-uniform, and around an arbitrary axis. So to apply e.g. fog, we should transform the 3D world back into local fog coordinate system, and calculate the distances there. Instead right now we do the opposite: transform stuff like fog VisibilityRange by TransformScale, and calculate distances in world coordinate system. This is a simplification, but in practice it's perfect (who uses non-uniform fog scale?) and it can be expressed for renderers (OpenGL) without any problems.

Public property TransformScale: Single read FTransformScale;

This item has no description.

Public property EventSet_bind: TSFBoolEvent read FEventSet_bind;

This item has no description.

Public property EventBindTime: TSFTimeEvent read FEventBindTime;

This item has no description.

Public property EventIsBound: TSFBoolEvent read FEventIsBound;

This item has no description.


Generated by PasDoc 0.16.0-snapshot.