| 1 |
{ |
| 2 |
Copyright 2002-2023 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
(* |
| 17 |
@abstract(Nodes and other important bulding blocks |
| 18 |
of X3D (prototypes, routes and so on).) |
| 19 |
|
| 20 |
This is the central unit for X3D processing, as X3D file |
| 21 |
is basically just a graph of nodes. We represent whole X3D file |
| 22 |
by it's root node. This is what we load, save and process in this unit. |
| 23 |
|
| 24 |
The chapter "Reading, writing, processing VRML scene graph" |
| 25 |
in the documentation on |
| 26 |
[https://castle-engine.io/vrml_engine_doc/output/xsl/html/chapter.scene_graph.html] |
| 27 |
is almost completely devoted to documenting the design of this single unit. |
| 28 |
|
| 29 |
@bold(Various uses of this unit:) |
| 30 |
|
| 31 |
@unorderedList( |
| 32 |
@item(Nodes can be loaded or saved from the stream in a classic or |
| 33 |
XML encoding. |
| 34 |
For classic encoding we use a lexer in CastleInternalX3DLexer unit. |
| 35 |
For XML encoding, we use standard FPC DOM unit. |
| 36 |
Loading and saving of fields (in both encodings) is inside X3DFields unit. |
| 37 |
|
| 38 |
When reading X3D files, we generally do not change the X3D graph. |
| 39 |
So we're able to save exactly the same X3D graph |
| 40 |
back to another file. See also |
| 41 |
[https://castle-engine.io/vrml_engine_doc/output/xsl/html/section.writing_vrml.html#section.vrml_preserving]. |
| 42 |
This allows writing various X3D |
| 43 |
processing tools, that can simply read the file, change whatever |
| 44 |
they want, and write the file back --- knowing that the "untouched" |
| 45 |
parts of graph are preserved perfectly.) |
| 46 |
|
| 47 |
@item(TX3DNode class offers a lot of methods to process X3D graph. |
| 48 |
See TX3DNode.Traverse, TX3DNode.EnumerateNodes and |
| 49 |
TX3DNode.FindNode. TX3DNode.Traverse is especially important, as it |
| 50 |
walks through X3D graph just as the specification says |
| 51 |
(accumulating transformation, visiting only active children of |
| 52 |
nodes like Switch or LOD), |
| 53 |
gathering some state (useful especially for VRML 1.0, but also |
| 54 |
used for various things in new X3D versions). |
| 55 |
|
| 56 |
When you want to render X3D graph, you can just traverse |
| 57 |
the graph and render each geometry node (TAbstractGeometryNode instance) |
| 58 |
knowing it's state (that will contain transformation and such). |
| 59 |
Alternatively, simple renderer can also use TAbstractGeometryNode.Triangulate.) |
| 60 |
|
| 61 |
@item(TAbstractGeometryNode is an important descendant of TX3DNode, |
| 62 |
as it defines stuff actually visible in the 3D world. |
| 63 |
It has useful routines for calculating bounding volumes, |
| 64 |
triangulating and such. |
| 65 |
|
| 66 |
But note that usually it's more comfortable |
| 67 |
to load your scene to TCastleScene or TCastleSceneCore and then |
| 68 |
query the shapes list in TCastleSceneCore.Shapes --- this is usually |
| 69 |
more comfortable, also TCastleSceneCore and TShape cache some results |
| 70 |
for speed.) |
| 71 |
|
| 72 |
@item(This unit doesn't depend on OpenGL, or any other particular rendering |
| 73 |
method. So it's suitable also for CastleRayTracer, and every other possible |
| 74 |
renderer that will ever get implemented.) |
| 75 |
|
| 76 |
@item(Your own units can define new X3D nodes, by declaring |
| 77 |
new classes descending from TX3DNode (or other, more specialized, |
| 78 |
descendant). You should register your new classes by calling |
| 79 |
@link(TNodesManager.RegisterNodeClasses NodesManager.RegisterNodeClasses).) |
| 80 |
) |
| 81 |
|
| 82 |
@bold(Node class names, and inheritance:) |
| 83 |
|
| 84 |
@unorderedList( |
| 85 |
@item(Normal X3D nodes are defined by classses |
| 86 |
named like @code(TXxxNode). These nodes can be specified inside the X3D |
| 87 |
files. See X3D specifications, and also our extensions specification, |
| 88 |
on [https://castle-engine.io/vrml_x3d.php]. |
| 89 |
|
| 90 |
There are also abstract node classes. Their definitions are helpful |
| 91 |
for handling some functionality common to many descendants, |
| 92 |
and to declare allowed children in SFNode/MFNode fields. |
| 93 |
Abstract node classes are named like @code(TAbstractXxxNode). |
| 94 |
Some of the abstract nodes are also defined by X3D specification, |
| 95 |
and some of them are just our own inventions. |
| 96 |
|
| 97 |
Finally, there are some special-purpose node classes that play |
| 98 |
important role in our X3D organization. |
| 99 |
They are not abstract, but also their exact instances |
| 100 |
are not created under normal circumstances. |
| 101 |
These are named like @code(TX3DXxxNode), currently |
| 102 |
these are only: TX3DNode, TX3DRootNode, TX3DUnknownNode, TX3DPrototypeNode. |
| 103 |
|
| 104 |
All node classes descend from the base TX3DNode class. |
| 105 |
|
| 106 |
When X3D design needs multiple inheritance, we use TNodeFunctionality, |
| 107 |
to expose interface and have implementation that does "something", |
| 108 |
but is not tied to the inheritance. E.g. varios unrelated nodes may support |
| 109 |
TTransformFunctionality. We don't use interfaces for this -- this avoids |
| 110 |
COM interface design weirdness (and in Delphi we're limited to COM interfaces), |
| 111 |
and allows to share implemetation too.) |
| 112 |
|
| 113 |
@item( |
| 114 |
Optional suffix _1 or _2 at the node class name indicates that |
| 115 |
this is only for a specific X3D or VRML standard version. |
| 116 |
Suffix _1 indicates nodes specific to VRML 1.0. |
| 117 |
Suffix _2 indicates nodes specific to VRML 2.0 (aka 97), |
| 118 |
that are not available in X3D. |
| 119 |
Latest X3D nodes do not have any suffix |
| 120 |
(to not clutter the source code that simply wants to use the latest |
| 121 |
and best version of the standard). |
| 122 |
|
| 123 |
For example, we have TIndexedFaceSetNode_1 for VRML 1.0 and |
| 124 |
TIndexedFaceSetNode for VRML 2.0 and X3D.) |
| 125 |
) |
| 126 |
|
| 127 |
@bold(VRML/X3D versions handling:) |
| 128 |
|
| 129 |
@unorderedList( |
| 130 |
@item( |
| 131 |
We handle VRML 1.0, VRML 2.0 (aka VRML 97) and X3D (aka VRML 3.x). |
| 132 |
|
| 133 |
Every correct VRML / X3D file in classic and XML encoding should be parsed |
| 134 |
by this unit. |
| 135 |
See [https://castle-engine.io/x3d_implementation_status.php] |
| 136 |
for much more detailed information about supported features.) |
| 137 |
|
| 138 |
@item( |
| 139 |
Also many Inventor 1.0 files are correctly parsed. |
| 140 |
We handle Inventor 1.0 mostly like VRML 1.0, also some small |
| 141 |
things and nodes specific for Inventor 1.0 are implemented here, see |
| 142 |
[https://castle-engine.io/x3d_extensions.php#ext_iv_in_vrml].) |
| 143 |
|
| 144 |
@item( |
| 145 |
Note that structures in this unit are @italic(not) focused |
| 146 |
on either VRML 1.0 or VRML >= 2.0. On the contrary: we try to handle |
| 147 |
the @italic(sum of all VRML and X3D). When reading VRML 1.0, |
| 148 |
many VRML 2.0 constructs (that do not conflict with anything in VRML 1.0) |
| 149 |
are allowed, and the other way around too. |
| 150 |
|
| 151 |
Internally, we do not convert VRML 1.0-specific constructs |
| 152 |
to VRML 2.0/X3D constructs (or the other way around). |
| 153 |
See [https://castle-engine.io/vrml_engine_doc/output/xsl/html/section.vrml_1_2_sum.html] |
| 154 |
for more in-depth explanation of how, and why, we handle both |
| 155 |
old-style (Inventor, VRML 1.0) and new-style (VRML 2.0, X3D) |
| 156 |
syntax.) |
| 157 |
) |
| 158 |
*) |
| 159 |
|
| 160 |
unit X3DNodes; |
| 161 |
|
| 162 |
{$I castleconf.inc} |
| 163 |
|
| 164 |
{$ifdef CASTLE_STRICT_CLI} |
| 165 |
{$error When CASTLE_STRICT_CLI is defined, you cannot link to this unit.} |
| 166 |
{$endif} |
| 167 |
|
| 168 |
interface |
| 169 |
|
| 170 |
uses SysUtils, Generics.Collections, Classes, XMLRead, DOM, |
| 171 |
CastleVectors, CastleRectangles, CastleTimeUtils, CastleFonts, |
| 172 |
CastleInternalX3DLexer, CastleUtils, CastleClassUtils, |
| 173 |
X3DFields, CastleBoxes, CastleImages, CastleColors, CastleCameras, |
| 174 |
CastleVideos, X3DTime, CastleTransform, CastleInternalMaterialProperties, |
| 175 |
CastleScript, CastleInternalX3DScript, CastleInternalOctree, |
| 176 |
CastleInternalCompositeImage, |
| 177 |
CastleTextureImages, CastleKeysMouse, CastleSoundEngine, CastleStringUtils, |
| 178 |
CastleTextureFontData, CastleRenderOptions, CastleProjection, CastleBehaviors; |
| 179 |
|
| 180 |
{$define read_interface} |
| 181 |
|
| 182 |
type |
| 183 |
{$I x3dnodes_initial_types.inc} |
| 184 |
{$I x3dnodes_vrml1state.inc} |
| 185 |
{$I x3dnodes_lightinstance.inc} |
| 186 |
{$I x3dnodes_clipplane.inc} |
| 187 |
{$I x3dnodes_x3dgraphtraversestate.inc} |
| 188 |
{$I x3dnodes_destructionnotification.inc} |
| 189 |
{$I x3dnodes_x3dnodescache.inc} |
| 190 |
{$I x3dnodes_x3dfonttexturescache.inc} |
| 191 |
{$I x3dnodes_x3dnode.inc} |
| 192 |
{$I x3dnodes_generatedtextures.inc} |
| 193 |
{$I x3dnodes_x3dnodeclasseslist.inc} |
| 194 |
{$I x3dnodes_sfnode.inc} |
| 195 |
{$I x3dnodes_mfnode.inc} |
| 196 |
{$I x3dnodes_utils_materials.inc} |
| 197 |
|
| 198 |
{ Nodes from standard X3D components } |
| 199 |
{$I x3dnodes_standard_core.inc} |
| 200 |
{$I x3dnodes_standard_time.inc} |
| 201 |
{$I x3dnodes_standard_grouping.inc} |
| 202 |
{$I x3dnodes_standard_networking.inc} |
| 203 |
{$I x3dnodes_standard_rendering.inc} |
| 204 |
{$I x3dnodes_standard_shape.inc} |
| 205 |
{$I x3dnodes_standard_geometry3d.inc} |
| 206 |
{$I x3dnodes_standard_geometry2d.inc} |
| 207 |
{$I x3dnodes_standard_text.inc} |
| 208 |
{$I x3dnodes_standard_sound.inc} |
| 209 |
{$I x3dnodes_standard_lighting.inc} |
| 210 |
{$I x3dnodes_standard_texturing.inc} |
| 211 |
{$I x3dnodes_standard_interpolation.inc} |
| 212 |
{$I x3dnodes_standard_interpolation_cubic_bezier.inc} |
| 213 |
{$I x3dnodes_standard_pointingdevicesensor.inc} |
| 214 |
{$I x3dnodes_standard_keydevicesensor.inc} |
| 215 |
{$I x3dnodes_standard_environmentalsensor.inc} |
| 216 |
{$I x3dnodes_standard_navigation.inc} |
| 217 |
{$I x3dnodes_standard_environmentaleffects.inc} |
| 218 |
{$I x3dnodes_standard_h-anim.inc} |
| 219 |
{$I x3dnodes_standard_nurbs.inc} |
| 220 |
{$I x3dnodes_standard_scripting.inc} |
| 221 |
{$I x3dnodes_standard_eventutilities.inc} |
| 222 |
{$I x3dnodes_standard_shaders.inc} |
| 223 |
{$I x3dnodes_standard_cadgeometry.inc} |
| 224 |
{$I x3dnodes_standard_texturing3d.inc} |
| 225 |
{$I x3dnodes_standard_cubemaptexturing.inc} |
| 226 |
|
| 227 |
{ More X3D nodes, not from X3D standard } |
| 228 |
{$I x3dnodes_1.inc} |
| 229 |
{$I x3dnodes_inventor.inc} |
| 230 |
{$I x3dnodes_97_hanim.inc} |
| 231 |
{$I x3dnodes_castle.inc} |
| 232 |
{$I x3dnodes_instantreality.inc} |
| 233 |
|
| 234 |
{$I x3dnodes_x3dunknownnode.inc} |
| 235 |
{$I x3dnodes_x3dinterfacedeclaration.inc} |
| 236 |
{$I x3dnodes_prototypes.inc} |
| 237 |
{$I x3dnodes_x3droute.inc} |
| 238 |
{$I x3dnodes_importexport.inc} |
| 239 |
{$I x3dnodes_eventsengine.inc} |
| 240 |
{$I x3dnodes_names.inc} |
| 241 |
{$I x3dnodes_load.inc} |
| 242 |
|
| 243 |
{$I x3dnodes_nodesmanager.inc} |
| 244 |
{$I x3dnodes_encoding_classic.inc} |
| 245 |
{$I x3dnodes_encoding_xml.inc} |
| 246 |
{$I x3dnodes_save.inc} |
| 247 |
{$I x3dnodes_miscellaneous_globals.inc} |
| 248 |
|
| 249 |
{$undef read_interface} |
| 250 |
|
| 251 |
implementation |
| 252 |
|
| 253 |
uses Math, StrUtils, URIParser, |
| 254 |
CastleTextureFont_Default3d_Sans, |
| 255 |
X3DLoad, CastleInternalZStream, X3DCameraUtils, |
| 256 |
CastleFilesUtils, CastleUriUtils, CastleUnicode, CastleCurves, |
| 257 |
CastleLog, CastleScriptParser, CastleInternalDataUri, CastleDownload, |
| 258 |
CastleInternalNurbs, CastleQuaternions, CastleXmlUtils, CastleOpenDocument, |
| 259 |
CastleSoundBase, CastleTriangles, X3DLoadInternalUtils, CastleFileFilters, |
| 260 |
CastleApplicationProperties, CastleInternalNodesUnsupported; |
| 261 |
|
| 262 |
{$define read_implementation} |
| 263 |
|
| 264 |
{$I x3dnodes_miscellaneous_internals.inc} |
| 265 |
|
| 266 |
{$I x3dnodes_initial_types.inc} |
| 267 |
{$I x3dnodes_vrml1state.inc} |
| 268 |
{$I x3dnodes_lightinstance.inc} |
| 269 |
{$I x3dnodes_clipplane.inc} |
| 270 |
{$I x3dnodes_x3dgraphtraversestate.inc} |
| 271 |
{$I x3dnodes_destructionnotification.inc} |
| 272 |
{$I x3dnodes_x3dnodescache.inc} |
| 273 |
{$I x3dnodes_x3dfonttexturescache.inc} |
| 274 |
{$I x3dnodes_x3dnodeclasseslist.inc} |
| 275 |
|
| 276 |
{$I x3dnodes_utils_extrusion.inc} |
| 277 |
{$I x3dnodes_utils_elevationgrid.inc} |
| 278 |
{$I x3dnodes_utils_cone_cylinder.inc} |
| 279 |
{$I x3dnodes_utils_sphere.inc} |
| 280 |
{$I x3dnodes_utils_box.inc} |
| 281 |
{$I x3dnodes_boundingboxes.inc} |
| 282 |
{$I x3dnodes_verticesandtrianglescounting.inc} |
| 283 |
{$I x3dnodes_coordpolygons.inc} |
| 284 |
{$I x3dnodes_eventsengine.inc} |
| 285 |
{$I x3dnodes_save.inc} |
| 286 |
{$I x3dnodes_load.inc} |
| 287 |
{$I x3dnodes_encoding_classic.inc} |
| 288 |
{$I x3dnodes_encoding_xml.inc} |
| 289 |
{$I x3dnodes_generatedtextures.inc} |
| 290 |
{$I x3dnodes_x3dunknownnode.inc} |
| 291 |
{$I x3dnodes_x3dinterfacedeclaration.inc} |
| 292 |
{$I x3dnodes_prototypes.inc} |
| 293 |
{$I x3dnodes_x3droute.inc} |
| 294 |
{$I x3dnodes_importexport.inc} |
| 295 |
{$I x3dnodes_names.inc} |
| 296 |
{$I x3dnodes_nodesmanager.inc} |
| 297 |
{$I x3dnodes_miscellaneous_globals.inc} |
| 298 |
{$I x3dnodes_utils_materials.inc} |
| 299 |
|
| 300 |
// These must be included after x3dnodes_encoding_{classic,xml}.inc |
| 301 |
{$I x3dnodes_x3dnode.inc} |
| 302 |
{$I x3dnodes_sfnode.inc} |
| 303 |
{$I x3dnodes_mfnode.inc} |
| 304 |
|
| 305 |
{ Nodes from standard X3D components } |
| 306 |
{$I x3dnodes_standard_core.inc} |
| 307 |
{$I x3dnodes_standard_time.inc} |
| 308 |
{$I x3dnodes_standard_grouping.inc} |
| 309 |
{$I x3dnodes_standard_networking.inc} |
| 310 |
{$I x3dnodes_standard_rendering.inc} |
| 311 |
{$I x3dnodes_standard_shape.inc} |
| 312 |
{$I x3dnodes_standard_geometry3d.inc} |
| 313 |
{$I x3dnodes_standard_geometry2d.inc} |
| 314 |
{$I x3dnodes_standard_text.inc} |
| 315 |
{$I x3dnodes_standard_sound.inc} |
| 316 |
{$I x3dnodes_standard_lighting.inc} |
| 317 |
{$I x3dnodes_standard_texturing.inc} |
| 318 |
{$I x3dnodes_standard_interpolation.inc} |
| 319 |
{$I x3dnodes_standard_interpolation_cubic_bezier.inc} |
| 320 |
{$I x3dnodes_standard_pointingdevicesensor.inc} |
| 321 |
{$I x3dnodes_standard_keydevicesensor.inc} |
| 322 |
{$I x3dnodes_standard_environmentalsensor.inc} |
| 323 |
{$I x3dnodes_standard_navigation.inc} |
| 324 |
{$I x3dnodes_standard_environmentaleffects.inc} |
| 325 |
{$I x3dnodes_standard_h-anim.inc} |
| 326 |
{$I x3dnodes_standard_nurbs.inc} |
| 327 |
{$I x3dnodes_standard_scripting.inc} |
| 328 |
{$I x3dnodes_standard_eventutilities.inc} |
| 329 |
{$I x3dnodes_standard_shaders.inc} |
| 330 |
{$I x3dnodes_standard_cadgeometry.inc} |
| 331 |
{$I x3dnodes_standard_texturing3d.inc} |
| 332 |
{$I x3dnodes_standard_cubemaptexturing.inc} |
| 333 |
|
| 334 |
{ More X3D nodes, not from X3D standard } |
| 335 |
{$I x3dnodes_1.inc} |
| 336 |
{$I x3dnodes_inventor.inc} |
| 337 |
{$I x3dnodes_97_hanim.inc} |
| 338 |
{$I x3dnodes_castle.inc} |
| 339 |
{$I x3dnodes_instantreality.inc} |
| 340 |
|
| 341 |
{ Auto-generated nodes code } |
| 342 |
{$I auto_generated_node_helpers/x3dnodes_abstractvrml1camera_1.inc} |
| 343 |
{$I auto_generated_node_helpers/x3dnodes_abstractvrml1geometry_1.inc} |
| 344 |
{$I auto_generated_node_helpers/x3dnodes_abstractvrml1indexed_1.inc} |
| 345 |
{$I auto_generated_node_helpers/x3dnodes_abstractvrml1separator_1.inc} |
| 346 |
{$I auto_generated_node_helpers/x3dnodes_abstractvrml1transformation_1.inc} |
| 347 |
{$I auto_generated_node_helpers/x3dnodes_anchor.inc} |
| 348 |
{$I auto_generated_node_helpers/x3dnodes_appearance.inc} |
| 349 |
{$I auto_generated_node_helpers/x3dnodes_arc2d.inc} |
| 350 |
{$I auto_generated_node_helpers/x3dnodes_arcclose2d.inc} |
| 351 |
{$I auto_generated_node_helpers/x3dnodes_asciitext_1.inc} |
| 352 |
{$I auto_generated_node_helpers/x3dnodes_audioclip.inc} |
| 353 |
{$I auto_generated_node_helpers/x3dnodes_background.inc} |
| 354 |
{$I auto_generated_node_helpers/x3dnodes_blendmode.inc} |
| 355 |
{$I auto_generated_node_helpers/x3dnodes_booleanfilter.inc} |
| 356 |
{$I auto_generated_node_helpers/x3dnodes_booleansequencer.inc} |
| 357 |
{$I auto_generated_node_helpers/x3dnodes_booleantoggle.inc} |
| 358 |
{$I auto_generated_node_helpers/x3dnodes_booleantrigger.inc} |
| 359 |
{$I auto_generated_node_helpers/x3dnodes_box.inc} |
| 360 |
{$I auto_generated_node_helpers/x3dnodes_cadassembly.inc} |
| 361 |
{$I auto_generated_node_helpers/x3dnodes_cadface.inc} |
| 362 |
{$I auto_generated_node_helpers/x3dnodes_cadlayer.inc} |
| 363 |
{$I auto_generated_node_helpers/x3dnodes_cadpart.inc} |
| 364 |
{$I auto_generated_node_helpers/x3dnodes_circle2d.inc} |
| 365 |
{$I auto_generated_node_helpers/x3dnodes_clipplane.inc} |
| 366 |
{$I auto_generated_node_helpers/x3dnodes_color.inc} |
| 367 |
{$I auto_generated_node_helpers/x3dnodes_colorinterpolator.inc} |
| 368 |
{$I auto_generated_node_helpers/x3dnodes_colorrgba.inc} |
| 369 |
{$I auto_generated_node_helpers/x3dnodes_colorsetinterpolator.inc} |
| 370 |
{$I auto_generated_node_helpers/x3dnodes_commonsurfaceshader.inc} |
| 371 |
{$I auto_generated_node_helpers/x3dnodes_composedcubemaptexture.inc} |
| 372 |
{$I auto_generated_node_helpers/x3dnodes_composedshader.inc} |
| 373 |
{$I auto_generated_node_helpers/x3dnodes_composedtexture3d.inc} |
| 374 |
{$I auto_generated_node_helpers/x3dnodes_cone.inc} |
| 375 |
{$I auto_generated_node_helpers/x3dnodes_cone_1.inc} |
| 376 |
{$I auto_generated_node_helpers/x3dnodes_contour2d.inc} |
| 377 |
{$I auto_generated_node_helpers/x3dnodes_contourpolyline2d.inc} |
| 378 |
{$I auto_generated_node_helpers/x3dnodes_converter.inc} |
| 379 |
{$I auto_generated_node_helpers/x3dnodes_coordinate.inc} |
| 380 |
{$I auto_generated_node_helpers/x3dnodes_coordinate3_1.inc} |
| 381 |
{$I auto_generated_node_helpers/x3dnodes_coordinatedouble.inc} |
| 382 |
{$I auto_generated_node_helpers/x3dnodes_coordinateinterpolator.inc} |
| 383 |
{$I auto_generated_node_helpers/x3dnodes_coordinateinterpolator2d.inc} |
| 384 |
{$I auto_generated_node_helpers/x3dnodes_cube_1.inc} |
| 385 |
{$I auto_generated_node_helpers/x3dnodes_cubicbezier2dorientationinterpolator.inc} |
| 386 |
{$I auto_generated_node_helpers/x3dnodes_cubicbeziercoordinateinterpolator.inc} |
| 387 |
{$I auto_generated_node_helpers/x3dnodes_cubicbezierpositioninterpolator.inc} |
| 388 |
{$I auto_generated_node_helpers/x3dnodes_cylinder.inc} |
| 389 |
{$I auto_generated_node_helpers/x3dnodes_cylinder_1.inc} |
| 390 |
{$I auto_generated_node_helpers/x3dnodes_cylindersensor.inc} |
| 391 |
{$I auto_generated_node_helpers/x3dnodes_directionallight.inc} |
| 392 |
{$I auto_generated_node_helpers/x3dnodes_directionallight_1.inc} |
| 393 |
{$I auto_generated_node_helpers/x3dnodes_disk2d.inc} |
| 394 |
{$I auto_generated_node_helpers/x3dnodes_easeineaseout.inc} |
| 395 |
{$I auto_generated_node_helpers/x3dnodes_effect.inc} |
| 396 |
{$I auto_generated_node_helpers/x3dnodes_effectpart.inc} |
| 397 |
{$I auto_generated_node_helpers/x3dnodes_elevationgrid.inc} |
| 398 |
{$I auto_generated_node_helpers/x3dnodes_environment.inc} |
| 399 |
{$I auto_generated_node_helpers/x3dnodes_environmentlight.inc} |
| 400 |
{$I auto_generated_node_helpers/x3dnodes_extrusion.inc} |
| 401 |
{$I auto_generated_node_helpers/x3dnodes_fillproperties.inc} |
| 402 |
{$I auto_generated_node_helpers/x3dnodes_floatvertexattribute.inc} |
| 403 |
{$I auto_generated_node_helpers/x3dnodes_fog.inc} |
| 404 |
{$I auto_generated_node_helpers/x3dnodes_fogcoordinate.inc} |
| 405 |
{$I auto_generated_node_helpers/x3dnodes_fontstyle.inc} |
| 406 |
{$I auto_generated_node_helpers/x3dnodes_generatedcubemaptexture.inc} |
| 407 |
{$I auto_generated_node_helpers/x3dnodes_generatedshadowmap.inc} |
| 408 |
{$I auto_generated_node_helpers/x3dnodes_group.inc} |
| 409 |
{$I auto_generated_node_helpers/x3dnodes_group_1.inc} |
| 410 |
{$I auto_generated_node_helpers/x3dnodes_hanimdisplacer.inc} |
| 411 |
{$I auto_generated_node_helpers/x3dnodes_hanimhumanoid.inc} |
| 412 |
{$I auto_generated_node_helpers/x3dnodes_hanimjoint.inc} |
| 413 |
{$I auto_generated_node_helpers/x3dnodes_hanimmotion.inc} |
| 414 |
{$I auto_generated_node_helpers/x3dnodes_hanimsegment.inc} |
| 415 |
{$I auto_generated_node_helpers/x3dnodes_hanimsite.inc} |
| 416 |
{$I auto_generated_node_helpers/x3dnodes_imagebackground.inc} |
| 417 |
{$I auto_generated_node_helpers/x3dnodes_imagecubemaptexture.inc} |
| 418 |
{$I auto_generated_node_helpers/x3dnodes_imagetexture.inc} |
| 419 |
{$I auto_generated_node_helpers/x3dnodes_imagetexture3d.inc} |
| 420 |
{$I auto_generated_node_helpers/x3dnodes_indexedfaceset.inc} |
| 421 |
{$I auto_generated_node_helpers/x3dnodes_indexedfaceset_1.inc} |
| 422 |
{$I auto_generated_node_helpers/x3dnodes_indexedlineset.inc} |
| 423 |
{$I auto_generated_node_helpers/x3dnodes_indexedlineset_1.inc} |
| 424 |
{$I auto_generated_node_helpers/x3dnodes_indexedquadset.inc} |
| 425 |
{$I auto_generated_node_helpers/x3dnodes_indexedtrianglefanset.inc} |
| 426 |
{$I auto_generated_node_helpers/x3dnodes_indexedtrianglemesh_1.inc} |
| 427 |
{$I auto_generated_node_helpers/x3dnodes_indexedtriangleset.inc} |
| 428 |
{$I auto_generated_node_helpers/x3dnodes_indexedtrianglestripset.inc} |
| 429 |
{$I auto_generated_node_helpers/x3dnodes_info_1.inc} |
| 430 |
{$I auto_generated_node_helpers/x3dnodes_inline.inc} |
| 431 |
{$I auto_generated_node_helpers/x3dnodes_inlineloadcontrol.inc} |
| 432 |
{$I auto_generated_node_helpers/x3dnodes_integersequencer.inc} |
| 433 |
{$I auto_generated_node_helpers/x3dnodes_integertrigger.inc} |
| 434 |
{$I auto_generated_node_helpers/x3dnodes_kambiappearance.inc} |
| 435 |
{$I auto_generated_node_helpers/x3dnodes_kambiinline.inc} |
| 436 |
{$I auto_generated_node_helpers/x3dnodes_kambinavigationinfo.inc} |
| 437 |
{$I auto_generated_node_helpers/x3dnodes_keysensor.inc} |
| 438 |
{$I auto_generated_node_helpers/x3dnodes_lineproperties.inc} |
| 439 |
{$I auto_generated_node_helpers/x3dnodes_lineset.inc} |
| 440 |
{$I auto_generated_node_helpers/x3dnodes_loadsensor.inc} |
| 441 |
{$I auto_generated_node_helpers/x3dnodes_localfog.inc} |
| 442 |
{$I auto_generated_node_helpers/x3dnodes_lod_1.inc} |
| 443 |
{$I auto_generated_node_helpers/x3dnodes_logger.inc} |
| 444 |
{$I auto_generated_node_helpers/x3dnodes_material.inc} |
| 445 |
{$I auto_generated_node_helpers/x3dnodes_material_1.inc} |
| 446 |
{$I auto_generated_node_helpers/x3dnodes_matrix3vertexattribute.inc} |
| 447 |
{$I auto_generated_node_helpers/x3dnodes_matrix4vertexattribute.inc} |
| 448 |
{$I auto_generated_node_helpers/x3dnodes_matrixtransform.inc} |
| 449 |
{$I auto_generated_node_helpers/x3dnodes_matrixtransform_1.inc} |
| 450 |
{$I auto_generated_node_helpers/x3dnodes_metadataboolean.inc} |
| 451 |
{$I auto_generated_node_helpers/x3dnodes_metadatadouble.inc} |
| 452 |
{$I auto_generated_node_helpers/x3dnodes_metadatafloat.inc} |
| 453 |
{$I auto_generated_node_helpers/x3dnodes_metadatainteger.inc} |
| 454 |
{$I auto_generated_node_helpers/x3dnodes_metadataset.inc} |
| 455 |
{$I auto_generated_node_helpers/x3dnodes_metadatastring.inc} |
| 456 |
{$I auto_generated_node_helpers/x3dnodes_movietexture.inc} |
| 457 |
{$I auto_generated_node_helpers/x3dnodes_multigeneratedtexturecoordinate.inc} |
| 458 |
{$I auto_generated_node_helpers/x3dnodes_multitexture.inc} |
| 459 |
{$I auto_generated_node_helpers/x3dnodes_multitexturecoordinate.inc} |
| 460 |
{$I auto_generated_node_helpers/x3dnodes_multitexturetransform.inc} |
| 461 |
{$I auto_generated_node_helpers/x3dnodes_normal.inc} |
| 462 |
{$I auto_generated_node_helpers/x3dnodes_normalinterpolator.inc} |
| 463 |
{$I auto_generated_node_helpers/x3dnodes_nurbscurve.inc} |
| 464 |
{$I auto_generated_node_helpers/x3dnodes_nurbscurve2d.inc} |
| 465 |
{$I auto_generated_node_helpers/x3dnodes_nurbsorientationinterpolator.inc} |
| 466 |
{$I auto_generated_node_helpers/x3dnodes_nurbspatchsurface.inc} |
| 467 |
{$I auto_generated_node_helpers/x3dnodes_nurbspositioninterpolator.inc} |
| 468 |
{$I auto_generated_node_helpers/x3dnodes_nurbsset.inc} |
| 469 |
{$I auto_generated_node_helpers/x3dnodes_nurbssurfaceinterpolator.inc} |
| 470 |
{$I auto_generated_node_helpers/x3dnodes_nurbssweptsurface.inc} |
| 471 |
{$I auto_generated_node_helpers/x3dnodes_nurbsswungsurface.inc} |
| 472 |
{$I auto_generated_node_helpers/x3dnodes_nurbstexturecoordinate.inc} |
| 473 |
{$I auto_generated_node_helpers/x3dnodes_nurbstrimmedsurface.inc} |
| 474 |
{$I auto_generated_node_helpers/x3dnodes_orientationinterpolator.inc} |
| 475 |
{$I auto_generated_node_helpers/x3dnodes_orientationinterpolator2d.inc} |
| 476 |
{$I auto_generated_node_helpers/x3dnodes_orthographiccamera_1.inc} |
| 477 |
{$I auto_generated_node_helpers/x3dnodes_packagedshader.inc} |
| 478 |
{$I auto_generated_node_helpers/x3dnodes_perspectivecamera_1.inc} |
| 479 |
{$I auto_generated_node_helpers/x3dnodes_physicalmaterial.inc} |
| 480 |
{$I auto_generated_node_helpers/x3dnodes_pixeltexture.inc} |
| 481 |
{$I auto_generated_node_helpers/x3dnodes_pixeltexture3d.inc} |
| 482 |
{$I auto_generated_node_helpers/x3dnodes_plane.inc} |
| 483 |
{$I auto_generated_node_helpers/x3dnodes_planesensor.inc} |
| 484 |
{$I auto_generated_node_helpers/x3dnodes_pointlight.inc} |
| 485 |
{$I auto_generated_node_helpers/x3dnodes_pointlight_1.inc} |
| 486 |
{$I auto_generated_node_helpers/x3dnodes_pointset.inc} |
| 487 |
{$I auto_generated_node_helpers/x3dnodes_pointset_1.inc} |
| 488 |
{$I auto_generated_node_helpers/x3dnodes_polyline2d.inc} |
| 489 |
{$I auto_generated_node_helpers/x3dnodes_polypoint2d.inc} |
| 490 |
{$I auto_generated_node_helpers/x3dnodes_positioninterpolator.inc} |
| 491 |
{$I auto_generated_node_helpers/x3dnodes_positioninterpolator2d.inc} |
| 492 |
{$I auto_generated_node_helpers/x3dnodes_programshader.inc} |
| 493 |
{$I auto_generated_node_helpers/x3dnodes_projectedtexturecoordinate.inc} |
| 494 |
{$I auto_generated_node_helpers/x3dnodes_proximitysensor.inc} |
| 495 |
{$I auto_generated_node_helpers/x3dnodes_quadset.inc} |
| 496 |
{$I auto_generated_node_helpers/x3dnodes_rectangle2d.inc} |
| 497 |
{$I auto_generated_node_helpers/x3dnodes_renderedtexture.inc} |
| 498 |
{$I auto_generated_node_helpers/x3dnodes_rotation_1.inc} |
| 499 |
{$I auto_generated_node_helpers/x3dnodes_rotationxyz_1.inc} |
| 500 |
{$I auto_generated_node_helpers/x3dnodes_scalarinterpolator.inc} |
| 501 |
{$I auto_generated_node_helpers/x3dnodes_scale_1.inc} |
| 502 |
{$I auto_generated_node_helpers/x3dnodes_screeneffect.inc} |
| 503 |
{$I auto_generated_node_helpers/x3dnodes_script.inc} |
| 504 |
{$I auto_generated_node_helpers/x3dnodes_separator_1.inc} |
| 505 |
{$I auto_generated_node_helpers/x3dnodes_shaderpart.inc} |
| 506 |
{$I auto_generated_node_helpers/x3dnodes_shaderprogram.inc} |
| 507 |
{$I auto_generated_node_helpers/x3dnodes_shadertexture.inc} |
| 508 |
{$I auto_generated_node_helpers/x3dnodes_shape.inc} |
| 509 |
{$I auto_generated_node_helpers/x3dnodes_sound.inc} |
| 510 |
{$I auto_generated_node_helpers/x3dnodes_sphere.inc} |
| 511 |
{$I auto_generated_node_helpers/x3dnodes_sphere_1.inc} |
| 512 |
{$I auto_generated_node_helpers/x3dnodes_spheresensor.inc} |
| 513 |
{$I auto_generated_node_helpers/x3dnodes_splinepositioninterpolator.inc} |
| 514 |
{$I auto_generated_node_helpers/x3dnodes_splinepositioninterpolator2d.inc} |
| 515 |
{$I auto_generated_node_helpers/x3dnodes_splinescalarinterpolator.inc} |
| 516 |
{$I auto_generated_node_helpers/x3dnodes_spotlight.inc} |
| 517 |
{$I auto_generated_node_helpers/x3dnodes_spotlight_1.inc} |
| 518 |
{$I auto_generated_node_helpers/x3dnodes_squadorientationinterpolator.inc} |
| 519 |
{$I auto_generated_node_helpers/x3dnodes_staticgroup.inc} |
| 520 |
{$I auto_generated_node_helpers/x3dnodes_stringsensor.inc} |
| 521 |
{$I auto_generated_node_helpers/x3dnodes_switch.inc} |
| 522 |
{$I auto_generated_node_helpers/x3dnodes_switch_1.inc} |
| 523 |
{$I auto_generated_node_helpers/x3dnodes_tangent.inc} |
| 524 |
{$I auto_generated_node_helpers/x3dnodes_teapot.inc} |
| 525 |
{$I auto_generated_node_helpers/x3dnodes_text.inc} |
| 526 |
{$I auto_generated_node_helpers/x3dnodes_text3d.inc} |
| 527 |
{$I auto_generated_node_helpers/x3dnodes_texture2_1.inc} |
| 528 |
{$I auto_generated_node_helpers/x3dnodes_texture2transform_1.inc} |
| 529 |
{$I auto_generated_node_helpers/x3dnodes_texturebackground.inc} |
| 530 |
{$I auto_generated_node_helpers/x3dnodes_texturecoordinate.inc} |
| 531 |
{$I auto_generated_node_helpers/x3dnodes_texturecoordinate2_1.inc} |
| 532 |
{$I auto_generated_node_helpers/x3dnodes_texturecoordinate3d.inc} |
| 533 |
{$I auto_generated_node_helpers/x3dnodes_texturecoordinate4d.inc} |
| 534 |
{$I auto_generated_node_helpers/x3dnodes_texturecoordinategenerator.inc} |
| 535 |
{$I auto_generated_node_helpers/x3dnodes_textureproperties.inc} |
| 536 |
{$I auto_generated_node_helpers/x3dnodes_texturetransform.inc} |
| 537 |
{$I auto_generated_node_helpers/x3dnodes_texturetransform3d.inc} |
| 538 |
{$I auto_generated_node_helpers/x3dnodes_texturetransformmatrix3d.inc} |
| 539 |
{$I auto_generated_node_helpers/x3dnodes_timesensor.inc} |
| 540 |
{$I auto_generated_node_helpers/x3dnodes_timetrigger.inc} |
| 541 |
{$I auto_generated_node_helpers/x3dnodes_toggler.inc} |
| 542 |
{$I auto_generated_node_helpers/x3dnodes_touchsensor.inc} |
| 543 |
{$I auto_generated_node_helpers/x3dnodes_transform.inc} |
| 544 |
{$I auto_generated_node_helpers/x3dnodes_transform_1.inc} |
| 545 |
{$I auto_generated_node_helpers/x3dnodes_transformsensor.inc} |
| 546 |
{$I auto_generated_node_helpers/x3dnodes_transformseparator_1.inc} |
| 547 |
{$I auto_generated_node_helpers/x3dnodes_translation_1.inc} |
| 548 |
{$I auto_generated_node_helpers/x3dnodes_trianglefanset.inc} |
| 549 |
{$I auto_generated_node_helpers/x3dnodes_triangleset.inc} |
| 550 |
{$I auto_generated_node_helpers/x3dnodes_triangleset2d.inc} |
| 551 |
{$I auto_generated_node_helpers/x3dnodes_trianglestripset.inc} |
| 552 |
{$I auto_generated_node_helpers/x3dnodes_twosidedmaterial.inc} |
| 553 |
{$I auto_generated_node_helpers/x3dnodes_unlitmaterial.inc} |
| 554 |
{$I auto_generated_node_helpers/x3dnodes_valuetrigger.inc} |
| 555 |
{$I auto_generated_node_helpers/x3dnodes_vectorinterpolator.inc} |
| 556 |
{$I auto_generated_node_helpers/x3dnodes_viewpointmirror.inc} |
| 557 |
{$I auto_generated_node_helpers/x3dnodes_visibilitysensor.inc} |
| 558 |
{$I auto_generated_node_helpers/x3dnodes_worldinfo.inc} |
| 559 |
{$I auto_generated_node_helpers/x3dnodes_wwwanchor_1.inc} |
| 560 |
{$I auto_generated_node_helpers/x3dnodes_wwwinline_1.inc} |
| 561 |
{$I auto_generated_node_helpers/x3dnodes_x3d3dbackgroundnode.inc} |
| 562 |
{$I auto_generated_node_helpers/x3dnodes_x3dappearancechildnode.inc} |
| 563 |
{$I auto_generated_node_helpers/x3dnodes_x3dappearancenode.inc} |
| 564 |
{$I auto_generated_node_helpers/x3dnodes_x3dbackgroundnode.inc} |
| 565 |
{$I auto_generated_node_helpers/x3dnodes_x3dbindablenode.inc} |
| 566 |
{$I auto_generated_node_helpers/x3dnodes_x3dchildnode.inc} |
| 567 |
{$I auto_generated_node_helpers/x3dnodes_x3dcolornode.inc} |
| 568 |
{$I auto_generated_node_helpers/x3dnodes_x3dcomposedgeometrynode.inc} |
| 569 |
{$I auto_generated_node_helpers/x3dnodes_x3dcoordinatenode.inc} |
| 570 |
{$I auto_generated_node_helpers/x3dnodes_x3dcubicbezierinterpolator.inc} |
| 571 |
{$I auto_generated_node_helpers/x3dnodes_x3ddirectionallightnode.inc} |
| 572 |
{$I auto_generated_node_helpers/x3dnodes_x3ddragsensornode.inc} |
| 573 |
{$I auto_generated_node_helpers/x3dnodes_x3denvironmentalsensornode.inc} |
| 574 |
{$I auto_generated_node_helpers/x3dnodes_x3denvironmenttexturenode.inc} |
| 575 |
{$I auto_generated_node_helpers/x3dnodes_x3dfontstylenode.inc} |
| 576 |
{$I auto_generated_node_helpers/x3dnodes_x3dgeometricpropertynode.inc} |
| 577 |
{$I auto_generated_node_helpers/x3dnodes_x3dgeometrynode.inc} |
| 578 |
{$I auto_generated_node_helpers/x3dnodes_x3dgroupingnode.inc} |
| 579 |
{$I auto_generated_node_helpers/x3dnodes_x3dinfonode.inc} |
| 580 |
{$I auto_generated_node_helpers/x3dnodes_x3dinterpolatornode.inc} |
| 581 |
{$I auto_generated_node_helpers/x3dnodes_x3dkeydevicesensornode.inc} |
| 582 |
{$I auto_generated_node_helpers/x3dnodes_x3dlightnode.inc} |
| 583 |
{$I auto_generated_node_helpers/x3dnodes_x3dmaterialnode.inc} |
| 584 |
{$I auto_generated_node_helpers/x3dnodes_x3dmetadatanode.inc} |
| 585 |
{$I auto_generated_node_helpers/x3dnodes_x3dnetworksensornode.inc} |
| 586 |
{$I auto_generated_node_helpers/x3dnodes_x3dnode.inc} |
| 587 |
{$I auto_generated_node_helpers/x3dnodes_x3dnormalnode.inc} |
| 588 |
{$I auto_generated_node_helpers/x3dnodes_x3dnurbscontrolcurvenode.inc} |
| 589 |
{$I auto_generated_node_helpers/x3dnodes_x3dnurbssurfacegeometrynode.inc} |
| 590 |
{$I auto_generated_node_helpers/x3dnodes_x3donesidedmaterialnode.inc} |
| 591 |
{$I auto_generated_node_helpers/x3dnodes_x3dparametricgeometrynode.inc} |
| 592 |
{$I auto_generated_node_helpers/x3dnodes_x3dpointingdevicesensornode.inc} |
| 593 |
{$I auto_generated_node_helpers/x3dnodes_x3dpointlightnode.inc} |
| 594 |
{$I auto_generated_node_helpers/x3dnodes_x3dpositionallightnode.inc} |
| 595 |
{$I auto_generated_node_helpers/x3dnodes_x3dproductstructurechildnode.inc} |
| 596 |
{$I auto_generated_node_helpers/x3dnodes_x3dpunctuallightnode.inc} |
| 597 |
{$I auto_generated_node_helpers/x3dnodes_x3dscriptnode.inc} |
| 598 |
{$I auto_generated_node_helpers/x3dnodes_x3dsensornode.inc} |
| 599 |
{$I auto_generated_node_helpers/x3dnodes_x3dsequencernode.inc} |
| 600 |
{$I auto_generated_node_helpers/x3dnodes_x3dshadernode.inc} |
| 601 |
{$I auto_generated_node_helpers/x3dnodes_x3dshapenode.inc} |
| 602 |
{$I auto_generated_node_helpers/x3dnodes_x3dsingletexturecoordinatenode.inc} |
| 603 |
{$I auto_generated_node_helpers/x3dnodes_x3dsingletexturenode.inc} |
| 604 |
{$I auto_generated_node_helpers/x3dnodes_x3dsingletexturetransformnode.inc} |
| 605 |
{$I auto_generated_node_helpers/x3dnodes_x3dsoundnode.inc} |
| 606 |
{$I auto_generated_node_helpers/x3dnodes_x3dsoundsourcenode.inc} |
| 607 |
{$I auto_generated_node_helpers/x3dnodes_x3dtexture2dnode.inc} |
| 608 |
{$I auto_generated_node_helpers/x3dnodes_x3dtexture3dnode.inc} |
| 609 |
{$I auto_generated_node_helpers/x3dnodes_x3dtexturecoordinatenode.inc} |
| 610 |
{$I auto_generated_node_helpers/x3dnodes_x3dtexturenode.inc} |
| 611 |
{$I auto_generated_node_helpers/x3dnodes_x3dtexturetransformnode.inc} |
| 612 |
{$I auto_generated_node_helpers/x3dnodes_x3dtimedependentnode.inc} |
| 613 |
{$I auto_generated_node_helpers/x3dnodes_x3dtouchsensornode.inc} |
| 614 |
{$I auto_generated_node_helpers/x3dnodes_x3dtriggernode.inc} |
| 615 |
{$I auto_generated_node_helpers/x3dnodes_x3dvertexattributenode.inc} |
| 616 |
|
| 617 |
{$warnings off} // uses deprecated constants like FSFAMILY_SERIF, we don't really plan to update it -- whole VRML 1 is deprecated |
| 618 |
{$I auto_generated_node_helpers/x3dnodes_fontstyle_1.inc} |
| 619 |
{$I auto_generated_node_helpers/x3dnodes_materialbinding_1.inc} |
| 620 |
{$I auto_generated_node_helpers/x3dnodes_normalbinding_1.inc} |
| 621 |
{$I auto_generated_node_helpers/x3dnodes_shapehints_1.inc} |
| 622 |
{$warnings on} |
| 623 |
|
| 624 |
{ unit init/fini ------------------------------------------------------------ } |
| 625 |
|
| 626 |
procedure X3DNodesFinalization; |
| 627 |
begin |
| 628 |
FreeAndNil(VRML1DefaultState); |
| 629 |
FreeAndNil(TraverseSingleStack); |
| 630 |
TextureCache := nil; |
| 631 |
FreeAndNil(X3DCache); |
| 632 |
|
| 633 |
FreeAndNil(NodesManager); |
| 634 |
FreeAndNil(AnyNodeDestructionNotifications); |
| 635 |
|
| 636 |
FreeAndNil(CurrentlyLoading); |
| 637 |
|
| 638 |
FontsFinalization; |
| 639 |
end; |
| 640 |
|
| 641 |
procedure RegisterVrmlX3dModelFormat; |
| 642 |
var |
| 643 |
ModelFormat: TModelFormat; |
| 644 |
begin |
| 645 |
ModelFormat := TModelFormat.Create; |
| 646 |
ModelFormat.OnLoad := {$ifdef FPC}@{$endif} LoadX3DClassicInternal; |
| 647 |
{ We don't advertise to users we can save Inventor, although we're close |
| 648 |
to being able to do it, since we save VRML 1.0. |
| 649 |
But it's not something we want to maintain, Inventor is really ancient. } |
| 650 |
//ModelFormat.OnSave := {$ifdef FPC}@{$endif} SaveX3DClassic; |
| 651 |
ModelFormat.MimeTypes.Add('application/x-inventor'); |
| 652 |
ModelFormat.FileFilterName := 'Inventor (*.iv)'; |
| 653 |
ModelFormat.Extensions.Add('.iv'); |
| 654 |
RegisterModelFormat(ModelFormat); |
| 655 |
|
| 656 |
ModelFormat := TModelFormat.Create; |
| 657 |
ModelFormat.OnLoad := {$ifdef FPC}@{$endif} LoadX3DClassicInternal; |
| 658 |
ModelFormat.OnSave := {$ifdef FPC}@{$endif} SaveX3DClassic; |
| 659 |
ModelFormat.MimeTypes.Add('model/vrml'); |
| 660 |
ModelFormat.FileFilterName := 'VRML (*.wrl, *.wrl.gz, *.wrz)'; |
| 661 |
ModelFormat.Extensions.Add('.wrl'); |
| 662 |
ModelFormat.Extensions.Add('.wrl.gz'); |
| 663 |
ModelFormat.Extensions.Add('.wrz'); |
| 664 |
RegisterModelFormat(ModelFormat); |
| 665 |
|
| 666 |
ModelFormat := TModelFormat.Create; |
| 667 |
ModelFormat.OnLoad := {$ifdef FPC}@{$endif} LoadX3DClassicInternal; |
| 668 |
ModelFormat.OnSave := {$ifdef FPC}@{$endif} SaveX3DClassicForceX3D; |
| 669 |
ModelFormat.MimeTypes.Add('model/x3d+vrml'); |
| 670 |
ModelFormat.FileFilterName := 'X3D classic (*.x3dv, *.x3dvz, *.x3dv.gz)'; |
| 671 |
ModelFormat.Extensions.Add('.x3dv'); |
| 672 |
ModelFormat.Extensions.Add('.x3dvz'); |
| 673 |
ModelFormat.Extensions.Add('.x3dv.gz'); |
| 674 |
RegisterModelFormat(ModelFormat); |
| 675 |
|
| 676 |
ModelFormat := TModelFormat.Create; |
| 677 |
ModelFormat.OnLoad := {$ifdef FPC}@{$endif} LoadX3DXmlInternal; |
| 678 |
ModelFormat.OnSave := {$ifdef FPC}@{$endif} SaveX3DXml; |
| 679 |
ModelFormat.MimeTypes.Add('model/x3d+xml'); |
| 680 |
ModelFormat.FileFilterName := 'X3D XML (*.x3d, *.x3dz, *.x3d.gz)'; |
| 681 |
ModelFormat.Extensions.Add('.x3d'); |
| 682 |
ModelFormat.Extensions.Add('.x3dz'); |
| 683 |
ModelFormat.Extensions.Add('.x3d.gz'); |
| 684 |
{ Testcases: Run on Android and play game: |
| 685 |
https://github.com/castle-engine/little-things |
| 686 |
https://github.com/castle-engine/darkest-before-dawn |
| 687 |
|
| 688 |
Opening a xxx.x3d.gz file on Android with OnLoadForceMemoryStream=false |
| 689 |
would fail, with "Illegal at document level" error (from FPC XML parsing units), |
| 690 |
testing with FPC 3.2.2 on Android/Arm . |
| 691 |
On Android, in this case we read file through Android assets and then through |
| 692 |
TGZFileStream (even though .gz file is no longer compressed, |
| 693 |
packing into APK actually decompressed it; still reading through TGZFileStream |
| 694 |
is OK, and tests confirm that TGZFileStream returns correct, valid XML contents). |
| 695 |
|
| 696 |
We assume it works on desktop with OnLoadForceMemoryStream=false |
| 697 |
only because on desktop, TFileStream (returned for files by default) |
| 698 |
is already seekable. } |
| 699 |
ModelFormat.OnLoadForceMemoryStream := true; |
| 700 |
RegisterModelFormat(ModelFormat); |
| 701 |
end; |
| 702 |
|
| 703 |
initialization |
| 704 |
AnyNodeDestructionNotifications := TNodeDestructionNotificationList.Create; |
| 705 |
|
| 706 |
X3DFieldsManager.RegisterClasses([TSFNode, TMFNode]); |
| 707 |
|
| 708 |
NodesManager := TNodesManager.Create; |
| 709 |
|
| 710 |
RegistedInventorNodes; |
| 711 |
RegisterVRML1Nodes; |
| 712 |
RegisterVRML97HAnimNodes; |
| 713 |
RegisterKambiNodes; |
| 714 |
RegisterInstantRealityNodes; |
| 715 |
|
| 716 |
{ X3D components registration : } |
| 717 |
|
| 718 |
RegisterCoreNodes; |
| 719 |
RegisterTimeNodes; |
| 720 |
RegisterNetworkingNodes; |
| 721 |
RegisterGroupingNodes; |
| 722 |
RegisterRenderingNodes; |
| 723 |
RegisterShapeNodes; |
| 724 |
RegisterGeometry3DNodes; |
| 725 |
RegisterGeometry2DNodes; |
| 726 |
RegisterTextNodes; |
| 727 |
RegisterSoundNodes; |
| 728 |
RegisterLightingNodes; |
| 729 |
RegisterTexturingNodes; |
| 730 |
RegisterInterpolationNodes; |
| 731 |
RegisterInterpolationCubicBezierNodes; |
| 732 |
RegisterPointingDeviceSensorNodes; |
| 733 |
RegisterKeyDeviceSensorNodes; |
| 734 |
RegisterEnvironmentalSensorNodes; |
| 735 |
RegisterNavigationNodes; |
| 736 |
RegisterEnvironmentalEffectsNodes; |
| 737 |
RegisterHAnimNodes; |
| 738 |
RegisterNURBSNodes; |
| 739 |
RegisterScriptingNodes; |
| 740 |
RegisterEventUtilitiesNodes; |
| 741 |
RegisterShadersNodes; |
| 742 |
RegisterCADGeometryNodes; |
| 743 |
RegisterTexturing3DNodes; |
| 744 |
RegisterCubeMapTexturingNodes; |
| 745 |
|
| 746 |
RegisterUnsupportedNodes; |
| 747 |
|
| 748 |
X3DCache := TX3DFontTexturesCache.Create; |
| 749 |
TextureCache := X3DCache; |
| 750 |
VRML1DefaultState := TVRML1State.Create; |
| 751 |
VRML1DefaultState.CreateNodes; |
| 752 |
TraverseSingleStack := TX3DGraphTraverseStateStack.Create; |
| 753 |
|
| 754 |
CurrentlyLoading := TCastleStringList.Create; |
| 755 |
|
| 756 |
FontsInitialization; |
| 757 |
|
| 758 |
RegisterVrmlX3dModelFormat; |
| 759 |
finalization |
| 760 |
{ Because of various finalization order (some stuff may be owned |
| 761 |
e.g. by CastleWindow.Application, and freed at CastleWindow finalization, |
| 762 |
which may be done after X3DNodes finalization) we may defer |
| 763 |
finalization for later. } |
| 764 |
if (X3DCache = nil) or X3DCache.Empty then |
| 765 |
X3DNodesFinalization |
| 766 |
else |
| 767 |
X3DCache.OnEmpty := @X3DNodesFinalization; |
| 768 |
end. |
| 769 |
|