Class TAbstractShapeNode

Unit

Declaration

type TAbstractShapeNode = class(TAbstractChildNode)

Description

Base node type for all Shape nodes.

Hierarchy

Overview

Fields

Public InternalWasVisibleFrameId: TFrameId;

Methods

Protected function DirectEnumerateActive(Func: TEnumerateChildrenFunction): Pointer; override;
Public constructor Create(const AX3DName: string = ''; const ABaseUrl: String = ''); override;
Public procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;
Public procedure AfterTraverse(StateStack: TX3DGraphTraverseStateStack); override;
Public function CommonSurfaceShader: TCommonSurfaceShaderNode; deprecated 'use TMaterialNode instead of TCommonSurfaceShaderNode (it has the same functionality and is standardized in X3D v4)';
Public function WasVisible: Boolean;
Public procedure CreateNode; override;
Public class function ClassX3DType: String; override;

Properties

Public property Texture: TAbstractTextureNode read GetTexture write SetTexture; deprecated 'create and assign texture node instance explicitly, then set Appearance.Texture';
Public property TextureTransform: TAbstractTextureTransformNode read GetTextureTransform write SetTextureTransform; deprecated 'create and assign texture transformatiom node instance explicitly, then set Appearance.TextureTransform';
Public property Material: TAbstractMaterialNode read GetMaterial write SetMaterial; deprecated 'create and assign TAppearanceNode instance explicitly, then set Appearance.Material';
Public property LineProperties: TLinePropertiesNode read GetLineProperties write SetLineProperties; deprecated 'create and assign TLinePropertiesNode instance explicitly, then set Appearance.LineProperties';
Public property FdAppearance: TSFNode read FFdAppearance;
Public property Appearance: TAppearanceNode read GetAppearance write SetAppearance;
Public property FdGeometry: TSFNode read FFdGeometry;
Public property Geometry: TAbstractGeometryNode read GetGeometry write SetGeometry;
Public property FdBboxCenter: TSFVec3f read FFdBboxCenter;
Public property BBox: TBox3D read GetBBox write SetBBox;
Public property FdBboxSize: TSFVec3f read FFdBboxSize;
Public property FdShading: TSFStringEnum read FFdShading;
Public property Shading: TShading read GetShading write SetShading;
Public property FdVisible: TSFBool read FFdVisible;
Public property Visible: Boolean read GetVisible write SetVisible;
Public property FdCollision: TSFStringEnum read FFdCollision;
Public property Collision: TShapeCollision read GetCollision write SetCollision;
Public property Render: Boolean read GetVisible write SetVisible default true; deprecated 'use Visible';

Description

Fields

Public InternalWasVisibleFrameId: TFrameId;

This item has no description.

Methods

Protected function DirectEnumerateActive(Func: TEnumerateChildrenFunction): Pointer; override;

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

Enumerate all active child nodes of given node.

"Active nodes" are the ones affecting current look or collisions, e.g. from Switch node only one child will be enumerated. See Traverse for more precise definition.

"Direct" means that this enumerates only direct descendants, i.e. this is not recursive. See methods like Traverse or EnumerateNodes if you want recursive behavior.

This can enumerate both VRML1Children nodes and nodes within TSFNode and TMFNode fields.

Default implementation in this class enumerates all Children nodes of VRML 1.0. If you need to remove some children for VRML 1.0 (e.g. for Switch or LOD nodes) or add some children for VRML 2.0 you have to override this. You do not need to call inherited when overriding this — in fact, you should not, if you want to omit some nodes.

Stops and returns immediately if Func returns non-nil for some child.

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 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 procedure AfterTraverse(StateStack: TX3DGraphTraverseStateStack); override;

This item has no description.

Public function CommonSurfaceShader: TCommonSurfaceShaderNode; deprecated 'use TMaterialNode instead of TCommonSurfaceShaderNode (it has the same functionality and is standardized in X3D v4)';

Warning: this symbol is deprecated: use TMaterialNode instead of TCommonSurfaceShaderNode (it has the same functionality and is standardized in X3D v4)

Find a suitable CommonSurfaceShader to be used when rendering this shape, or Nil.

Public function WasVisible: Boolean;

Whether the shape was (potentially, at least partially) visible in the last rendering event.

Note that the same shape reference may be present multiple times within one scene. Moreover, the same scene may be present multiple times within one viewport. Moreover, multiple viewports may render the same scene. The shape is marked as "was visible" if any instance of it was visible in any viewport in any scene.

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 Texture: TAbstractTextureNode read GetTexture write SetTexture; deprecated 'create and assign texture node instance explicitly, then set Appearance.Texture';

