Unit X3DNodes

Description

Nodes and other important bulding blocks of VRML/X3D (prototypes, routes and so on).

This is the central unit for VRML/X3D processing, as VRML/X3D file is basically just a graph of nodes. We represent whole VRML/X3D file by it's root node. This is what we load, save and process in this unit.

The chapter "Reading, writing, processing VRML scene graph" in the documentation on [http://castle-engine.sourceforge.net/vrml_engine_doc/output/xsl/html/chapter.scene_graph.html] is almost completely devoted to documenting the design of this single unit.

Various uses of this unit:

  • Nodes can be loaded or saved from the stream in a classic or XML encoding. For classic encoding we use a lexer in CastleInternalX3DLexer unit. For XML encoding, we use standard FPC DOM unit. Loading and saving of fields (in both encodings) is inside X3DFields unit.

    When reading VRML/X3D files, we generally do not change the VRML/X3D graph. So we're able to save exactly the same VRML/X3D graph back to another file. See also [http://castle-engine.sourceforge.net/vrml_engine_doc/output/xsl/html/section.writing_vrml.html#section.vrml_preserving]. This allows writing various VRML/X3D processing tools, that can simply read the file, change whatever they want, and write the file back — knowing that the "untouched" parts of graph are preserved perfectly.

  • TX3DNode class offers a lot of methods to process VRML/X3D graph. See TX3DNode.Traverse, TX3DNode.EnumerateNodes and TX3DNode.FindNode. TX3DNode.Traverse is especially important, as it walks through VRML/X3D graph just as the specification says (accumulating transformation, visiting only active children of nodes like Switch or LOD), gathering some state (useful especially for VRML 1.0, but also used for various things in later VRML/X3D versions).

    When you want to render VRML/X3D graph, you can just traverse the graph and render each geometry node (TAbstractGeometryNode instance) knowing it's state (that will contain transformation and such). Alternatively, simple renderer can also use TAbstractGeometryNode.Triangulate.

  • TAbstractGeometryNode is an important descendant of TX3DNode, as it defines stuff actually visible in the 3D world. It has useful routines for calculating bounding volumes, triangulating and such.

    But note that usually it's more comfortable to load your scene to TCastleScene or TCastleSceneCore and then query the shapes list in TCastleSceneCore.Shapes — this is usually more comfortable, also TCastleSceneCore and TShape cache some results for speed.

  • This unit doesn't depend on OpenGL, or any other particular rendering method. So it's suitable also for CastleRayTracer, and every other possible renderer that will ever get implemented.

  • Your own units can define new VRML/X3D nodes, by declaring new classes descending from TX3DNode (or other, more specialized, descendant). You should register your new classes by calling NodesManager.RegisterNodeClasses.

    Examples of defining your own VRML/X3D node types (without modifying sources of this unit, or any other unit) are for example in the X3DBezierCurve unit in bezier_curves demo, and LevelUnit in malfunction.

Node class names, and inheritance:

  • Normal VRML/X3D nodes are defined by classses named like TXxxNode. These nodes can be specified inside the VRML/X3D files. See VRML/X3D specifications, and also our extensions specification, on [http://castle-engine.sourceforge.net/vrml_x3d.php].

    There are also abstract node classes. Their definitions are helpful for handling some functionality common to many descendants, and to declare allowed children in SFNode/MFNode fields. Abstract node classes are named like TAbstractXxxNode. Some of the abstract nodes are also defined by X3D specification, and some of them are just our own inventions.

    Finally, there are some special-purpose node classes that play important role in our VRML/X3D organization. They are not abstract, but also their exact instances are not created under normal circumstances. These are named like TX3DXxxNode, currently these are only: TX3DNode, TX3DRootNode, TX3DUnknownNode, TX3DPrototypeNode.

    All node classes descend from the base TX3DNode class.

    Some abstract nodes have also Pascal interfaces, like IAbstractXxxNode. Some ideas of X3D specification (although not many) need multiple inheritance, so interfaces have to be used. They all descend from IX3DNode.

  • Optional suffix _1 or _2 at the node class name indicates that this is only for a specific VRML/X3D standard version. Suffix _1 indicates nodes specific to VRML 1.0. Suffix _2 indicates nodes specific to VRML 2.0 (aka 97), that are not available in X3D. Latest X3D nodes do not have any suffix (to not clutter the source code that simply wants to use the latest and best version of the standard).

    For example, we have TIndexedFaceSetNode_1 for VRML 1.0 and TIndexedFaceSetNode for VRML 2.0 and X3D.

VRML/X3D versions handling:

  • We handle VRML 1.0, VRML 2.0 (aka VRML 97) and X3D (aka VRML 3.x).

    Every correct VRML / X3D file in classic and XML encoding should be parsed by this unit. See [http://castle-engine.sourceforge.net/x3d_implementation_status.php] for much more detailed information about supported features.

  • Also many Inventor 1.0 files are correctly parsed. We handle Inventor 1.0 mostly like VRML 1.0, also some small things and nodes specific for Inventor 1.0 are implemented here, see [http://castle-engine.sourceforge.net/x3d_extensions.php#ext_iv_in_vrml].

  • Note that structures in this unit are not focused on either VRML 1.0 or VRML >= 2.0. On the contrary: we try to handle the sum of all VRML and X3D. When reading VRML 1.0, many VRML 2.0 constructs (that do not conflict with anything in VRML 1.0) are allowed, and the other way around too.

    Internally, we do not convert VRML 1.0-specific constructs to VRML 2.0/X3D constructs (or the other way around). See [http://castle-engine.sourceforge.net/vrml_engine_doc/output/xsl/html/section.vrml_1_2_sum.html] for more in-depth explanation of how, and why, we handle both old-style (Inventor, VRML 1.0) and new-style (VRML 2.0, X3D) syntax.

Files organization: X3D nodes are inside x3d_COMPONET_NAME.inc files. This way X3D specification components provide a natural way to group the vast number of nodes into files. Some remaining nodes that are not part of X3D are in other x3dnodes_xxx.inc files, for example x3dnodes_1.inc contains only VRML 1.0-specific nodes.

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Record TTraverseStateLastNodes Nodes that will be saved inside TX3DGraphTraverseState.LastNodes.
Object TLightInstance Light source instance in the scene.
Class TLightInstancesList  
Record TClipPlane Clipping plane, along with a transformation.
Class TClipPlaneList  
Class TX3DGraphTraverseState Current state (transformation and such) when traversing VRML/X3D graph.
Class TX3DGraphTraverseStateStack Stack of TX3DGraphTraverseState.
Record TTraversingInfo  
Class TNodeDestructionNotificationList  
Class TX3DNodesCache Cache for resources not specific to renderer (OpenGL).
Class TX3DNodeDeepCopyState Private stuff for TX3DNode.DeepCopy and friends implementation.
Interface IX3DNode X3D node interface.
Class TX3DNode X3D node.
Class TX3DNodeList  
Class TSFTextureUpdate Update field for rendered textures (like TGeneratedCubeMapTextureNode).
Class TGeneratedTextureHandler Common interface for all VRML/X3D generated texture nodes.
Class TX3DNodeClassesList  
Class TSFNode VRML/X3D field holding a reference to a single node.
Class TSFNodeEventHelper  
Class TMFNode VRML/X3D field holding a list of nodes.
Interface IAbstractNode Interface for a base X3D node that can have some metadata.
Class TAbstractNode Base X3D node that can have some metadata.
Interface IAbstractChildNode Interface for an abstract node type that indicates that the node may be used as a child of a grouping node, e.g.
Class TAbstractChildNode Abstract node type that indicates that the node may be used as a child of a grouping node, e.g.
Class TAbstractBindableNode Abstract base type for all bindable children nodes.
Class TAbstractInfoNode Base class for all nodes that contain only information without visual semantics.
Interface IAbstractMetadataObject Basis for all metadata nodes.
Interface IAbstractSensorNode Base interface type for all sensors.
Class TAbstractSensorNode Base abstract class for all sensors.
Class TMetadataBooleanNode A metadata (extra, custom information at a node) with a boolean type.
Class TMetadataDoubleNode A metadata (extra, custom information at a node) with a double-precision floating point number type.
Class TMetadataFloatNode A metadata (extra, custom information at a node) with a single-precision floating point number type.
Class TMetadataIntegerNode A metadata (extra, custom information at a node) with an integer type.
Class TMetadataSetNode A metadata (extra, custom information at a node) set, to reference of collection of other metadata nodes.
Class TMetadataStringNode A metadata (extra, custom information at a node) with a string type.
Class TWorldInfoNode Information about the world.
Interface IAbstractTimeDependentNode Interface from which all time-dependent nodes are derived.
Class TInternalTimeDependentHandler Common helper for all X3DTimeDependentNode descendants.
Class TSFTimeIgnoreWhenActive Time field, that ignores it's input event when parent time-dependent node is active.
Class TSFStopTime Time field, that ignores it's input event when parent time-dependent node is active and setting to value <= startTime.
Class TAbstractTimeDependentNode Abstract node from which most (but not all) time-dependent nodes are derived.
Class TTimeSensorNode Generate events as time passes.
Class TAbstractGroupingNode Base node that may contain children nodes.
Interface IAbstractBoundedObject Basis for all node types that have bounds specified as part of the definition.
Class TAbstractX3DGroupingNode Base node that contains children nodes, in X3D and VRML 2.0.
Class TGroupNode Contains children nodes without introducing a new transformation.
Class TX3DRootNode A top-level VRML/X3D node.
Class TStaticGroupNode Children nodes which cannot be modified.
Class TSwitchNode Choose only one (or none) of the child nodes for processing.
Interface ITransformNode Interface for all VRML 2.0 / X3D transformation nodes.
Class TTransformNode Grouping node that transforms (moves, rotates, scales) it's children.
Class TAbstractNetworkSensorNode Basis for all sensors that generate events based on network activity.
Interface IAbstractUrlObject Abstract interface used by all nodes that contain data located on the World Wide Web.
Class TAnchorNode Load the URL when the user activates (clicks) some geometry contained within the Anchor node's children.
Class TInlineNode Embed another X3D scene into the current scene.
Class TInlineLoadControlNode Embed another X3D scene into the current scene, with explicit "load" control (VRML 97 version).
Class TLoadSensorNode Monitors the progress and success of downloading URL elements over a network.
Class ENotCoordinateBasedNode  
Class TAbstractGeometryNode Geometry nodes are the only nodes that produce something visible.
Class TAbstractGeometricPropertyNode Base node type for all geometric property node types.
Class TAbstractX3DGeometryNode Base node for a visible geometry in X3D.
Class TAbstractColorNode Base node for color specifications.
Class TAbstractComposedGeometryNode Base node type for all composed 3D geometry.
Class TAbstractCoordinateNode Base node type for all coordinate node types.
Class TAbstractNormalNode Base node type for all normal node types.
Class TClipPlaneNode Clip the geometry with a plane.
Class TColorNode Set of RGB colours.
Class TColorRGBANode Set of RGBA colours.
Class TCoordinateNode Set of 3D coordinates to be used in the Coord field of vertex-based geometry nodes.
Class TIndexedLineSetNode Geometry formed by constructing polylines from 3D vertices.
Class TIndexedTriangleFanSetNode Triangles that form a fan shape around the first vertex.
Class TIndexedTriangleSetNode A collection of triangles.
Class TIndexedTriangleStripSetNode Strips of triangles.
Class TLineSetNode Lines.
Class TNormalNode Normal (information for lighting) node.
Class TPointSetNode Points.
Class TTriangleFanSetNode Triangles that form a fan shape around the first vertex.
Class TTriangleSetNode A collection of triangles.
Class TTriangleStripSetNode Strips of triangles.
Class TAbstractAppearanceChildNode Base node type for the child nodes of TAbstractAppearanceNode.
Class TAbstractAppearanceNode Base node type for all Appearance nodes.
Class TAbstractMaterialNode Base node type for all Material nodes.
Class TAbstractShapeNode Base node type for all Shape nodes.
Class TMFNodeShaders  
Class TAppearanceNode Visual properties of geometry.
Class TFillPropertiesNode Additional visual properties to be applied to all polygonal areas.
Class TLinePropertiesNode Additional visible properties to be applied to all line geometry.
Class TMaterialNode Surface material properties for associated geometry nodes, used by the lighting equations during rendering.
Class TX3DMaterialInfoAbstract Material information, usable for all VRML/X3D versions.
Class TX3DMaterialInfo  
Class TShapeNode Shape is a rendered object in the world, with an appearance and geometry.
Class TTwoSidedMaterialNode Material properties that can effect both the front and back side of a polygon individually.
Class TBoxNode Rectangular box.
Class TConeNode Cone.
Class TCylinderNode Cylinder.
Class TElevationGridNode Uniform rectangular grid of varying height above the Y=0 plane, aka "height map".
Class TExtrusionNode 2D cross-section shape extruded along a 3D spine.
Class TIndexedFaceSetNode Mesh with faces (polygons) constructed from vertices.
Class TSphereNode Sphere.
Class TArc2DNode Circular arc in 2D.
Class TArcClose2DNode Closed circular arc in 2D.
Class TCircle2DNode Circle in 2D.
Class TDisk2DNode Disc (filled circle) in 2D.
Class TPolyline2DNode Series of contiguous line segments in 2D.
Class TPolypoint2DNode Set of vertices in 2D.
Class TRectangle2DNode Rectangle in 2D.
Class TTriangleSet2DNode Set of triangles in 2D.
Class TAbstractFontStyleNode Base node type for all font style nodes.
Class TFontStyleNode Defines the size, family, style and other properties used for TTextNode.
Class TTextNode Multiline text, visualized as a set of flat and textured polygons.
Class TAbstractSoundNode Base for all sound nodes.
Interface IAbstractSoundSourceNode Interface for all nodes that can emit audio data.
Class TAbstractSoundSourceNode Base class for (most) nodes that can emit audio data.
Class TAudioClipNode Buffer for sound data, which can be played by the TSoundNode.
Class TSoundNode 3D sound emitter.
Class TAbstractLightNode Base class for all VRML / X3D light nodes.
Class TAbstractDirectionalLightNode Base class for all directional lights.
Class TAbstractPositionalLightNode Base class for all positional lights.
Class TAbstractPointLightNode Point light source, that shines from a given point in all directions around, for all VRML and X3D versions.
Class TDirectionalLightNode Light source that shines along a given direction, like a sun.
Class TPointLightNode Point light source, that shines from a given point in all directions around, for X3D.
Class TSpotLightNode Light source that emits light from a specific point along a specific direction constrained within a cone.
Class TAbstractTextureCoordinateNode Base for all nodes which specify texture coordinates.
Class TAbstractTextureNode Base for all nodes which specify sources for texture images.
Class TAbstractTexture2DNode VRML/X3D texture that is 2D and can be loaded (from file or some other stream).
Class TAbstractX3DTexture2DNode X3D texture that is 2D and can be loaded (from file or some other stream).
Class TAbstractTextureTransformNode Base for all nodes which specify a transformation of texture coordinates.
Class TImageTextureNode Texture image loaded from a file.
Class TMovieTextureNode Movie file, that can be played and displayed as a texture.
Class TMultiTextureNode Application of several individual textures on top of each other, used instead of a single texture when desired.
Class TMultiTextureCoordinateNode Multiple texture coordinates per vertex, to be used with multi-texturing by TMultiTextureNode.
Class TMultiTextureTransformNode Multiple texture transforms, to be used with multi-texturing by TMultiTextureNode.
Class TPixelTextureNode Texture specified as an explicit array of pixel values (see FdImage field).
Class TTextureCoordinateNode 2D texture coordinates used by vertex-based geometry nodes.
Class TTextureCoordinateGeneratorNode Automatic generation of texture coordinates.
Class TTextureCoordGenNode Old BS Contact name for TextureCoordinateGenerator.
Class TTexturePropertiesNode Adjust the texture application properties.
Class TTextureTransformNode 2D transformation that can be applied to texture coordinates (e.g.
Class TAbstractInterpolatorNode Basis for all nodes interpolating (animating) values.
Class TColorInterpolatorNode Interpolate (animate) a single color.
Class TColorSetInterpolatorNode Interpolate (animate) a set of colors, for example to animate a set of TBackgroundNode or TColorNode colors.
Class TCoordinateInterpolatorNode Interpolate (animate) a set of 3D positions, for example to animate coordinates of a mesh.
Class TCoordinateInterpolator2DNode Interpolate (animate) a set of 2D positions, for example to animate 2D texture coordinates.
Class TEaseInEaseOutNode Support controlled gradual transitions by modifying TimeSensor node fractions.
Class TNormalInterpolatorNode Interpolate (animate) a set of 3D directions, for example normal vectors.
Class TOrientationInterpolatorNode Interpolate (animate) an orientation, for example to animate TTransformNode.Rotation.
Class TPositionInterpolatorNode Interpolate (animate) a 3D position, for example to animate TTransformNode.Translation.
Class TPositionInterpolator2DNode Interpolate (animate) a 2D position.
Class TScalarInterpolatorNode Interpolate (animate) a single floating-point value, for example to animate TMaterialNode.Transparency.
Class TSplinePositionInterpolatorNode Non-linearly interpolate (animate) a 3D position.
Class TSplinePositionInterpolator2DNode Non-linearly interpolate (animate) a 2D position.
Class TSplineScalarInterpolatorNode Non-linearly interpolate (animate) a single floating-point value.
Class TSquadOrientationInterpolatorNode Non-linearly interpolate (animate) a rotation.
Class TVectorInterpolatorNode Interpolate (animate) a set of floats, for example to animate TElevationGridNode heights.
Class TCubicBezier2DOrientationInterpolatorNode Interpolate (animate) a set of 2D positions, using cubic Bezier curve instead of linear interpolation.
Class TCubicBezierPositionInterpolatorNode Interpolate (animate) a set of 3D positions, using cubic Bezier curve instead of linear interpolation.
Class TPointingDeviceSensorList List of pointing device sensors.
Class TAbstractPointingDeviceSensorNode Base type for all pointing device sensors.
Class TAbstractDragSensorNode Base type for all drag-style pointing device sensors.
Class TAbstractTouchSensorNode Base type for all touch-style pointing device sensors.
Class TCylinderSensorNode Pointing device sensor to rotate objects around a constrained axis.
Class TPlaneSensorNode Pointing device sensor to move objects on a plane.
Class TSphereSensorNode Pointing device sensor to rotate objects.
Class TTouchSensorNode Sensor to catch clicks on 3D objects.
Class TAbstractKeyDeviceSensorNode Base type for all sensor node types that operate using key devices.
Class TKeySensorNode Generate events when user key presses or releases keys on the keyboard.
Class TStringSensorNode Generates events as the user inputs a longer string on the keyboard, useful for example to simulate "input fields" in 3D.
Class TAbstractEnvironmentalSensorNode Base type for all the environmental sensor nodes.
Class TProximitySensorNode Generate events when the viewer enters, exits, and/or moves within a region of 3D space.
Class TTransformSensorNode Generates events when the target object enters, exits, and moves within a region of 3D space.
Class TVisibilitySensorNode Detects visibility changes of a rectangular box as the user navigates the world.
Class TAbstractViewpointNode Common ancestor for both VRML 1.0 camera nodes and VRML/X3D >= 2.0 viewpoint nodes.
Class TAbstractX3DViewpointNode Base type for viewpoints in X3D, which are locations from which the user may view the scene.
Class TBillboardNode Grouping node that transforms the coordinate system of its children so that they always turn towards the viewer.
Class TCollisionNode Grouping node that specifies the collision detection properties for its children.
Class TAbstractLODNode Provides various levels of detail for a given object, only one of which will be visible at a given time.
Class TLODNode_2 Provides various levels of detail for a given object, only one of which will be visible at a given time, for VRML 2.0.
Class TLODNode Provides various levels of detail for a given object, only one of which will be visible at a given time, for X3D.
Class TNavigationInfoNode Describe the physical characteristics of the viewer's avatar and navigation.
Class TOrthoViewpointNode Viewpoint that provides an orthographic view of the scene.
Class TViewpointNode Viewpoint that provides a perspective view of the scene.
Class TViewpointGroupNode Group of viewpoints.
Class TAbstractBackgroundNode Abstract type from which all backgrounds inherit.
Interface IAbstractFogObject Interface that describes a node that influences the look by blending with fog.
Class TBackgroundNode 3D background of a scene, comprised of sky and ground colors (gradients) and optional six textures (skybox).
Class TFogNode Simulate atmospheric fog effects (for the whole scene) by blending with the fog colour, based on the distance from the viewer.
Class TFogCoordinateNode Provide explicit fog depths on a per-vertex basis.
Class TLocalFogNode Simulate atmospheric fog effects (for a part of the scene) by blending with the fog colour, based on the distance from the viewer.
Class TTextureBackgroundNode 3D background of a scene, comprised of sky and ground colors (gradients) and optional six textures (skybox), with flexible texture nodes.
Class TGeoCoordinateNode  
Class TGeoElevationGridNode Elevation grid expressed in geo-centric coordinates.
Class TGeoLocationNode  
Class TGeoLODNode  
Class TGeoMetadataNode  
Class TGeoOriginNode Automatically generated node properties.
Class TGeoPositionInterpolatorNode  
Class TGeoProximitySensorNode Automatically generated node properties.
Class TGeoTouchSensorNode  
Class TGeoTransformNode Automatically generated node properties.
Class TGeoViewpointNode  
Class THAnimDisplacerNode Alter the shape of coordinate-based geometry within parent H-Anim nodes.
Object TVertexJoints  
Class THAnimHumanoidNode Central node for moving the animated humanoid.
Class THAnimJointNode Joint of an animated humanoid.
Class THAnimSegmentNode Visible segment of an animated humanoid, always a child of a TJointNode.
Class THAnimSiteNode An attachment point of an animated humanoid, to attach something that held, worm or such by a humanoid.
Class TAbstractNurbsControlCurveNode Base type for nodes that provide control curve information in 2D space.
Class TAbstractParametricGeometryNode Base type for all geometry node types that are created parametrically and use control points to describe the final shape of the surface.
Class TAbstractNurbsSurfaceGeometryNode Abstract geometry type for all types of NURBS surfaces.
Class TContour2DNode Groups a set of curve segments for a composite contour, for X3D.
Class TContourPolyline2DNode Piecewise linear curve segment as a part of a trimming contour in the u, v domain of a surface.
Class TCoordinateDoubleNode 3D coordinates defines using double precision floating point values.
Class TNurbsCurveNode Visible NURBS curve in 3D.
Class TNurbsCurve2DNode Trimming segment that is expressed a NURBS curve and is part of a trimming contour in the u,v domain of the surface.
Class TNurbsOrientationInterpolatorNode Interpolate (animate) orientations as tangent vectors of the 3D NURBS curve.
Class TNurbsPatchSurfaceNode Visible NURBS 3D surface.
Class TNurbsPositionInterpolatorNode Interpolate (animate) positions along the 3D NURBS curve.
Class TNurbsSetNode Groups a set of NURBS surface nodes to a common group for rendering purposes, to ensure a common tesselation within the group.
Class TNurbsSurfaceInterpolatorNode Interpolate (animate) by sampling a position and normal at 3D NURBS surface from an input 2D surface parameters.
Class TNurbsSweptSurfaceNode Path in 2D space (that can be constructed from NURBS curves, or straight segments) extruded along a 3D NURBS curve.
Class TNurbsSwungSurfaceNode Path in 2D space (that can be constructed from NURBS curves, or straight segments) extruded along a 2D NURBS curve.
Class TNurbsTextureCoordinateNode NURBS surface existing in the parametric domain of its surface host specifying the mapping of the texture onto the surface.
Class TNurbsTrimmedSurfaceNode Visible 3D NURBS surface (like a TNurbsPatchSurfaceNode) that is trimmed by a set of trimming loops.
Class TDISEntityManagerNode  
Class TDISEntityTypeMappingNode  
Class TEspduTransformNode  
Class TReceiverPduNode  
Class TSignalPduNode  
Class TTransmitterPduNode  
Class TAbstractScriptNode Abstract node type for all scripting nodes.
Class TScriptNode Program behaviour in a scene using scripts.
Class TAbstractSequencerNode Base node type from which all sequencers (like TIntegerSequencerNode and TBooleanSequencerNode) are derived.
Class TAbstractTriggerNode Base type from which all trigger nodes are derived.
Class TBooleanFilterNode Filters boolean events, allowing for selective routing of TRUE or FALSE values and negation.
Class TBooleanSequencerNode Generate sequential boolean events.
Class TBooleanToggleNode Stores a boolean value for toggling on/off.
Class TBooleanTriggerNode Trigger node that generates Boolean events upon receiving time events.
Class TIntegerSequencerNode Generate sequential integer events.
Class TIntegerTriggerNode Generate an integer upon receiving any boolean value.
Class TTimeTriggerNode Generate time events upon receiving any boolean value.
Class TAbstractShaderNode Base type for all node types that specify a programmable shader.
Class TAbstractVertexAttributeNode Base type for all node types that specify per-vertex attribute information to the shader.
Interface IAbstractProgrammableShaderObject Interface for all nodes that specify arbitrary fields for interfacing with per-object attribute values in shaders.
Class TComposedShaderNode OpenGL Shading Language (GLSL) shader container, which should be composed from multiple TShaderPartNode instances.
Class TFloatVertexAttributeNode Per-vertex single-precision floating point attributes, available to shaders.
Class TMatrix3VertexAttributeNode Per-vertex 3x3 matrix attributes, available to shaders.
Class TMatrix4VertexAttributeNode Per-vertex 4x4 matrix attributes, available to shaders.
Class TPackagedShaderNode Single file that may contain a number of shaders and combined effects.
Class TProgramShaderNode Shader that can consist of one or more individually programmable, self-contained pieces in TShaderProgramNode, like a Microsoft HLSL shader.
Class TShaderPartNode OpenGL Shading Language (GLSL) shader part, used inside TComposedShaderNode.
Class TShaderProgramNode Self-container shader part used with TProgramShaderNode, for example with Microsoft HLSL shader language.
Interface IAbstractX3DProductStructureChildNode Interface for nodes that are valid product structure children.
Class TAbstractProductStructureChildNode Abstract class for (most) nodes that are valid product structure children.
Class TCADAssemblyNode Holds a set of assemblies or parts grouped together.
Class TCADFaceNode Holds the geometry representing a face of a part.
Class TCADLayerNode Hierarchy of nodes used for showing layer structure for the CAD model.
Class TCADPartNode Represents the location and faces that constitute a part in the CAD model.
Class TIndexedQuadSetNode Quads.
Class TQuadSetNode Quads, not indexed.
Class TAbstractTexture3DNode Base type for all node types that specify 3D sources for texture images.
Class TComposedTexture3DNode 3D texture defined as a collection of 2D texture sources at various depths.
Class TImageTexture3DNode 3D texture loaded from a single file like DDS.
Class TPixelTexture3DNode 3D texture defined as an explicit array of pixel values inside the X3D file.
Class TTextureCoordinate3DNode 3D texture coordinates, partcularly useful with 3D textures.
Class TTextureCoordinate4DNode 4D (homogeneous 3D) texture coordinates, partcularly useful with 3D textures.
Class TTextureTransformMatrix3DNode Transformation of texture coordinates by a 4x4 matrix, particularly useful with 3D textures.
Class TTextureTransform3DNode Transformation of texture coordinates in 3D, partcularly useful with 3D textures.
Class TAbstractEnvironmentTextureNode Base type for cubic environment map textures.
Class TComposedCubeMapTextureNode Cube environment map texture defined as a six individual 2D texture nodes.
Class TGeneratedCubeMapTextureNode Cube environment map texture generated by rendering the 3D world, useful for real-time mirrors.
Class TImageCubeMapTextureNode Cube environment map texture loaded from a single file, like DDS.
Class TAbstractLayerNode  
Class TAbstractViewportNode  
Class TLayerNode Automatically generated node properties.
Class TLayerSetNode Automatically generated node properties.
Class TViewportNode  
Class TAbstractLayoutNode  
Class TLayoutNode Automatically generated node properties.
Class TLayoutGroupNode Automatically generated node properties.
Class TLayoutLayerNode Automatically generated node properties.
Class TScreenFontStyleNode Automatically generated node properties.
Class TScreenGroupNode  
Class TAbstractNBodyCollidableNode  
Class TAbstractNBodyCollisionSpaceNode  
Class TAbstractRigidJointNode  
Class TBallJointNode Automatically generated node properties.
Class TCollidableOffsetNode  
Class TCollidableShapeNode Automatically generated node properties.
Class TCollisionCollectionNode Automatically generated node properties.
Class TCollisionSensorNode  
Class TCollisionSpaceNode Automatically generated node properties.
Class TContactNode  
Class TDoubleAxisHingeJointNode  
Class TMotorJointNode  
Class TRigidBodyNode  
Class TRigidBodyCollectionNode  
Class TSingleAxisHingeJointNode  
Class TSliderJointNode  
Class TUniversalJointNode  
Interface IAbstractPickableObject  
Class TAbstractPickSensorNode Automatically generated node properties.
Class TLinePickSensorNode Automatically generated node properties.
Class TPickableGroupNode Automatically generated node properties.
Class TPointPickSensorNode  
Class TPrimitivePickSensorNode Automatically generated node properties.
Class TVolumePickSensorNode Automatically generated node properties.
Class TAbstractFollowerNode  
Class TAbstractDamperNode Automatically generated node properties.
Class TAbstractChaserNode  
Class TColorDamperNode  
Class TCoordinateDamperNode  
Class TOrientationChaserNode Automatically generated node properties.
Class TOrientationDamperNode  
Class TPositionChaserNode  
Class TPositionChaser2DNode  
Class TPositionDamperNode  
Class TPositionDamper2DNode  
Class TScalarChaserNode  
Class TTexCoordDamper2DNode  
Class TAbstractParticleEmitterNode  
Class TAbstractParticlePhysicsModelNode  
Class TBoundedPhysicsModelNode  
Class TConeEmitterNode Automatically generated node properties.
Class TExplosionEmitterNode  
Class TForcePhysicsModelNode  
Class TParticleSystemNode  
Class TPointEmitterNode  
Class TPolylineEmitterNode  
Class TSurfaceEmitterNode  
Class TVolumeEmitterNode Automatically generated node properties.
Class TWindPhysicsModelNode  
Class TAbstractGeometryNode_1 Geometry node allowed only in VRML <= 1.0.
Class TAsciiTextNode_1  
Class TConeNode_1  
Class TCubeNode_1  
Class TCylinderNode_1  
Class TAbstractIndexedNode_1 Common base class for VRML 1.0 indexed nodes (IndexedFaceSet, IndexedTriangleMesh, IndexedLineSet).
Class TIndexedFacesOrTrianglesNode_1 Common base class for VRML 1.0 indexed polygon nodes (IndexedFaceSet and IndexedTriangleMesh).
Class TIndexedFaceSetNode_1  
Class TIndexedLineSetNode_1  
Class TPointSetNode_1  
Class TSphereNode_1  
Class TCoordinate3Node_1  
Class TFontStyleNode_1  
Class TInfoNode_1  
Class TLODNode_1  
Class TMaterialNode_1  
Class TX3DMaterialInfo_1  
Class TMaterialBindingNode_1  
Class TNormalBindingNode_1  
Class TTexture2Node_1  
Class TTexture2TransformNode_1  
Class TTextureCoordinate2Node_1  
Class TShapeHintsNode_1  
Class TAbstractTransformationNode_1 Common base class for all nodes that modify the modelview matrix.
Class TMatrixTransformNode_1 VRML 1.0 MatrixTransform node.
Class TRotationNode_1  
Class TScaleNode_1  
Class TTransformNode_1  
Class TTranslationNode_1  
Class TAbstractCameraNode_1 Common base class for all cameras in VRML 1.0.
Class TOrthographicCameraNode_1  
Class TPerspectiveCameraNode_1  
Class TDirectionalLightNode_1  
Class TPointLightNode_1  
Class TSpotLightNode_1  
Class TGroupNode_1  
Class TAbstractSeparatorNode_1 Base class for VRML 1.0 nodes that push / pop all attributes and matrices.
Class TSeparatorNode_1  
Class TSwitchNode_1  
Class TTransformSeparatorNode_1  
Class TWWWAnchorNode_1  
Class TWWWInlineNode_1 VRML 1.0 WWWInline node.
Class TIndexedTriangleMeshNode_1 IndexedTriangleMesh (from Inventor 1.0).
Class TRotationXYZNode RotationXYZ node (from Inventor).
Class TDisplacerNode  
Class THumanoidNode  
Class TJointNode  
Class TSegmentNode  
Class TSiteNode  
Class TCoordinateDeformerNode Free form deformation on a set of 3D coordinates by using a NURBS volume.
Class TNurbsCurveNode_2 Visible NURBS curve in 3D, in VRML 2.0.
Class TNurbsGroupNode Groups a set of NURBS surface nodes to a common group for rendering purposes, to ensure a common tesselation within the group, for VRML 2.0.
Class TNurbsPositionInterpolatorNode_2 Interpolate (animate) positions along the 3D NURBS curve.
Class TNurbsSurfaceNode Visible NURBS 3D surface, for VRML 2.0.
Class TNurbsTextureSurfaceNode NURBS surface existing in the parametric domain of its surface host specifying the mapping of the texture onto the surface, for VRML 2.0.
Class TTrimmedSurfaceNode NURBS surface that is trimmed by a set of trimming loops.
Class TContour2DNode_2 2D curve composed from NURBS curves and straight segments, for VRML 2.0.
Class TKambiHeadLightNode Headlight configuration, allows to customize headlight look and shape.
Class TText3DNode Text with 3D depth.
Class TBlendModeNode Customize blending (partial transparency) mode.
Class TKambiAppearanceNode Appearance node with a special name KambiAppearance.
Class TKambiInlineNode Embed a scene from another file, and replace some of it's nodes.
Class TKambiNavigationInfoNode Navigation information with some Castle Game Engine extensions.
Class TKambiOctreePropertiesNode  
Class TGeneratedShadowMapNode Generate texture by rendering a depth (shadow) map.
Class TProjectedTextureCoordinateNode Generate texture coordinates by projection.
Class TScreenEffectNode Screen-space shader effect.
Class TMultiGeneratedTextureCoordinateNode Generated texture coordinates for multi-texturing.
Class TEffectNode Shader effect, that can be composed with other effect or standard rendering.
Class TEffectPartNode Part of a shader effect, used with TEffectNode.
Class TShaderTextureNode Procedural texture defined by shaders.
Class TMatrixTransformNode Transform children by an explicit 4x4 matrix.
Class TTeapotNode Teapot geometry, useful for testing purposes.
Class TLoggerNode X3D events logging.
Class TConverterNode  
Class TRenderedTextureNode Texture with contents created by rendering the scene from a specific viewpoint.
Class TPlaneNode  
Class TTogglerNode Utility for setting and observing a boolean value in various ways.
Class TCircleNode Nodes that are defined by BitManagement (BS Contact) extensions.
Class TLayer2DNode  
Class TLayer3DNode  
Class TMouseSensorNode  
Class TOrderedGroupNode  
Class TX3DUnknownNode Not recognized VRML/X3D node type.
Class TX3DInterfaceDeclaration Interface declaration, used in VRML/X3D (exposed) prototypes and for nodes with dynamic fields (Script, ComposedShader).
Class TX3DInterfaceDeclarationList  
Class EX3DPrototypeInstantiateError  
Class TX3DPrototypeNode Node with information about a VRML/X3D prototype.
Class TX3DPrototypeBase  
Class TX3DPrototypeBaseList  
Class TX3DPrototype  
Class TX3DExternalPrototype  
Class TX3DRoute  
Class TX3DRouteList  
Class TX3DImport  
Class TX3DExport  
Class TX3DBindableStackBasic  
Class TX3DEventsEngine Abstract 3D object handling VRML/X3D events.
Class TX3DEventsEngineList  
Object TX3DNodeNameRec  
Class TX3DNodeNames List to track node names while parsing VRML/X3D file.
Class TX3DPrototypeNames  
Class TX3DImportableNames  
Class TX3DReaderNames Container tracking VRML/X3D node and prototype names during parsing.
Class ENodesManagerError  
Class ENodeClassRegisterError  
Class TNodesManager  

Functions and Procedures

function LoadX3DClassicInternal(Stream: TPeekCharStream; const BaseUrl: string): TX3DRootNode; overload;
function LoadX3DClassicFromString(const VRMLContents: string; const BaseUrl: string): TX3DRootNode; overload;
function LoadX3DClassic(const URL: string; const AllowStdIn: boolean; const Gzipped: boolean = false): TX3DRootNode; overload;
function LoadX3DXml(const URL: string; Gzipped: boolean): TX3DRootNode;
function LoadX3DXml(Stream: TStream; const URL: string): TX3DRootNode;
function LoadX3DXml(X3DElement: TDOMElement; const URL: string): TX3DRootNode;
function Save3DVersion(Node: TX3DNode): TX3DVersion;
procedure Save3D(Node: TX3DNode; const Stream: TStream; const Generator, Source: string; Version: TX3DVersion; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
procedure Save3D(Node: TX3DNode; const URL, Generator, Source: string; const Version: TX3DVersion; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
procedure Save3D(Node: TX3DNode; const Stream: TStream; const Generator, Source: string; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
procedure Save3D(Node: TX3DNode; const URL, Generator, Source: string; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
procedure Save3D(Node: TX3DNode; const URL: string; const Generator: string = ''; const Source: string = '');
function Save3DWillConvertToX3D(Version: TX3DVersion; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean): boolean;
procedure TraverseState_CreateNodes(var StateNodes: TTraverseStateLastNodes);
procedure TraverseState_FreeAndNilNodes(var StateNodes: TTraverseStateLastNodes);
procedure X3DNodeList_FreeUnusedAndNil(var List: TX3DNodeList);
function KeyRange(Key: TSingleList; const Fraction: Single; out T: Single): Integer;
procedure FreeIfUnusedAndNil(var Obj);
function URNMatchingCastle(const URN, ClassX3DType: string): boolean;

Types

TX3DNodeClass = class of TX3DNode;
TX3DNodeProc = procedure (Node: TX3DNode) of object;
TX3DNodeSearchProc = function (Node: TX3DNode): Pointer of object;
TVRML1StateNode = (...);
PLightInstance = ˆTLightInstance;
PClipPlane = ˆTClipPlane;
PTraversingInfo = ˆTTraversingInfo;
TTraversingFunc = function (Node: TX3DNode; StateStack: TX3DGraphTraverseStateStack; ParentInfo: PTraversingInfo; var TraverseIntoChildren: boolean): Pointer of object;
TTraversingAfterFunc = procedure (Node: TX3DNode; StateStack: TX3DGraphTraverseStateStack; ParentInfo: PTraversingInfo) of object;
TEnumerateChildrenFunction = function (Node, Child: TX3DNode): Pointer of object;
TEnumerateReplaceNodesFunction = procedure (ParentNode: TX3DNode; var Node: TX3DNode) of object;
TX3DAccessType = (...);
TX3DAccessTypes = set of TX3DAccessType;
TNodeDestructionNotification = procedure (Node: TX3DNode) of object;
TNodeTransformationChange = (...);
TCachedNodeList = specialize TFPGObjectList<TCachedNode>;
TTextureUpdate = (...);
TAllowedChildren = (...);
TTimeFunction = function: TFloatTime of object;
TGroupNode_2 = TGroupNode;
TStringLongIntMap = specialize TFPGMap<string, LongInt>;
TSwitchNode_2 = TSwitchNode;
TTransformNode_2 = TTransformNode;
TCoordRangeHandler = procedure (const RangeNumber: Cardinal; BeginIndex, EndIndex: Integer) of object;
TIndexedPolygonHandler = procedure (const Indexes: array of Cardinal) of object;
TIndexedLineSetNode_2 = TIndexedLineSetNode;
TPointSetNode_2 = TPointSetNode;
TShading = (...);
TLineType = (...);
TMaterialNode_2 = TMaterialNode;
TConeNode_2 = TConeNode;
TCylinderNode_2 = TCylinderNode;
TIndexedFaceSetNode_2 = TIndexedFaceSetNode;
TSphereNode_2 = TSphereNode;
TX3DFontFamily = (...);
TX3DFontJustify = (...);
TFontStyleNode_2 = TFontStyleNode deprecated 'use TFontStyleNode';
TLightScope = (...);
TDirectionalLightNode_2 = TDirectionalLightNode;
TPointLightNode_2 = TPointLightNode;
TSpotLightNode_2 = TSpotLightNode;
TX3DViewpointClassNode = class of TAbstractViewpointNode;
TLODNode_3 = TLODNode;
TOptionalBlendingSort = (...);
TBackgroundSide = (...);
TFogTypeOrNone = (...);
TFogType = ftLinear..ftExp;
PVertexJoints = ˆTVertexJoints;
TVertexJointsList = specialize TGenericStructList<TVertexJoints>;
TNurbsCurveNode_3 = TNurbsCurveNode;
TNurbsPositionInterpolatorNode_3 = TNurbsPositionInterpolatorNode;
TScriptType = (...);
TSceneOctreeProperties = (...);
TMatrixTransformNode_2 = TMatrixTransformNode;
PX3DNodeNameRec = ˆTX3DNodeNameRec;
TX3DVersion = CastleInternalX3DLexer.TX3DVersion;
TX3DEncoding = CastleInternalX3DLexer.TX3DEncoding;
EX3DGzipCompressed = CastleInternalX3DLexer.EX3DGzipCompressed;

Constants

DefaultMaterial_1AmbientColor: TVector3Single = (0.2, 0.2, 0.2);
DefaultMaterialAmbientIntensity = 0.2;
DefaultMaterialDiffuseColor: TVector3Single = (0.8, 0.8, 0.8);
DefaultMaterialSpecularColor: TVector3Single = (0, 0, 0);
DefaultMaterialEmissiveColor: TVector3Single = (0, 0, 0);
DefaultMaterialShininess = 0.2;
DefaultMaterialTransparency = 0.0;
DefaultMaterialMirror = 0.0;
DefaultMaterialReflSpecularExp = 1000000;
DefaultMaterialTransSpecularExp = 1000000;
TraverseStateLastNodesClasses : array [TVRML1StateNode] of TX3DNodeClass = ( TCoordinate3Node_1, TShapeHintsNode_1, TFontStyleNode_1, TMaterialNode_1, TMaterialBindingNode_1, TNormalNode, TNormalBindingNode_1, TTexture2Node_1, TTextureCoordinate2Node_1 );
LoadX3DClassic_FileFilters = 'All files|*|' + '*VRML (*.wrl, *.wrl.gz, *.wrz)|*.wrl;*.wrl.gz;*.wrz';
LoadX3DXml_FileFilters = 'All files|*|' + '*X3D XML (*.x3d, *.x3dz, *.x3d.gz)|*.x3d;*.x3dz;*.x3d.gz';
ProjectionTypeToStr: array [TProjectionType] of string = ('Orthographic', 'Perspective');
JUSTIFICATION_LEFT = 0 deprecated 'use fjBegin (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties';
JUSTIFICATION_CENTER = 1 deprecated 'use fjMiddle (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties';
JUSTIFICATION_RIGHT = 2 deprecated 'use fjEnd (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties';
BIND_DEFAULT = 0;
BIND_OVERALL = 1;
BIND_PER_PART = 2;
BIND_PER_PART_INDEXED = 3;
BIND_PER_FACE = 4;
BIND_PER_FACE_INDEXED = 5;
BIND_PER_VERTEX = 6;
BIND_PER_VERTEX_INDEXED = 7;
VERTORDER_UNKNOWN = 0;
VERTORDER_CLOCKWISE = 1;
VERTORDER_COUNTERCLOCKWISE = 2;
SHTYPE_UNKNOWN = 0;
SHTYPE_SOLID = 1;
FACETYPE_UNKNOWN = 0;
FACETYPE_CONVEX = 1;
FSFAMILY_SERIF = 0 deprecated 'use ffSerif (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family';
FSFAMILY_SANS = 1 deprecated 'use ffSans (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family';
FSFAMILY_TYPEWRITER = 2 deprecated 'use ffTypeWriter (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family';
FSSTYLE_BOLD = 0 deprecated 'use TFontStyleNode.Bold as a simple boolean';
FSSTYLE_ITALIC = 1 deprecated 'use TFontStyleNode.Italic as a simple boolean';
CONE_PARTS_SIDES = 0;
CONE_PARTS_BOTTOM = 1;
CYLINDER_PARTS_SIDES = 0;
CYLINDER_PARTS_TOP = 1;
CYLINDER_PARTS_BOTTOM = 2;
TEXWRAP_REPEAT = 0 deprecated 'use TAbstractTexture2DNode.RepeatS or TAbstractTexture2DNode.RepeatT boolean properties';
TEXWRAP_CLAMP = 1 deprecated 'use TAbstractTexture2DNode.RepeatS or TAbstractTexture2DNode.RepeatT boolean properties';
DefaultHeightMapScale = 0.01;
DefaultVRML1CreaseAngle = 0.5;
DefaultViewpointFieldOfView = Pi / 4;
DefaultNavigationInfoHeadlight = true;
DefaultRenderedTextureWidth = 128;
DefaultRenderedTextureHeight = 128;
VRML1Version: TX3DVersion = (Major: 1; Minor: 0);
VRML2Version: TX3DVersion = (Major: 2; Minor: 0);
X3DVersion: TX3DVersion = (Major: 3; Minor: 2);
xeClassic = CastleInternalX3DLexer.xeClassic;
xeXML = CastleInternalX3DLexer.xeXML;
MinTriangulationSlices: Cardinal = 3;
MinTriangulationStacks: Cardinal = 1;
MinTriangulationDivisions: Cardinal = 0;
URNVRML97Nodes = 'urn:web3d:vrml97:node:';
URNX3DNodes = 'urn:web3d:x3d:node:';
URNBitManagementNodes = 'urn:inet:bitmanagement.de:node:';
DefaultAnimationPrefix = '';
AllAccessTypes = [atInputOnly, atOutputOnly, atInitializeOnly, atInputOutput];
RestrictedAccessTypes = [atInputOnly, atOutputOnly, atInitializeOnly];

Variables

NodesManager: TNodesManager;
WarnAboutAbsoluteFilenames: boolean = true;
DefaultTriangulationSlices: Cardinal = 30;
DefaultTriangulationStacks: Cardinal = 20;
DefaultTriangulationDivisions: Cardinal = 2;
AnyNodeDestructionNotifications: TNodeDestructionNotificationList;
X3DCache: TX3DNodesCache;

Description

Functions and Procedures

function LoadX3DClassicInternal(Stream: TPeekCharStream; const BaseUrl: string): TX3DRootNode; overload;

Load VRML/X3D file in classic encoding from stream. Return it's root node.

Note that you must pass here TPeekCharStream class, not just any generic TStream class. But it's not a problem, really, because you can wrap any class inside TPeekCharStream descendant. E.g. do

LoadX3DClassicInternal(TBufferedReadStream.Create(MyStream, false), BaseUrl)

Note that this function can't handle compressed data (X3D files are sometimes compressed with gzip). You should pass here a stream with an already uncompressed text data.

Exceptions raised
EX3DGzipCompressed
If the Stream starts with gzip file header.
function LoadX3DClassicFromString(const VRMLContents: string; const BaseUrl: string): TX3DRootNode; overload;

Load VRML/X3D file in classic encoding from a string. Return it's root node.

Exceptions raised
EX3DGzipCompressed
If the Stream is compressed with gzip.
function LoadX3DClassic(const URL: string; const AllowStdIn: boolean; const Gzipped: boolean = false): TX3DRootNode; overload;

Load VRML/X3D file in classic encoding, return it's root node.

Automatically handles VRML/X3D files compressed with gzip, uncompressing them on the fly.

URL without any protocol is treated as a filename (absolute or relative to current dir). We can also load network URLs using CastleDownload.

If AllowStdIn then URL = '-' is understood as "standard input" (StdInStream). Base for resolving relative URLs in this case is the current working directory.

If Gzipped then we can be relatively sure that stream is gzipped. Otherwise, it can still be gzipped (.wrl files are sometimes gzipped without extension indicating it).

function LoadX3DXml(const URL: string; Gzipped: boolean): TX3DRootNode;

Read X3D encoded in XML, and convert it to VRML/X3D nodes graph.

Overloaded version that takes Stream as a parameter expects that reading the stream returns the uncompressed content (no longer gzip compressed). This version also takes URL as a parameter, but it is not used to load contents (these are inside Stream), it it only used to resolve relative URLs inside content and for error messages.

function LoadX3DXml(Stream: TStream; const URL: string): TX3DRootNode;
 
function LoadX3DXml(X3DElement: TDOMElement; const URL: string): TX3DRootNode;
 
function Save3DVersion(Node: TX3DNode): TX3DVersion;

Which VRML/X3D version should be used to save this 3D model.

procedure Save3D(Node: TX3DNode; const Stream: TStream; const Generator, Source: string; Version: TX3DVersion; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;

Write VRML/X3D model to a file. Generates a complete file, with header lines (XML headers, or #VRML / #X3D in classic encoding) and everything.

Overloaded version that takes an URL will automatically compress the file with gzip if an extension indicating gzip compression is present (like .x3dv.gz, or .x3d.gz).

Generator and Source, if not empty, will be used to set appropriate META values of X3D root file node. This way you can indicate inside X3D file the generator (your program) name and source (original 3D model file name). If this is not an X3D root file node, we will record it inside a comment.

Conversion to X3D:

When ForceConvertingToX3D or when Encoding <> xeClassic, the node graph will be converted to X3D (if it isn't X3D already). This can be used to convert VRML 2.0 to X3D.

This should not be used if the original file version (recorded in Node) indicates that it's an old VRML 1.0 or Inventor file, as we have not implemented convertion from VRML 1.0/Inventor to X3D. So it wil result in VRML 1.0/Inventor nodes saved using the X3D (XML or classic) encoding, which is not a format supported by any X3D reader (even our own).

Note that converting VRML 2.0 to X3D will change the nodes graph in-place, possibly removing some nodes. If you use TCastleSceneCore, you should call TCastleSceneCore.BeforeNodesFree before such operation, and TCastleSceneCore.ChangedAll afterwards. (You can easily test whether they will be needed by Save3DWillConvertToX3D).

If you use Encoding=xeClassic and ForceConvertingToX3D=false, no conversion will ever happen.

Parameters
Version
Which VRML/X3D specification version should be used to encode. It should be calculated by Save3DVersion(Node). You often want to calculate it yourself, before calling Save3D, this way you can propose a sensible saved model extension for user (.wrl for VRML <= 2.0 in classic encoding, .x3dv for X3D in classic encoding).

Note that this parameter is not a mechanism to convert between various VRML/X3D versions. This procedure does not convert VRML/X3D nodes/fields inside. For example, you can't just change Version.Major value from 1 to 3 to convert VRML 1.0 to X3D. It would cause some information to be encoded in X3D style (e.g. generated file will have X3D header and PROFILE information), but the nodes would stil have VRML 1.0 names and fields. Which means that you would not generate correct X3D file.

So this should really be calculated based on model contents, usually by Save3DVersion(Node).

A limited VRML 2.0 conversion is possible by ForceConvertingToX3D = true. In this case, Version will be automatically changed to X3D anyway.

procedure Save3D(Node: TX3DNode; const URL, Generator, Source: string; const Version: TX3DVersion; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
 
procedure Save3D(Node: TX3DNode; const Stream: TStream; const Generator, Source: string; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
 
procedure Save3D(Node: TX3DNode; const URL, Generator, Source: string; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean = false); overload;
 
procedure Save3D(Node: TX3DNode; const URL: string; const Generator: string = ''; const Source: string = '');
 
function Save3DWillConvertToX3D(Version: TX3DVersion; const Encoding: TX3DEncoding; const ForceConvertingToX3D: boolean): boolean;
 
procedure TraverseState_CreateNodes(var StateNodes: TTraverseStateLastNodes);

Create and assign all State.Nodes.

procedure TraverseState_FreeAndNilNodes(var StateNodes: TTraverseStateLastNodes);

Free and nil all State.Nodes.

procedure X3DNodeList_FreeUnusedAndNil(var List: TX3DNodeList);

Free all unused VRML/X3D nodes on the list, then free and Nil the list itself.

function KeyRange(Key: TSingleList; const Fraction: Single; out T: Single): Integer;

Find a range within "key" field corresponding to given Fraction. Returns the index of right range delimiter. So for normal ranges (between two values of "key" field) it's always between 1 and FdKey.Count - 1. Result 0 indicates we're before the left limit, and result equal FdKey.Count indicates we're after right limit.

Result is always between 0 and FdKey.Count.

Output T is the value between 0..1 indicating where within the range we are. It's undefined when Result is 0 or Key.Count (indicating we're outside limits).

Call this only when FdKey.Count > 0.

This is useful to interpreting TAbstractInterpolatorNode.KeyRange and such fields.

procedure FreeIfUnusedAndNil(var Obj);

Free TX3DNode if it is unused (see TX3DNode.FreeIfUnused), setting reference to Nil. Analogous to standard FreeAndNil, but checks if node is used first.

function URNMatchingCastle(const URN, ClassX3DType: string): boolean;

Does this URN indicate an X3D node that is a Castle Game Engine extension. This is a helper for implementing TX3DNode.URNMatching.

Types

TX3DNodeClass = class of TX3DNode;
 
TX3DNodeProc = procedure (Node: TX3DNode) of object;
 
TX3DNodeSearchProc = function (Node: TX3DNode): Pointer of object;
 
TVRML1StateNode = (...);
 
Values
  • vsCoordinate3
  • vsShapeHints
  • vsFontStyle
  • vsMaterial
  • vsMaterialBinding
  • vsNormal
  • vsNormalBinding
  • vsTexture2
  • vsTextureCoordinate2
PLightInstance = ˆTLightInstance;
 
PClipPlane = ˆTClipPlane;
 
PTraversingInfo = ˆTTraversingInfo;
 
TTraversingFunc = function (Node: TX3DNode; StateStack: TX3DGraphTraverseStateStack; ParentInfo: PTraversingInfo; var TraverseIntoChildren: boolean): Pointer of object;

Used as a callback by TX3DNode.Traverse.

TTraversingAfterFunc = procedure (Node: TX3DNode; StateStack: TX3DGraphTraverseStateStack; ParentInfo: PTraversingInfo) of object;
 
TEnumerateChildrenFunction = function (Node, Child: TX3DNode): Pointer of object;
 
TEnumerateReplaceNodesFunction = procedure (ParentNode: TX3DNode; var Node: TX3DNode) of object;
 
TX3DAccessType = (...);
 
Values
  • atInputOnly
  • atOutputOnly
  • atInitializeOnly
  • atInputOutput
TX3DAccessTypes = set of TX3DAccessType;
 
TNodeDestructionNotification = procedure (Node: TX3DNode) of object;
 
TNodeTransformationChange = (...);
 
Values
TCachedNodeList = specialize TFPGObjectList<TCachedNode>;
 
TTextureUpdate = (...);

Possible update modes for generated textures (like TGeneratedCubeMapTextureNode).

Values
  • upNone
  • upNextFrameOnly
  • upAlways
TAllowedChildren = (...);
 
Values
  • acAll
  • acClasses
  • acInterface
TTimeFunction = function: TFloatTime of object;
 
TGroupNode_2 = TGroupNode;

Automatically generated node properties.

Do not edit this file manually! To add new properties, add them to text files in nodes_specification/components/ , and regenerate include files by running nodes_specification/generate_x3d_nodes_to_pascal.lpr .

The documentation for properties should go to x3dnodes_documentation.txt .

TStringLongIntMap = specialize TFPGMap<string, LongInt>;
 
TSwitchNode_2 = TSwitchNode;
 
TTransformNode_2 = TTransformNode;
 
TCoordRangeHandler = procedure (const RangeNumber: Cardinal; BeginIndex, EndIndex: Integer) of object;
 
TIndexedPolygonHandler = procedure (const Indexes: array of Cardinal) of object;
 
TIndexedLineSetNode_2 = TIndexedLineSetNode;
 
TPointSetNode_2 = TPointSetNode;

Automatically generated node properties.

Do not edit this file manually! To add new properties, add them to text files in nodes_specification/components/ , and regenerate include files by running nodes_specification/generate_x3d_nodes_to_pascal.lpr .

The documentation for properties should go to x3dnodes_documentation.txt .

TShading = (...);
 
Values
  • shDefault
  • shPhong
  • shWireframe
TLineType = (...);

Supported line types (patterns), for TLinePropertiesNode.LineType.

Values
  • ltSolid
  • ltDashed
  • ltDotted
  • ltDashedDotted
  • ltDashDotDot
TMaterialNode_2 = TMaterialNode;
 
TConeNode_2 = TConeNode;
 
TCylinderNode_2 = TCylinderNode;
 
TIndexedFaceSetNode_2 = TIndexedFaceSetNode;
 
TSphereNode_2 = TSphereNode;
 
TX3DFontFamily = (...);

Font family that can be specified by a TFontStyleNode.

Values
  • ffSerif
  • ffSans
  • ffTypeWriter
TX3DFontJustify = (...);

Font justification that can be specified by a TFontStyleNode.

Values
  • fjFirst
  • fjBegin
  • fjMiddle
  • fjEnd
TFontStyleNode_2 = TFontStyleNode deprecated 'use TFontStyleNode';

Warning: this symbol is deprecated: use TFontStyleNode

 
TLightScope = (...);
 
Values
  • lsGlobal: Light shines everywhere. VRML/X3D >= 2 calls these lights global.
  • lsLocal: Light shines only within it's VRML/X3D grouping node. VRML/X3D >= 2 calls these lights not global.
  • lsLocalVRML1: Light shines only on the following shapes within it's VRML/X3D grouping node. This is used by VRML 1.0 (and Inventor) light sources.
TDirectionalLightNode_2 = TDirectionalLightNode;

Automatically generated node properties.

Do not edit this file manually! To add new properties, add them to text files in nodes_specification/components/ , and regenerate include files by running nodes_specification/generate_x3d_nodes_to_pascal.lpr .

The documentation for properties should go to x3dnodes_documentation.txt .

TPointLightNode_2 = TPointLightNode;

Automatically generated node properties.

Do not edit this file manually! To add new properties, add them to text files in nodes_specification/components/ , and regenerate include files by running nodes_specification/generate_x3d_nodes_to_pascal.lpr .

The documentation for properties should go to x3dnodes_documentation.txt .

TSpotLightNode_2 = TSpotLightNode;
 
TX3DViewpointClassNode = class of TAbstractViewpointNode;
 
TLODNode_3 = TLODNode;
 
TOptionalBlendingSort = (...);
 
Values
  • obsDefault
  • obsNone
  • obs2D
  • obs3D
TBackgroundSide = (...);
 
Values
  • bsBack
  • bsBottom
  • bsFront
  • bsLeft
  • bsRight
  • bsTop
TFogTypeOrNone = (...);
 
Values
  • ftLinear
  • ftExp
  • ftNone
TFogType = ftLinear..ftExp;
 
PVertexJoints = ˆTVertexJoints;
 
TVertexJointsList = specialize TGenericStructList<TVertexJoints>;
 
TNurbsCurveNode_3 = TNurbsCurveNode;
 
TNurbsPositionInterpolatorNode_3 = TNurbsPositionInterpolatorNode;
 
TScriptType = (...);
 
Values
  • stCompiled
  • stCastleScript
TSceneOctreeProperties = (...);

Automatically generated node properties.

Do not edit this file manually! To add new properties, add them to text files in nodes_specification/components/ , and regenerate include files by running nodes_specification/generate_x3d_nodes_to_pascal.lpr .

The documentation for properties should go to x3dnodes_documentation.txt .

Values
  • opRendering
  • opDynamicCollisions
  • opVisibleTriangles
  • opStaticCollisions
TMatrixTransformNode_2 = TMatrixTransformNode;
 
PX3DNodeNameRec = ˆTX3DNodeNameRec;
 
TX3DVersion = CastleInternalX3DLexer.TX3DVersion;
 
TX3DEncoding = CastleInternalX3DLexer.TX3DEncoding;
 
EX3DGzipCompressed = CastleInternalX3DLexer.EX3DGzipCompressed;

Raised by LoadX3DClassicFromString or LoadX3DClassicInternal when the stream is compressed with gzip.

Constants

DefaultMaterial_1AmbientColor: TVector3Single = (0.2, 0.2, 0.2);
 
DefaultMaterialAmbientIntensity = 0.2;
 
DefaultMaterialDiffuseColor: TVector3Single = (0.8, 0.8, 0.8);
 
DefaultMaterialSpecularColor: TVector3Single = (0, 0, 0);
 
DefaultMaterialEmissiveColor: TVector3Single = (0, 0, 0);
 
DefaultMaterialShininess = 0.2;
 
DefaultMaterialTransparency = 0.0;
 
DefaultMaterialMirror = 0.0;
 
DefaultMaterialReflSpecularExp = 1000000;
 
DefaultMaterialTransSpecularExp = 1000000;
 
TraverseStateLastNodesClasses : array [TVRML1StateNode] of TX3DNodeClass = ( TCoordinate3Node_1, TShapeHintsNode_1, TFontStyleNode_1, TMaterialNode_1, TMaterialBindingNode_1, TNormalNode, TNormalBindingNode_1, TTexture2Node_1, TTextureCoordinate2Node_1 );

Classes corresponding to nodes on TTraverseStateLastNodes.

LoadX3DClassic_FileFilters = 'All files|*|' + '*VRML (*.wrl, *.wrl.gz, *.wrz)|*.wrl;*.wrl.gz;*.wrz';

File filters if you want to open a file and then pass it to LoadX3DClassic. Suitable for TCastleWindowCustom.FileDialog and such.

LoadX3DXml_FileFilters = 'All files|*|' + '*X3D XML (*.x3d, *.x3dz, *.x3d.gz)|*.x3d;*.x3dz;*.x3d.gz';

Global routines for parsing XML X3D encoding.

ProjectionTypeToStr: array [TProjectionType] of string = ('Orthographic', 'Perspective');
 
JUSTIFICATION_LEFT = 0 deprecated 'use fjBegin (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties';

Warning: this symbol is deprecated: use fjBegin (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties

Constants for TAsciiTextNode_1.FdJustification.Value.

JUSTIFICATION_CENTER = 1 deprecated 'use fjMiddle (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties';

Warning: this symbol is deprecated: use fjMiddle (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties

 
JUSTIFICATION_RIGHT = 2 deprecated 'use fjEnd (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties';

Warning: this symbol is deprecated: use fjEnd (from an enumerated type TX3DFontJustify) with TAsciiTextNode_1.Justify or TFontStyleNode.Justify properties

 
BIND_DEFAULT = 0;

Constants for TMaterialBindingNode_1.FdValue.Value and TNormalBindingNode_1.FdValue.Value.

BIND_OVERALL = 1;
 
BIND_PER_PART = 2;
 
BIND_PER_PART_INDEXED = 3;
 
BIND_PER_FACE = 4;
 
BIND_PER_FACE_INDEXED = 5;
 
BIND_PER_VERTEX = 6;
 
BIND_PER_VERTEX_INDEXED = 7;
 
VERTORDER_UNKNOWN = 0;

Constants for TShapeHintsNode_1.FdVertexOrdering.Value.

VERTORDER_CLOCKWISE = 1;
 
VERTORDER_COUNTERCLOCKWISE = 2;
 
SHTYPE_UNKNOWN = 0;

Constants for TShapeHintsNode_1.FdShapeType.Value.

SHTYPE_SOLID = 1;
 
FACETYPE_UNKNOWN = 0;

Constants for TShapeHintsNode_1.FdFaceType.Value.

FACETYPE_CONVEX = 1;
 
FSFAMILY_SERIF = 0 deprecated 'use ffSerif (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family';

Warning: this symbol is deprecated: use ffSerif (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family

Constants for TFontStyleNode.FdFamily.Value.

FSFAMILY_SANS = 1 deprecated 'use ffSans (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family';

Warning: this symbol is deprecated: use ffSans (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family

 
FSFAMILY_TYPEWRITER = 2 deprecated 'use ffTypeWriter (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family';

Warning: this symbol is deprecated: use ffTypeWriter (TX3DFontFamily an enumerated type) with the properties like TFontStyleNode.Family

 
FSSTYLE_BOLD = 0 deprecated 'use TFontStyleNode.Bold as a simple boolean';

Warning: this symbol is deprecated: use TFontStyleNode.Bold as a simple boolean

Constants for VRML 1.0 TFontStyleNode_1.FdStyle flags.

FSSTYLE_ITALIC = 1 deprecated 'use TFontStyleNode.Italic as a simple boolean';

Warning: this symbol is deprecated: use TFontStyleNode.Italic as a simple boolean

 
CONE_PARTS_SIDES = 0;

Constants for TConeNode.FdParts.Flags.

CONE_PARTS_BOTTOM = 1;
 
CYLINDER_PARTS_SIDES = 0;

Constants for TCylinderNode.FdParts.Flags.

CYLINDER_PARTS_TOP = 1;
 
CYLINDER_PARTS_BOTTOM = 2;
 
TEXWRAP_REPEAT = 0 deprecated 'use TAbstractTexture2DNode.RepeatS or TAbstractTexture2DNode.RepeatT boolean properties';

Warning: this symbol is deprecated: use TAbstractTexture2DNode.RepeatS or TAbstractTexture2DNode.RepeatT boolean properties

Constants for TTexture2Node_1.FdWrapS.Value and TTexture2Node_1.FdWrapT.Value.

TEXWRAP_CLAMP = 1 deprecated 'use TAbstractTexture2DNode.RepeatS or TAbstractTexture2DNode.RepeatT boolean properties';

Warning: this symbol is deprecated: use TAbstractTexture2DNode.RepeatS or TAbstractTexture2DNode.RepeatT boolean properties

 
DefaultHeightMapScale = 0.01;
 
DefaultVRML1CreaseAngle = 0.5;
 
DefaultViewpointFieldOfView = Pi / 4;
 
DefaultNavigationInfoHeadlight = true;
 
DefaultRenderedTextureWidth = 128;
 
DefaultRenderedTextureHeight = 128;
 
VRML1Version: TX3DVersion = (Major: 1; Minor: 0);
 
VRML2Version: TX3DVersion = (Major: 2; Minor: 0);
 
X3DVersion: TX3DVersion = (Major: 3; Minor: 2);

Latest X3D version supported.

xeClassic = CastleInternalX3DLexer.xeClassic;
 
xeXML = CastleInternalX3DLexer.xeXML;
 
MinTriangulationSlices: Cardinal = 3;

Minimal values for DefaultTriangulationSlices, DefaultTriangulationStacks, DefaultTriangulationDivisions.

Note that MinTriangulationSlices can be lower (2), it works, but the result isn't really sensible.

MinTriangulationStacks: Cardinal = 1;
 
MinTriangulationDivisions: Cardinal = 0;
 
URNVRML97Nodes = 'urn:web3d:vrml97:node:';

URNs used to indicate standard VRML / X3D nodes.

Funny thing, I actually didn't found anywhere a definite official statement that they are using such-and-such URNs.

X3D specification refers to RFC [http://www.ietf.org/rfc/rfc3541.txt?number=3541] which, basically, just says "we like URNs and we'll use them" and nothing more. Same thing for VRML 97 spec [http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/extensions.html]. There is no precise answer e.g. what URN should be used to Indicate some standard VRML 97 / X3D node.

I constructed URNs below looking at examples in the RFC, annotated by a funny line "The following examples are not guaranteed to be real. They are presented for pedagogical reasons only."

URNX3DNodes = 'urn:web3d:x3d:node:';
 
URNBitManagementNodes = 'urn:inet:bitmanagement.de:node:';

URN to indicate BitManagement nodes. This should work, according to http://www.bitmanagement.com/developer/contact/examples/layer/index.html example EXTERNPROTO.

DefaultAnimationPrefix = '';

Standard prefix name for a time sensor to be recognized as a "named animation" for TCastleSceneCore.PlayAnimation and friends.

AllAccessTypes = [atInputOnly, atOutputOnly, atInitializeOnly, atInputOutput];
 
RestrictedAccessTypes = [atInputOnly, atOutputOnly, atInitializeOnly];
 

Variables

NodesManager: TNodesManager;

Nodes manager instance. In normal circumstances, this is the only instance of TNodesManager class ever created. It is created / destroyed in this unit's initialization / finalization.

WarnAboutAbsoluteFilenames: boolean = true;

Should we emit a warning when loading data from an URI with an absolute filename, like file:///c:/blah/myimage.png. The warning is emitted using WritelnWarning. This is quite useful, as usually you want to avoid using such URIs, as they will probably not work on any other system than your own (and they prevent you from easily moving the files to some other system/location).

In your data (X3D, VRML, Collada, OBJ materials...), you should always use relative paths.

DefaultTriangulationSlices: Cardinal = 30;

Triangulation settings.

"Slices" divide the circumference of the circle, like the slices of a pizza. "Stacks" divide the height of the object, like the stacks of a cake or tower. These are used for quadrics - cylinder, cone, sphere and disk.

"Divisions" divide the cube side. This is beneficial for better Gouraud shading.

You can change these variables only before using anything from this module. If you want to change them inside VRML/X3D file (for example, to affect only part of the scene), use the Triangulation node, see http://castle-engine.sourceforge.net/x3d_implementation_geometry3d_extensions.php#section_triangulation

These variables must always honour MinTriangulationSlices, MinTriangulationStacks, MinTriangulationDivisions limits.

DefaultTriangulationStacks: Cardinal = 20;
 
DefaultTriangulationDivisions: Cardinal = 2;
 
AnyNodeDestructionNotifications: TNodeDestructionNotificationList;

Functions registered here will be called when any TX3DNode descendant will be destroyed.

X3DCache: TX3DNodesCache;

Cache, for all the resources not tied with renderer context.


Generated by PasDoc 0.14.0.