X3D Model Documentation: Bounce3.x3d go to online X3D Example Archives model page

  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='https://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://www.web3d.org/x3d/tools/X3D-Edit'/>
 21            <meta name='license' content='../license.html'/>
 22       </head>
<!--

Event Graph ROUTE Table shows event connections.

--> <!-- to top DEF nodes index: Ball, Bouncer, Clock, Palm

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: BouncingBall

-->
 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"image preview "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/sand.jpg"image preview '/>
 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 
               <!-- Group Palm is a DEF node that has 3 USE nodes: USE_1, USE_2, USE_3 -->
               <Group DEF='Palm'>
 41                      <Billboard>
 42                           <Shape>
 43                                <Appearance>
 44                                     <ImageTexture   url=' "palm.png"image preview "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palm.png"image preview '/>
 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"image preview "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palmsh.png"image preview '/>
 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"image preview "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/beach.jpg"image preview '/>
 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' cycleInterval='1.0' enabled='true'>
 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 shows event connections.

--> <!-- to top DEF nodes index: Ball, Bouncer, Clock, Palm

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: BouncingBall

-->

X3D Tooltips element index: to top Appearance, Background, Billboard, connect, Coordinate, DirectionalLight, field, fieldValue, Group, head, ImageTexture, IndexedFaceSet, IS, Material, meta, NavigationInfo, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Script, Shape, Sphere, TextureCoordinate, TextureTransform, TimeSensor, Transform, Viewpoint, WorldInfo, X3D,
plus documentation for accessType definitions, type definitions, XML data types, and field types

🔖   Event Graph ROUTE Table entries with 2 ROUTE connections, showing X3D event-model relationships for this scene.

Each row with a ROUTE statement shows an event cascade that may occur during a single timestamp interval between frame renderings, performed as part of the X3D execution model.

Clock
TimeSensor
fraction_changed
SFFloat
→
ROUTE
event to
(1)
Bouncer
Script
set_fraction
SFFloat
then
from
same
node
Bouncer
Script
value_changed
SFVec3f
→
ROUTE
event to
(2)
Ball
Transform
set_translation
SFVec3f

line 107
ProtoInstance
BouncingBall
No direct ROUTE connection found for events to/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. 

line 112
ProtoInstance
BouncingBall
No direct ROUTE connection found for events to/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. 

line 118
ProtoInstance
BouncingBall
No direct ROUTE connection found for events to/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. 

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets.
Have fun with X3D! 😀

-->
go to online X3D Example Archives model page <!-- Online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3Index.html -->
<!-- SourceForge version control Version control at    
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3.x3d -->

<!-- Color-coding 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> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->