Class TAbstractGeometryNode
Unit
Declaration
type TAbstractGeometryNode = class(TAbstractNode)
Description
Base node for a visible geometry in X3D.
Hierarchy
 TObject
 TPersistent
 TX3DFileItem
 TX3DNode
 TAbstractNode
 TAbstractGeometryNode
Overview
Methods
function InternalCoordRangesCounts(out RangeCount: TLongIntList; out SRanges, SRangeName: string; out RangeMinimumCount: Cardinal): boolean; virtual; 

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

destructor Destroy; override; 

function BoundingBox(State: TX3DGraphTraverseState; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; virtual; 

function LocalBoundingBox(State: TX3DGraphTraverseState; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; virtual; 

function VerticesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; virtual; 

function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; virtual; 

function InternalCoord(State: TX3DGraphTraverseState; out ACoord: TMFVec3f): boolean; virtual; 

function InternalCoordinates(State: TX3DGraphTraverseState): TMFVec3f; 

function CoordField: TSFNode; virtual; 

function NormalField: TSFNode; virtual; 

function TangentField: TSFNode; virtual; 

function InternalNormal: TVector3List; 

function InternalTangent: TVector3List; 

function CoordIndexField: TMFLong; virtual; 

procedure InternalMakeCoordRanges( State: TX3DGraphTraverseState; CoordRangeHandler: TCoordRangeHandler); 

procedure InternalCoordPolygons( State: TX3DGraphTraverseState; PolygonHandler: TIndexedPolygonHandler); virtual; 

function InternalTexCoord(State: TX3DGraphTraverseState; out ATexCoord: TX3DNode): boolean; virtual; 

function TexCoordField: TSFNode; virtual; 

function FindTextureMapping(const Mapping: String; const MakeWarning: Boolean = true): TAbstractSingleTextureCoordinateNode; overload; 

function FindTextureMapping(const Mapping: String; out TexCoordIndex: Integer; const MakeWarning: Boolean = true): TAbstractSingleTextureCoordinateNode; overload; 

function Proxy(var State: TX3DGraphTraverseState; const OverTriangulate: boolean): TAbstractGeometryNode; virtual; 

function ProxyUsesOverTriangulate: boolean; virtual; 

function InternalColor: TMFVec3f; 

function InternalColorRGBA: TMFColorRGBA; 

function InternalColorNode: TAbstractColorNode; 

function InternalFogCoord: TMFFloat; virtual; 

function AttribField: TMFNode; virtual; 

function ColorField: TSFNode; virtual; 

function SolidField: TSFBool; virtual; 

function ConvexField: TSFBool; virtual; 

function AutoGenerate3DTexCoords: boolean; virtual; 

function TransformationChange: TNodeTransformationChange; override; 

procedure GetTextureBounds2DST(const LocalBoxSizes: TVector3; out S, T: T3DAxis); 

function Lit(State: TX3DGraphTraverseState): boolean; virtual; 

function FontTextureNode: TAbstractTexture2DNode; virtual; 

constructor CreateWithShape(out Shape: TShapeNode); 

constructor CreateShape(out Shape: TShapeNode); deprecated 'use CreateWithShape'; 

constructor CreateWithTransform(out Shape: TShapeNode; out Transform: TTransformNode); 

constructor CreateTransform(out Shape: TShapeNode; out Transform: TTransformNode); deprecated 'use CreateWithTransform'; 

procedure CreateNode; override; 

class function ClassX3DType: string; override; 
Properties
property Convex: boolean read GetConvex write SetConvex; 

property Solid: boolean read GetSolid write SetSolid; 
Description
Methods
function InternalCoordRangesCounts(out RangeCount: TLongIntList; out SRanges, SRangeName: string; out RangeMinimumCount: Cardinal): boolean; virtual; 

Returns an information how to split InternalCoord array into ranges. When CoordIndex = What precisely is a "range of coordinates" is not specified here. It may be a line stip, or one triangle strip, etc. — depending on the descendant. Returns 
constructor Create(const AX3DName: string = ''; const ABaseUrl: string = ''); override; 

destructor Destroy; override; 

function BoundingBox(State: TX3DGraphTraverseState; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; virtual; 

Calculate bounding box of this geometry node. They require State of this node during VRML traverse state — this is mainly for VRML 1.0 nodes, that depend on such state. LocalBoundingBox gives a bounding box ignoring current transformation (or, equivalently, assuming like Transform = IdentityMatrix). Normal Notes for descendants implementors: The default implementations of these methods in TAbstractGeometryNode try to be smart and cover all common bases, so that you have to do as little work as possible to implement working descendant.

function LocalBoundingBox(State: TX3DGraphTraverseState; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; virtual; 

function VerticesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; virtual; 

Calculate vertex and triangles count of this node. They require State of this node during VRML traverse state — this is mainly for VRML 1.0 nodes, that depend on such state. OverTriangulate has the same meaning as for TShape.Triangulate. Vertices count calculates number of different vertexes in this node. That is, it doesn't eliminate doubles in cases like Coordinate node with multiple points the same. But if some face is known to use twice the same vertex index, then this counts like a single vertex. The idea is that this indicates rendering speed. For triangles count, the returned value may be different then actual if some faces were nonconvex. Things like TriangulateFace may remove degenerate triangles, so actual number of triangles may be slightly less. So don't depend on TrianglesCount as a precise measure — but it's a good fast measure of complexity of given node, how fast it will be rendered, used with collision detection etc. Notes for descendants implementors: For coordinatebased nodes (when InternalCoord returns For other nodes, the default implementation of both 
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean; ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; virtual; 

function InternalCoord(State: TX3DGraphTraverseState; out ACoord: TMFVec3f): boolean; virtual; 

Return node's list of coordinates. Returns In base TAbstractGeometryNode class this always returns Override this for descendants that have some kind of "coord" field, then this should return For VRML 1.0, coord may be taken from State, that's why we have to pass current traverse state here. 
function InternalCoordinates(State: TX3DGraphTraverseState): TMFVec3f; 

Return node's list of coordinates, raising exception if node is not based on coordinates. This is just like the InternalCoord method, except it simply returns the coordinates, not the boolean result. If virtual InternalCoord returns Exceptions raised

function CoordField: TSFNode; virtual; 

Node's "coord" field where you can place TCoordinateNode, or This gives you more possibilities than the InternalCoord and InternalCoordinates methods (as you can assign texCoord using this). However, it doesn't work for old VRML 1.0 (since they have coordinate information, but no "coord" field). 
function NormalField: TSFNode; virtual; 

Node's "normal" field where you can place TNormalNode, or 
function TangentField: TSFNode; virtual; 

Node's "tangent" field where you can place TTangentNode, or 
function InternalNormal: TVector3List; 

Returns normal vectors that are specified explicitly. The vectors are taken from the Normal node inside our FdNormal field. In case of problems (no Normal node specified, invalid node specified etc.) returns 
function InternalTangent: TVector3List; 

Returns tangent vectors that are specified explicitly, see TAbstractComposedGeometryNode.Tangent. Returns 
function CoordIndexField: TMFLong; virtual; 

Node's list of coordinate indexes. In base TAbstractGeometryNode class this always returns Override this for descendants that have some kind of "coordIndex" or "index" field used to index InternalCoord array. 
procedure InternalMakeCoordRanges( State: TX3DGraphTraverseState; CoordRangeHandler: TCoordRangeHandler); 

Splits InternalCoord array into ranges. If CoordIndex is assigned, then a "range of coordinates" is just a range of nonnegative indexes within CoordIndex. Otherwise (when CoordIndex = Call this only for nodes with coordinates, that is only when InternalCoord returns 
procedure InternalCoordPolygons( State: TX3DGraphTraverseState; PolygonHandler: TIndexedPolygonHandler); virtual; 

Splits coordinatebased node into polygons. Indexes in PolygonHandler point to CoordIndex, if assigned, or directly to Coord. The ordering of generated polygons is correct, so what pointed CCW in the node field, will still point CCW according to generated PolygonHandler indexes. In this class this does nothing. Some, but not all, coordinatebased nodes (the ones when InternalCoord returns 
function InternalTexCoord(State: TX3DGraphTraverseState; out ATexCoord: TX3DNode): boolean; virtual; 

Node's texture coordinates. Returns Returns In base TAbstractGeometryNode class this looks at TexCoordField, eventually returns 
function TexCoordField: TSFNode; virtual; 

Node's texCoord field, or This gives you more possibilities than the InternalTexCoord method (as you can assign texCoord using this), however it may be not available in all cases — for example VRML 1.0 nodes do not have texCoord field, but they may have a texture coordinate node (from the state). 
function FindTextureMapping(const Mapping: String; const MakeWarning: Boolean = true): TAbstractSingleTextureCoordinateNode; overload; 

Find a texture coordinate node with given Mapping value. Returns nil (and Index = 1) if not found. This implements X3D 4.0 section "12.2.4 Texture mapping specified in material nodes". If MakeWarning, we make a warning if Mapping is not empty, and yet it doesn't match anything. This is not allowed, according to spec. 
function FindTextureMapping(const Mapping: String; out TexCoordIndex: Integer; const MakeWarning: Boolean = true): TAbstractSingleTextureCoordinateNode; overload; 

function Proxy(var State: TX3DGraphTraverseState; const OverTriangulate: boolean): TAbstractGeometryNode; virtual; 

Converts this node to another node class that may be better supported. Typically, converts some complex geometry node (like Extrusion or Teapot) into more common node like IndexedFaceSet or IndexedTriangleSet. TShape class wraps this method into a more comfortable interface, that is TShape methods simply automatically convert geometry nodes to their proxy versions if needed. In the base TAbstractGeometryNode class, returns The resulting node's Name (if the result is not Some Proxy implementations (especially for VRML 1.0) will have to create new State (TX3DGraphTraverseState) instance along with a new geometry node. You should do this by copying the State into a new TX3DGraphTraverseState instance, and modyfying the State reference. Simply speaking, do #
State := TX3DGraphTraverseState.CreateCopy(State);
#) You should not just modify the fields of the provided State instance. (Reasoning: some proxy methods rely on getting the original State, e.g. with original MaterialBinding, not the transformed state, to work correctly. And some proxy methods need to modify the state differently, depending on OverTriangulate value.) You can modify State variable only when returning nonnil geometry. 
function ProxyUsesOverTriangulate: boolean; virtual; 

Does the Proxy method look at the OverTriangulate parameter at all. Default implementation in TAbstractGeometryNode returns safer 
function InternalColor: TMFVec3f; 

Returns color.point field, assuming that "color" field is set and specifies Color (or ColorRGBA) node. Otherwise returns Note that only one of Color and ColorRGBA may return nonnil, since "color" field may contain only one of them. 
function InternalColorRGBA: TMFColorRGBA; 

function InternalColorNode: TAbstractColorNode; 

function InternalFogCoord: TMFFloat; virtual; 

function AttribField: TMFNode; virtual; 

function ColorField: TSFNode; virtual; 

function SolidField: TSFBool; virtual; 

Is backface culling used. 
function ConvexField: TSFBool; virtual; 

Are faces guaranteed to be convex. 
function AutoGenerate3DTexCoords: boolean; virtual; 

Should renderer automatically generate 3D texture coordinates, in case we will apply 3D texture on this geometry. The generated coordinates will follow the X3D specification at "Texturing3D" component: "Texture coordinate generation for primitive objects". The 3D texture space will be mapped nicely to the shape bounding box. Implementation in this class (TAbstractGeometryNode) returns always 
function TransformationChange: TNodeTransformationChange; override; 

procedure GetTextureBounds2DST(const LocalBoxSizes: TVector3; out S, T: T3DAxis); 

Calculate texture S, T coordinates for BOUNDS2D texture mapping. This mapping is like the default IndexedFaceSet texture mapping, following X3D spec. We also use it for other geometry nodes, and even allow explicitly requesting it by TextureCoordinateGenerator.mode = "BOUNDS2D". 
function Lit(State: TX3DGraphTraverseState): boolean; virtual; 

Is this object lit, disregarding the material. Default implementation in TAbstractGeometryNode says 
function FontTextureNode: TAbstractTexture2DNode; virtual; 

Should renderer setup an extra texture slot with font texture when rendering this node. This is useful for rendering Text nodes, that want to cooperate with normal texturing and shading, and additionally they want to use extra texture determined by font (not by Appearance node). 
constructor CreateWithShape(out Shape: TShapeNode); 

Create an instance of this geometry node, and make it a child of a new shape node (TShapeNode). This way you get a ready shape that can be used inside the X3D scene graph to show this geometry. You usually want to add the resulting Shape node to some scene, e.g. like this: Box := TBoxNode.CreateWithShape(Shape);
Root := TX3DRootNode.Create;
Root.AddChildren(Shape);
Scene := TCastleScene.Create(nil);
Scene.Load(Root, true);
Remember that once the node is a children of another node, then this node will be automatically freed. So you should not free the resulting geometry node. Instead, free the resulting Shape node, or add it to some scene, as shown above. 
constructor CreateShape(out Shape: TShapeNode); deprecated 'use CreateWithShape'; 

Warning: this symbol is deprecated: use CreateWithShape 
constructor CreateWithTransform(out Shape: TShapeNode; out Transform: TTransformNode); 

Create an instance of this geometry node, and make it a child of a new shape node (TShapeNode), and make it a child of a new transform node (TTransformNode). This way you get a ready transformation that can be used inside the X3D scene graph to show and transform this geometry. You usually want to add the resulting Transform node to some scene, e.g. like this: Box := TBoxNode.CreateWithTransform(Shape, Transform);
Root := TX3DRootNode.Create;
Root.AddChildren(Transform);
Scene := TCastleScene.Create(nil);
Scene.Load(Root, true);
Remember that once the node is a children of another node, then this node will be automatically freed. So you should not free the resulting geometry node or Shape node. Instead, free the resulting Transform node, or add it to some scene, as shown above. 
constructor CreateTransform(out Shape: TShapeNode; out Transform: TTransformNode); deprecated 'use CreateWithTransform'; 

Warning: this symbol is deprecated: use CreateWithTransform 
class function ClassX3DType: string; override; 

Properties
property Solid: boolean read GetSolid write SetSolid; 

Is backface culling used. 
Generated by PasDoc 0.16.0.