1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
3 | <!-- ENTITY, ELEMENT and ATTLIST definitions are listed in detail within the DOCTYPE declaration internal subset. --> |
4 | <!-- You must view full source of the DTD declarations (QuadTreeExamples.x3d.txt) to fully understand this file. --> |
5 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
6 | <head> |
7 | <meta name='title' content='QuadTreeExamples.x3d'/> |
8 | <meta name='creator' content='Don Brutzman'/> |
9 | <meta name='created' content='26 June 2000'/> |
10 | <meta name='modified' content='20 January 2020'/> |
11 | <meta name='description' content='Show four ways of solving the QuadTree problem using native XML tags, PROTOs, IDREF/USE and MFNode children compatibly - view XML source to see DTD internal-subset declarations.'/> |
12 | <meta name=' error ' content=' Test to demonstrate DOCTYPE extensibility, this X3D scene not valid and does not render. '/> |
13 | <meta name=' warning ' content=' You must view full source of the DTD declarations (QuadTreeExamples.x3d.txt) to fully understand validation techniques in this file. '/> |
14 | <meta name='reference' content='QuadTreeExamplesExplanation.html'/> |
15 | <meta name='reference' content='QuadTreeExamples.x3d.txt'/> |
16 | <meta name='reference' content='QuadTreeExamples.png'/> |
17 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/development/QuadTreeExamples.x3d'/> |
18 | <meta name='generator' content='X3D-Edit 3.1, https://www.web3d.org/x3d/content/README.X3D-Edit.html'/> |
19 | <meta name='license' content='../license.html'/> |
20 | </head> |
21 | <Scene> |
22 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
23 | <!-- Example solution approach #1 --> |
24 | <!-- Note that PROTO declarations are also provided for compatible backwards translation to VRML 97 encoding. They are not necessary for independent X3D use of the QuadTree examples. --> |
25 | <ProtoDeclare name='QuadTree-USEchildren'> |
26 | <ProtoInterface> |
27 | <field name='upperLeftDEFName' type='MFNode' accessType='inputOutput'/> |
28 | <field name='upperRightDEFName' type='MFNode' accessType='inputOutput'/> |
29 | <field name='lowerLeftDEFName' type='MFNode' accessType='inputOutput'/> |
30 | <field name='lowerRightDEFName' type='MFNode' accessType='inputOutput'/> |
31 | <field name='children' type='MFNode' accessType='inputOutput'/> |
32 | <!-- children field must be declared for any PROTOs or native-tag nodes with children --> |
33 | </ProtoInterface> |
34 | <ProtoBody> |
35 | <!-- VRML 97 specification paragraph 4.8.3, PROTO definition semantics: "A prototype definition consists of one or more nodes." PROTO body follows. --> |
36 | <Group> |
37 | <Group DEF='GroupA'> |
38 | <IS> |
39 | <connect nodeField='children' protoField='upperLeftDEFName'/> |
40 | </IS> |
41 | </Group> |
42 | <Group DEF='GroupB'> |
43 | <IS> |
44 | <connect nodeField='children' protoField='upperRightDEFName'/> |
45 | </IS> |
46 | </Group> |
47 | <Group DEF='GroupC'> |
48 | <IS> |
49 | <connect nodeField='children' protoField='lowerLeftDEFName'/> |
50 | </IS> |
51 | </Group> |
52 | <Group DEF='GroupD'> |
53 | <IS> |
54 | <connect nodeField='children' protoField='lowerRightDEFName'/> |
55 | </IS> |
56 | </Group> |
57 | </Group> |
58 | </ProtoBody> |
59 | </ProtoDeclare> |
60 | <!-- Example solution approach #3 --> |
61 | <ProtoDeclare name='QuadTree-TagChildren'> |
62 | <ProtoInterface> |
63 | <field name='upperLeftNode' type='MFNode' accessType='inputOutput'> |
64 | <!-- no initialization node --> |
65 | </field> |
66 | <field name='upperRightNode' type='MFNode' accessType='inputOutput'> |
67 | <!-- no initialization node --> |
68 | </field> |
69 | <field name='lowerLeftNode' type='MFNode' accessType='inputOutput'> |
70 | <!-- no initialization node --> |
71 | </field> |
72 | <field name='lowerRightNode' type='MFNode' accessType='inputOutput'> |
73 | <!-- no initialization node --> |
74 | </field> |
75 | <field name='children' type='MFNode' accessType='inputOutput'/> |
76 | </ProtoInterface> |
77 | <ProtoBody> |
78 | <!-- PROTO body follows. --> |
79 | <Group> |
80 | <Group DEF='GroupE'> |
81 | <IS> |
82 | <connect nodeField='children' protoField='upperLeftNode'/> |
83 | </IS> |
84 | </Group> |
85 | <Group DEF='GroupF'> |
86 | <IS> |
87 | <connect nodeField='children' protoField='upperRightNode'/> |
88 | </IS> |
89 | </Group> |
90 | <Group DEF='GroupG'> |
91 | <IS> |
92 | <connect nodeField='children' protoField='lowerLeftNode'/> |
93 | </IS> |
94 | </Group> |
95 | <Group DEF='GroupH'> |
96 | <IS> |
97 | <connect nodeField='children' protoField='lowerRightNode'/> |
98 | </IS> |
99 | </Group> |
100 | </Group> |
101 | </ProtoBody> |
102 | </ProtoDeclare> |
103 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
104 | <Group> |
105 | <Viewpoint description='View QuadTree examples' position='0 0 30'/> |
106 | <Transform DEF='Example_1' translation='0 6 0'> |
107 | <ProtoInstance name='QuadTree-USEchildren'> |
108 | <fieldValue name='children'> |
109 | <Group> |
110 |
<!-- Transform
UPPER_LEFT is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
<Transform DEF='UPPER_LEFT' translation='4 0 4'> |
111 | <Shape> |
112 | <Appearance DEF='RED'> |
113 | <Material diffuseColor='1 0 0'/> |
114 | </Appearance> |
115 | <Box/> |
116 | </Shape> |
117 | </Transform> |
118 |
<!-- Transform
UPPER_RIGHT is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
<Transform DEF='UPPER_RIGHT' translation='3 0 -3'> |
119 | <Shape> |
120 | <Appearance DEF='GREEN'> |
121 | <Material diffuseColor='0 1 0'/> |
122 | </Appearance> |
123 | <Sphere/> |
124 | </Shape> |
125 | </Transform> |
126 |
<!-- Transform
LOWER_LEFT is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
<Transform DEF='LOWER_LEFT' translation='-3 0 -3'> |
127 | <Shape> |
128 | <Appearance DEF='BLUE'> |
129 | <Material diffuseColor='.2 .2 1'/> |
130 | </Appearance> |
131 | <Cylinder/> |
132 | </Shape> |
133 | </Transform> |
134 |
<!-- Transform
LOWER_RIGHT is a DEF node that has 1 USE node: USE_1 -->
<Transform DEF='LOWER_RIGHT' translation='-6 0 4'> |
135 | <Shape> |
136 | |
137 | <Material diffuseColor='1 1 1'/> |
138 | </Appearance> |
139 | <Text string='"QuadTree-USEchildren" "ProtoInstance"'/> |
140 | </Shape> |
141 | </Transform> |
142 | </Group> |
143 | </fieldValue> |
144 | <fieldValue name='upperLeftDEFName'> |
145 | <Transform USE='UPPER_LEFT'/> |
146 | </fieldValue> |
147 | <fieldValue name='upperRightDEFName'> |
148 | <Transform USE='UPPER_RIGHT'/> |
149 | </fieldValue> |
150 | <fieldValue name='lowerLeftDEFName'> |
151 | <Transform USE='LOWER_LEFT'/> |
152 | </fieldValue> |
153 | <fieldValue name='lowerRightDEFName'> |
154 | <Transform USE='LOWER_RIGHT'/> |
155 | </fieldValue> |
156 | </ProtoInstance> |
157 | </Transform> |
158 | <Transform DEF='Example_2' translation='0 2 0'> |
159 | <QuadTree-USEchildren nodeType='Group'> |
160 | <fieldValue name='children'> |
161 | <!-- children which follow are locally convenient and referenced via IDREF/USE --> |
162 |
<!-- Transform
LOWER_RIGHT_EXAMPLE_2 is a DEF node that has 1 USE node: USE_1 -->
<Transform DEF='LOWER_RIGHT_EXAMPLE_2' translation='-6 0 4'> |
163 | <Shape> |
164 | <Text string='"QuadTree-USEchildren" "Native tags"'/> |
165 | <Appearance USE='WHITE'/> |
166 | </Shape> |
167 | </Transform> |
168 | </fieldValue> |
169 | <fieldValue name='upperLeftDEFName'> |
170 | <Transform USE='UPPER_LEFT'/> |
171 | </fieldValue> |
172 | <fieldValue name='upperRightDEFName'> |
173 | <Transform USE='UPPER_RIGHT'/> |
174 | </fieldValue> |
175 | <fieldValue name='lowerLeftDEFName'> |
176 | <Transform USE='LOWER_LEFT'/> |
177 | </fieldValue> |
178 | <fieldValue name='lowerRightDEFName'> |
179 | <Transform USE='LOWER_RIGHT_EXAMPLE_2'/> |
180 | </fieldValue> |
181 | </QuadTree-USEchildren> |
182 | </Transform> |
183 | <Transform DEF='Example_3' translation='0 -2 0'> |
184 | <ProtoInstance name='QuadTree-TagChildren'> |
185 | <fieldValue name='upperLeftNode'> |
186 | <Transform USE='UPPER_LEFT'/> |
187 | </fieldValue> |
188 | <fieldValue name='upperRightNode'> |
189 | <Transform USE='UPPER_RIGHT'/> |
190 | </fieldValue> |
191 | <fieldValue name='lowerLeftNode'> |
192 | <Transform USE='LOWER_LEFT'/> |
193 | </fieldValue> |
194 | <fieldValue name='lowerRightNode'> |
195 | <Transform translation='-6 0 4'> |
196 | <Shape> |
197 | <Text string='"QuadTree-TagChildren" "ProtoInstance"'/> |
198 | <Appearance USE='WHITE'/> |
199 | </Shape> |
200 | </Transform> |
201 | </fieldValue> |
202 | </ProtoInstance> |
203 | </Transform> |
204 | <Transform DEF='Example_4' translation='0 -6 0'> |
205 | <QuadTree-TagChildren nodeType='Group'> |
206 | <fieldValue name='upperLeftNode'> |
207 | <Transform USE='UPPER_LEFT'/> |
208 | </fieldValue> |
209 | <fieldValue name='upperRightNode'> |
210 | <Transform USE='UPPER_RIGHT'/> |
211 | </fieldValue> |
212 | <fieldValue name='lowerLeftNode'> |
213 | <Transform USE='LOWER_LEFT'/> |
214 | </fieldValue> |
215 | <fieldValue name='lowerRightNode'> |
216 | <Transform translation='-6 0 4'> |
217 | <Shape> |
218 | <Text string='"QuadTree-TagChildren" "Native tags"'/> |
219 | <Appearance USE='WHITE'/> |
220 | </Shape> |
221 | </Transform> |
222 | <WorldInfo info='"this WorldInfo is here to demonstrate that the example is type MFNode"'/> |
223 | </fieldValue> |
224 | </QuadTree-TagChildren> |
225 | </Transform> |
226 | </Group> |
227 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
228 | </Scene> |
229 | </X3D> |
Event Graph ROUTE Table with 0 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
ProtoInstance QuadTree-USEchildren |
No ROUTE connection found for output events from this node. This ProtoInstance contains SFNode/MFNode fieldValue declarations with direct access to other nodes, and thus has potential to produce run-time animation. |
ProtoInstance QuadTree-TagChildren |
No ROUTE connection found for output events from this node. This ProtoInstance contains SFNode/MFNode fieldValue declarations with direct access to other nodes, and thus has potential to produce run-time animation. |
<!--
Color legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoInstance
name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->