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
constructor Create(const AParentScene: TX3DEventsEngine); |
|
destructor Destroy; override; |
|
function MaxShapesCount: Integer; |
|
procedure Traverse(const Func: TShapeTraverseFunc; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); |
|
function TraverseList( const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): TShapeList; |
|
function ShapesCount(const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): Cardinal; |
|
function FindGeometryNodeName(const GeometryNodeName: string; OnlyActive: boolean = false): TShape; |
|
function FindShapeWithParentNamed(const ParentNodeName: string; OnlyActive: boolean = false): TShape; |
|
function EnumerateTextures(const Enumerate: TEnumerateShapeTexturesFunction): Pointer; virtual; abstract; |
|
function DebugInfo(const Indent: string = ''): string; virtual; |
|
function DebugInfoWithoutChildren: String; virtual; |
|
procedure AssociateNode(const Node: TX3DNode); |
|
procedure UnAssociateNode(const Node: TX3DNode); |
|
class function AssociatedShape(const Node: TX3DNode; const Index: Integer): TShapeTree; static; |
|
class function AssociatedShapesCount(const Node: TX3DNode): Integer; static; |
|
procedure FastTransformUpdate(var AnythingChanged: Boolean); virtual; |
Properties
property ParentScene: TX3DEventsEngine read FParentScene write FParentScene; |
Description
Methods
constructor Create(const AParentScene: TX3DEventsEngine); |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
function MaxShapesCount: Integer; |
|
Maximum value of ShapesCount. This is cached, so it's usually instant, in contrast to ShapesCount. |
procedure Traverse(const Func: TShapeTraverseFunc; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); |
|
Traverse shapes inside. There are a few alternative ways to do this: - Use this method, and have a callback called for each TShape. - Use TraverseList, and have a list of TShape. - Use TShapeTreeIterator.Create, that has it's own GetNext / Current methods to enumerate. This is no longer advised – using TraverseList is simpler and equally fast. - Use TShapeList.Create(Tree, OnlyActive, OnlyVisible, OnlyCollidable) overload. This is no longer advised – using TraverseList is simpler and faster. |
function TraverseList( const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): TShapeList; |
|
Return TShapeList containing the traversed shapes, just like Traverse. Caller should never free the resulting list, it is owned by this TShapeTree instance. |
function ShapesCount(const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): Cardinal; |
|
How many shapes would be enumerated by Traverse. |
function FindGeometryNodeName(const GeometryNodeName: string; OnlyActive: boolean = false): TShape; |
|
Look for shape with Geometry.X3DName = GeometryNodeName. Returns |
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 |
function EnumerateTextures(const 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 checks all possible ways how a texture may be used by a shape, so it looks at material fields, shaders (ComposedShader, CommonSurfaceShader) and more. If Enumerate callbacks returns non-nil for some texture, returns it immediately, and stops further processing. |
function DebugInfo(const Indent: string = ''): string; virtual; |
|
Describe the shapes tree, recursively (with children), multi-line (ends with newline too). |
function DebugInfoWithoutChildren: String; virtual; |
|
Describe this shape, not recursively. |
procedure AssociateNode(const Node: TX3DNode); |
|
Using the TX3DNode.InternalSceneShape field, you can associate X3D node with a number of TShapeTree instances. This allows to map X3D node -> TShapeTree instances instantly (without e.g. searching the shapes tree for it), which is great to do some operations very quickly. Right now: - TShapeTreeTransform is associated with node implementing TTransformFunctionality (like TTransformNode, TBillboardNode, TX3DRootNode). - TShape is associated with TShapeNode, TAppearanceNode, TAbstractGeometryNode, TCoordinateNode (anything that can be inside TAbstractGeometryNode.CoordField), TNormalNode (anything that can be inside TAbstractGeometryNode.NormalField), TTangentNode (anything that can be inside TAbstractGeometryNode.TangentField), TColorNode, TColorRGBANode (anything that can be inside TAbstractGeometryNode.ColorField), TAbstractMaterialNode (anything that can be in TAppearanceNode.Material), TTextureCoordinateNode and other stuff that can be inside TAbstractGeometryNode.InternalTexCoord, TClipPlaneNode . Note that UnAssociateNode should only be called on nodes with which we are associated. Trying to call UnAssociateNode on a node on which we didn't call It is valid to associate X3D node with TShapeTree multiple times, but it must be unassociated the same number of times. Parameters
|
procedure UnAssociateNode(const Node: TX3DNode); |
|
This item has no description. |
class function AssociatedShape(const Node: TX3DNode; const Index: Integer): TShapeTree; static; |
|
This item has no description. |
class function AssociatedShapesCount(const Node: TX3DNode): Integer; static; |
|
This item has no description. |
procedure FastTransformUpdate(var AnythingChanged: Boolean); virtual; |
|
This item has no description. |
Properties
property ParentScene: TX3DEventsEngine read FParentScene write FParentScene; |
|
Parent TCastleScene instance. This cannot be declared here as TCastleScene or TCastleSceneCore (this would create circular unit dependency), but it always is TCastleScene. May be |
Generated by PasDoc 0.16.0-snapshot.