1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> |
4 | <head> |
5 | <meta name='title' content='Bounce3.x3d'/> |
6 | <meta name='description' content='ouncing beachball (with prototype and JavaScript): this world illustrates the use of a PROTO to encapsulate a Script node, timer, shape, and routes to create a vertically bouncing beach ball. The bounce path is based upon the projectile motion equation of physics, constrained to create a cyclic bouncing path with a user-selected maximum bounce height. Also, there is no friction, drag, or damping. For an explanation of the script, see bounce1.wrl.'/> |
7 | <meta name='creator' content='David R. Nadeau'/> |
8 | <meta name='translator' content='Don Brutzman'/> |
9 | <meta name='created' content='1 July 1998'/> |
10 | <meta name='translated' content='2 February 2014'/> |
11 | <meta name='modified' content='20 October 2019'/> |
12 | <meta name='reference' content='originals/bounce3.wrl'/> |
13 | <meta name='reference' content='http://www.siggraph.org/s98'/> |
14 | <meta name='reference' content='http://www.siggraph.org/s98/conference/courses/18.html'/> |
15 | <meta name='reference' content='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0487.htm'/> |
16 | <meta name='reference' content='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm'/> |
17 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dResources.html'/> |
18 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3.x3d'/> |
19 | <meta name='generator' content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/> |
20 | <meta name='generator' content='X3D-Edit, https://savage.nps.edu/X3D-Edit'/> |
21 | <meta name='license' content='../license.html'/> |
22 | </head> |
23 | <Scene> |
24 | <WorldInfo info='"Copyright (c) 1997, David R. Nadeau"' title='Bouncing beachball (PROTO)'/> |
25 | <Viewpoint description='Bouncing beachball, with prototype and JavaScript' orientation='1.0 0.0 0.0 0.1' position='0.0 0.6 8.0'/> |
26 | <NavigationInfo headlight='false' speed='2.0'/> |
27 | <DirectionalLight ambientIntensity='0.5' direction='0.0 -1.0 -0.5'/> |
28 | <Background skyAngle='1.371 1.571' skyColor='0.0 0.0 1.0 0.0 0.5 1.0 0.7 0.7 1.0'/> |
29 | <Shape> |
30 | <Appearance> |
31 | <TextureTransform scale='10.0 10.0'/> |
32 | <Material/> |
33 | <ImageTexture url=' "sand.jpg " "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/sand.jpg " '/> |
34 | </Appearance> |
35 | <IndexedFaceSet solid='false' coordIndex='0 1 2 3'> |
36 | <Coordinate point='-50.0 -1.0 50.0 50.0 -1.0 50.0 50.0 -1.0 -50.0 -50.0 -1.0 -50.0'/> |
37 | </IndexedFaceSet> |
38 | </Shape> |
39 | <Transform translation='-3.0 -1.0 -10.0'> |
40 | |
41 | <Billboard> |
42 | <Shape> |
43 | <Appearance> |
44 | <ImageTexture url=' "palm.png " "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palm.png " '/> |
45 | </Appearance> |
46 | <IndexedFaceSet solid='false' coordIndex='0 1 2 3' texCoordIndex='0 1 2 3'> |
47 | <TextureCoordinate point='0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0'/> |
48 | <Coordinate point='-2.5 0.0 0.0 2.5 0.0 0.0 2.5 11.25 0.0 -2.5 11.25 0.0'/> |
49 | </IndexedFaceSet> |
50 | </Shape> |
51 | </Billboard> |
52 | <Shape> |
53 | <Appearance> |
54 | <Material diffuseColor='0.0 0.0 0.0' transparency='0.5'/> |
55 | <ImageTexture url=' "palmsh.png " "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palmsh.png " '/> |
56 | </Appearance> |
57 | <IndexedFaceSet solid='false' coordIndex='0 1 2 3' texCoordIndex='0 1 2 3'> |
58 | <TextureCoordinate point='0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0'/> |
59 | <Coordinate point='-2.5 0.05 2.5 2.5 0.05 2.5 2.5 0.05 -2.5 -2.5 0.05 -2.5'/> |
60 | </IndexedFaceSet> |
61 | </Shape> |
62 | </Group> |
63 | </Transform> |
64 | <Transform scale='0.6 0.6 0.6' translation='-5.0 -1.0 -6.0'> |
65 | <Group USE='Palm'/> |
66 | </Transform> |
67 | <Transform translation='5.0 -1.0 -9.0'> |
68 | <Group USE='Palm'/> |
69 | </Transform> |
70 | <Transform translation='10.0 -1.0 -15.0'> |
71 | <Group USE='Palm'/> |
72 | </Transform> |
73 | <ProtoDeclare name='BouncingBall'> |
74 | <ProtoInterface> |
75 | <field name='bounceTime' type='SFTime' value='1.0' accessType='initializeOnly'/> |
76 | <field name='bounceHeight' type='SFFloat' value='1.0' accessType='initializeOnly'/> |
77 | </ProtoInterface> |
78 | <ProtoBody> |
79 |
<!-- ROUTE information for Ball node:
[from Bouncer.value_changed to set_translation
]
-->
<Transform DEF='Ball'> |
80 | <Shape> |
81 | <Appearance> |
82 | <TextureTransform scale='2.0 1.0'/> |
83 | <Material ambientIntensity='0.5' diffuseColor='1.0 1.0 1.0' shininess='0.4' specularColor='0.7 0.7 0.7'/> |
84 | <ImageTexture url=' "beach.jpg " "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/beach.jpg " '/> |
85 | </Appearance> |
86 | <Sphere/> |
87 | </Shape> |
88 | </Transform> |
89 |
<!-- ROUTE information for Clock node:
[from fraction_changed to Bouncer.set_fraction
]
-->
<TimeSensor DEF='Clock' loop='true' startTime='1.0'> |
90 | <IS> |
91 | <connect nodeField='cycleInterval' protoField='bounceTime'/> |
92 | </IS> |
93 | </TimeSensor> |
94 |
<!-- ROUTE information for Bouncer node:
[from Clock.fraction_changed to set_fraction
]
[from value_changed to Ball.set_translation
]
-->
<Script DEF='Bouncer'> |
95 | <field name='value_changed' type='SFVec3f' accessType='outputOnly'/> |
96 | <field name='bounceHeight' type='SFFloat' accessType='initializeOnly'/> |
97 | <field name='set_fraction' type='SFFloat' accessType='inputOnly'/> |
98 | <IS> |
99 | <connect nodeField='bounceHeight' protoField='bounceHeight'/> |
100 | </IS> |
<![CDATA[
ecmascript: function set_fraction( frac, tm ) { y = 4.0 * bounceHeight * frac * (1.0 - frac); value_changed[0] = 0.0; value_changed[1] = y; value_changed[2] = 0.0; }
]]>
|
|
102 | </Script> |
103 | < ROUTE fromNode='Clock' fromField='fraction_changed' toNode='Bouncer' toField='set_fraction'/> |
104 | < ROUTE fromNode='Bouncer' fromField='value_changed' toNode='Ball' toField='set_translation'/> |
105 | </ProtoBody> |
106 | </ProtoDeclare> |
107 | <ProtoInstance name='BouncingBall'> |
108 | <fieldValue name='bounceTime' value='2.0'/> |
109 | <fieldValue name='bounceHeight' value='3.0'/> |
110 | </ProtoInstance> |
111 | <Transform translation='2.0 0.0 -2.0'> |
112 | <ProtoInstance name='BouncingBall'> |
113 | <fieldValue name='bounceTime' value='2.2'/> |
114 | <fieldValue name='bounceHeight' value='2.5'/> |
115 | </ProtoInstance> |
116 | </Transform> |
117 | <Transform translation='-2.0 0.0 -2.0'> |
118 | <ProtoInstance name='BouncingBall'> |
119 | <fieldValue name='bounceTime' value='2.4'/> |
120 | <fieldValue name='bounceHeight' value='3.5'/> |
121 | </ProtoInstance> |
122 | </Transform> |
123 | </Scene> |
124 | </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.
Clock
TimeSensor fraction_changed SFFloat |
Bouncer
Script set_fraction SFFloat |
then
|
Bouncer
Script value_changed SFVec3f |
Ball
Transform set_translation SFVec3f |
ProtoInstance BouncingBall |
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 BouncingBall |
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 BouncingBall |
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. -->