1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
|
3 | <X3D profile='Immersive' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> |
4 | <head> |
5 | <meta name='title' content='X3dArchitectureConceptsPrototypeBodyValidationExample.x3d'/> |
6 | <meta name='description' content='Prototype example to illustrate why additional non-rendering nodes might be needed after first node in ProtoBody'/> |
7 | <meta name='creator' content='*Don Brutzman'/> |
8 | <meta name='created' content='10 September 2021'/> |
9 | <meta name='version' content='19 September 2021'/> |
10 | <meta name='drawing' content='X3dArchitectureConceptsPrototypeBodyValidationDiagram.png'/> |
11 | <meta name='drawing' content='X3dArchitectureConceptsPrototypeBodyValidationDiagram.vsdx'/> |
12 | <meta name='Image' content='X3dArchitectureConceptsPrototypeBodyValidationExampleX_ITE.png'/> |
13 | <meta name='reference' content='https://www.web3d.org/member-only/mantis/view.php?id=1372'/> |
14 | <meta name='specificationSection' content='X3D Architecture, ISO/IEC 19775-1: 202x, Clause 4 Concepts, 4.4.4.3 PROTO definition semantics'/> |
15 | <meta name='specificationUrl' content='https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/concepts.html#PROTOdefinitionsemantics'/> |
16 | <meta name='rights' content='(c) Web3D Consortium Inc. 2021'/> |
17 | <meta name='subject' content='X3D prototype specification'/> |
18 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter14Prototypes/X3dArchitectureConceptsPrototypeBodyValidationExample.x3d'/> |
19 | <meta name='generator' content='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/> |
20 | <meta name='license' content='../license.html'/> |
21 | </head> |
22 | <Scene> |
23 | <Background skyColor='0.058824 0.886275 1'/> |
24 | <NavigationInfo/> |
25 | <ProtoDeclare name='PulsingBoxShape'> |
26 | <ProtoInterface> |
27 | <field name='boxColor' type='SFColor' value='1 0 0' accessType='inputOutput'/> |
28 | </ProtoInterface> |
29 | <ProtoBody> |
30 | <!-- First node in ProtoBody determines node type of this Prototype --> |
31 | <Shape DEF='PrototypeRootNode'> |
32 | <Appearance> |
33 |
<!-- ROUTE information for BoxMaterial node:
[from TransparencyInterpolator.value_changed to transparency
]
-->
<Material DEF='BoxMaterial' diffuseColor='0.980392 0 0'> |
34 | <IS> |
35 | <connect nodeField='diffuseColor' protoField='boxColor'/> |
36 | </IS> |
37 | </Material> |
38 | </Appearance> |
39 | <Box DEF='PulsingBox' size='4 4 4'/> |
40 | </Shape> |
41 | <!-- ====================================================================== --> |
42 | <!-- Subsequent nodes do not render, but still must be a valid X3D subgraph --> |
43 | <!-- Note if these move into the Shape node, scene graph is no longer valid --> |
44 |
<!-- ROUTE information for TransparencyInterpolator node:
[from Timer.fraction_changed to set_fraction
]
[from value_changed to BoxMaterial.transparency
]
-->
<ScalarInterpolator DEF='TransparencyInterpolator' key='0 0.5 1' keyValue='1 0 1'/> |
45 |
<!-- ROUTE information for Timer node:
[from fraction_changed to TransparencyInterpolator.set_fraction
]
-->
<TimeSensor DEF='Timer' cycleInterval='10' loop='true'/> |
46 | <!-- ROUTEs --> |
47 | < ROUTE fromNode='Timer' fromField='fraction_changed' toNode='TransparencyInterpolator' toField='set_fraction'/> |
48 | < ROUTE fromNode='TransparencyInterpolator' fromField='value_changed' toNode='BoxMaterial' toField='transparency'/> |
49 | <!-- ====================================================================== --> |
50 | </ProtoBody> |
51 | </ProtoDeclare> |
52 | <ProtoInstance name='PulsingBoxShape' DEF='MyBox'> |
53 | <!-- NavyBlue TODO need appinfo/documentation fields on fieldValue to match field expressivity --> |
54 | <fieldValue name='boxColor' value='0 0 0.5'/> |
55 | </ProtoInstance> |
56 | </Scene> |
57 | </X3D> |
Event Graph ROUTE Table entries with 2 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.
Timer
TimeSensor fraction_changed SFFloat |
TransparencyInterpolator
ScalarInterpolator set_fraction SFFloat |
then
|
TransparencyInterpolator
ScalarInterpolator value_changed SFFloat |
BoxMaterial
Material transparency SFFloat |
MyBox
ProtoInstance PulsingBoxShape |
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. -->