Debian Codegraph @

tools/internal/x3d-nodes-to-pascal/README.txt

raw
1 The nodes-specification/ subdirectory contains X3D nodes description
2 in a simple text format (similar to what is used in X3D specifications).
3 This is an input to the x3d-nodes-to-pascal program.
4
5 x3d-nodes-to-pascal
6
7 1. Generates some helper methods and properties,
8 and places them in the ../../../src/x3d/auto_generated_node_helpers/
9 directory.
10 These files are never edited manually.
11 So you can rerun x3d-nodes-to-pascal as often as you want.
12 Like this:
13
14 castle-engine compile
15 ./run.sh
16
17 2. x3d-nodes-to-pascal can also generate "starting templates" to define
18 an Object Pascal class that defines given X3D node.
19 These "starting templates" were used when creating the X3DNodes unit,
20 but they require manual adjustment,
21 and we try to limit their usage in the future.
22
23 ------------------------------------------------------------------------------
24 Historical notes how the initial files in nodes-specification/ were created:
25
26 - Originally, this was created by hand, simply pasting from X3D specification.
27
28 (It was much easier to just paste it and then process with simple Pascal program
29 than to dive into processing X3D Schema with XSLT.)
30
31 Some modifications were done to process it easier:
32 Unicode symbols replaced with "Inf", "Pi" and "-".
33 Every field on a single line.
34 "# And any number of" minimized to a single line.
35
36 - Next step was to decide which X3D node classes have to be implemented as
37 Pascal interfaces. Preferably, these should have as few fields as possible,
38 so that the interfaces act only to check "is" relationships, and casting
39 to interfaces is not necessary (giving current interfaces state in FPC,
40 casting "as" interfaces can be troublesome;
41 more important, class inheritance allows
42 me to reuse implementation, so it's preferred).
43
44 Looking at X3D inheritance graph, this is easy: X3D classes marked
45 as (xxx)* have to be Pascal interfaces.
46
47 Nodes marked as "XxxObject" are Pascal interfaces, and only
48 Pascal interfaces.
49
50 I decided to not change X3D inheritance
51 (For example, I could make X3DMetadataObject a normal
52 class, descending from X3DNode, and stil keep all "is"
53 relationships. But, for the future, it's better to stick to X3D inheritance.)
54
55 Classes marked as "XxxNode" that are never mentioned as
56 secondary ancestor are only Pascal classes.
57
58 Classes marked sometimes as secondary and sometimes as primary ancestors
59 need to be implemented as both Pascal classes and interfaces.
60 The distinction between primary/secondary is arbitrary (actually,
61 just like written in X3D spec, but this is actually alphabetical...).
62 For example, X3DGroupingNode and X3DSensorNode are both valid
63 ancestors for various nodes. Only time will tell which one is more
64 suitable as ancestor to implement...
65
66 - In the next step, everything that can be obtained through inheritance
67 (from normal classes, not interfaces) is removed.
68 Also various small errors in X3D spec fixed (non-existing X3DColorObject
69 replaced with X3DColorNode, also some missing fields (available
70 through inheritance, but not listed in spec explicitly) will
71 be available in our engine --- that's the idea of X3D spec anyway).
72
73 This is what will be processed to produce actual Pascal code.