Class TShapeTree

Unit

Declaration

type TShapeTree = class(TObject)

Description

Tree of shapes.

Although VRML/X3D model already provides the tree (graph of VRML/X3D nodes), it's a little too complicated to be used at each render call. It's especially true for VRML <= 1.0 (where properties may "leak out" from one node to the next), VRML/X3D >= 2.0 cleaned a lot here but still some work must be done when traversing (like accumulating transformations).

So we process VRML/X3D tree to this tree, which is much simpler with all the geometry nodes (TAbstractGeometryNode) along with their state (TX3DGraphTraverseState) as leafs (TShape).

Hierarchy

  • TObject
  • TShapeTree

Overview

Methods

Public constructor Create(AParentScene: TObject);
Public procedure Traverse(Func: TShapeTraverseFunc; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); virtual; abstract;
Public function ShapesCount(const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): Cardinal; virtual; abstract;
Public function FindGeometryNodeName(const GeometryNodeName: string; OnlyActive: boolean = false): TShape;
Public function FindShapeWithParentNamed(const ParentNodeName: string; OnlyActive: boolean = false): TShape;
Public function EnumerateTextures(Enumerate: TEnumerateShapeTexturesFunction): Pointer; virtual; abstract;
Public function DebugInfo(const Indent: string = ''): string; virtual; abstract;

Properties

Public property ParentScene: TObject read FParentScene write FParentScene;

Description

Methods

Public constructor Create(AParentScene: TObject);
 
Public procedure Traverse(Func: TShapeTraverseFunc; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); virtual; abstract;
 
Public function ShapesCount(const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): Cardinal; virtual; abstract;
 
Public function FindGeometryNodeName(const GeometryNodeName: string; OnlyActive: boolean = false): TShape;

Look for shape with Geometry.X3DName = GeometryNodeName. Returns Nil if not found.

Public function FindShapeWithParentNamed(const ParentNodeName: string; OnlyActive: boolean = false): TShape;

Look for shape with Geometry that has a parent named ParentNodeName. Parent is searched by Geometry.TryFindParentNodeByName. Returns Nil if not found.

Public function EnumerateTextures(Enumerate: TEnumerateShapeTexturesFunction): Pointer; virtual; abstract;

Enumerate all single texture nodes (possibly) used by the shapes. This looks into all shapes (not only active, so e.g. it looks into all Switch/LOD children, not only the chosen one).

This looks into the

  • Appearance.texture field (and if it's MultiTexture, looks into it's children)

  • Into shaders textures (GLSL shaders, CommonSurfaceShader...).

  • For VRML 1.0, it also looks into VRML1State.Texture2.

If Enumerate callbacks returns non-nil for some texture, returns it immediately, and stops further processing.

Public function DebugInfo(const Indent: string = ''): string; virtual; abstract;
 

Properties

Public property ParentScene: TObject read FParentScene write FParentScene;

Parent TCastleSceneCore instance. This cannot be declared here as TCastleSceneCore (this would create circular unit dependency), but it always is TCastleSceneCore.


Generated by PasDoc 0.15.0.