Warning: this symbol is deprecated: create and assign texture node instance explicitly, then set Appearance.Texture

The texture of this shape. This is a shortcut for accessing "texture" field of Appearance, that is TAppearanceNode(FdAppearance.Value).FdTexture.Value, checking whether nodes are set to appropriate types along the way.

When setting this to something non-nil, we make sure to also set Appearance to something non-nil.

Public property TextureTransform: TAbstractTextureTransformNode read GetTextureTransform write SetTextureTransform; deprecated 'create and assign texture transformatiom node instance explicitly, then set Appearance.TextureTransform';

Warning: this symbol is deprecated: create and assign texture transformatiom node instance explicitly, then set Appearance.TextureTransform

Texture transformation of this shape. Similar to Texture, this is just a comfortable property for getting and setting the appropriate Appearance field, checking class types along the way.

Public property Material: TAbstractMaterialNode read GetMaterial write SetMaterial; deprecated 'create and assign TAppearanceNode instance explicitly, then set Appearance.Material';

Warning: this symbol is deprecated: create and assign TAppearanceNode instance explicitly, then set Appearance.Material

Get / set the material of this shape. This is a shortcut to access Appearance and then set Appearance.Material. When setting the material to something non-nil, we make sure to create Appearance node if necessary.

Public property LineProperties: TLinePropertiesNode read GetLineProperties write SetLineProperties; deprecated 'create and assign TLinePropertiesNode instance explicitly, then set Appearance.LineProperties';

Warning: this symbol is deprecated: create and assign TLinePropertiesNode instance explicitly, then set Appearance.LineProperties

Line properties of this shape. This is a clean, type-safe way for accessing Appearance.lineProperties field of this shape.

Public property FdAppearance: TSFNode read FFdAppearance;

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

Public property Appearance: TAppearanceNode read GetAppearance write SetAppearance;

This item has no description.

Public property FdGeometry: TSFNode read FFdGeometry;

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

Public property Geometry: TAbstractGeometryNode read GetGeometry write SetGeometry;

This item has no description.

Public property FdBboxCenter: TSFVec3f read FFdBboxCenter;

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

Public property BBox: TBox3D read GetBBox write SetBBox;

You can provide a manually-calculated bounding box of the shape here, for optimization purposes. Leave this field as empty (TBox3D.Empty) to let the engine calculate best bounding box automatically.

Manually providing the bounding box makes sense if you can do it more efficiently than the engine. E.g. if the shape vertexes are animated, then the engine would have to recalcualate the perfect bounding box every frame. It is more efficient to calculate a bounding box of all possible animation frames, and store it here.

The glTF skinned animation automatically fills this field for the affected shapes.

Note: This property is not useful if you want to know the bounding box of a shape, calculated by the engine. This property only allows to override the automatic engine calculation.

To read the calculated bounding box, load the nodes to TCastleScene. You can then use Scene.BoundingBox, Scene.LocalBoundingBox, Scene.WorldBoundingBox to know bounding box of the scene. To get bounding box of a particular shape, enumerate TCastleSceneCore.Shapes to find the correct shape (using any criteria you want – note that the same TShapeNode may be reused multiple times), and then read TShape.BoundingBox, TShape.LocalBoundingBox.

Public property FdBboxSize: TSFVec3f read FFdBboxSize;

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

Public property FdShading: TSFStringEnum read FFdShading;

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

Public property Shading: TShading read GetShading write SetShading;

How to display given shape.

Public property FdVisible: TSFBool read FFdVisible;

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

Public property Visible: Boolean read GetVisible write SetVisible;

Is the shape visible. Shapes that are not visible are not rendered, but otherwise are still processed (for example, hidden shapes are still used for collision detection). Toggling this is guaranteed to be ultra-fast.

Note: An alternative method to hide (and more) things in X3D is to wrap them in a TSwitchNode, and toggle TSwitchNode.WhichChoice between -1 and 0. When TSwitchNode.WhichChoice is -1, the children are not processed (not rendered, and do not collide).

Public property FdCollision: TSFStringEnum read FFdCollision;

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

Public property Collision: TShapeCollision read GetCollision write SetCollision;

How does the given shape collide. This only matters if TCastleSceneCore.PreciseCollisions is True, otherwise the whole scene (with all shapes) collides as one big bounding box.

Public property Render: Boolean read GetVisible write SetVisible default true; deprecated 'use Visible';

Warning: this symbol is deprecated: use Visible

Deprecated name for Visible.


Generated by PasDoc 0.16.0-snapshot.