X3D Model Documentation: Bounce3.x3d

  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='titlecontent='Bounce3.x3d'/>
  6            <meta name='descriptioncontent='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='creatorcontent='David R. Nadeau'/>
  8            <meta name='translatorcontent='Don Brutzman'/>
  9            <meta name='createdcontent='1 July 1998'/>
 10            <meta name='translatedcontent='2 February 2014'/>
 11            <meta name='modifiedcontent='20 October 2019'/>
 12            <meta name='referencecontent='originals/bounce3.wrl'/>
 13            <meta name='referencecontent='http://www.siggraph.org/s98'/>
 14            <meta name='referencecontent='http://www.siggraph.org/s98/conference/courses/18.html'/>
 15            <meta name='referencecontent='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0487.htm'/>
 16            <meta name='referencecontent='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm'/>
 17            <meta name='referencecontent='https://www.web3d.org/x3d/content/examples/X3dResources.html'/>
 18            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3.x3d'/>
 19            <meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
 20            <meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
 21            <meta name='licensecontent='../license.html'/>
 22       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: 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 JavaScriptorientation='1.0 0.0 0.0 0.1position='0.0 0.6 8.0'/>
 26            <NavigationInfo headlight='falsespeed='2.0'/>
 27            <DirectionalLight ambientIntensity='0.5direction='0.0 -1.0 -0.5'/>
 28            <Background skyAngle='1.371 1.571skyColor='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='falsecoordIndex='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 " "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palm.png " '/>
 45                                </Appearance>
 46                                <IndexedFaceSet solid='falsecoordIndex='0 1 2 3texCoordIndex='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.0transparency='0.5'/>
 55                                <ImageTexture   url=' "palmsh.png " "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palmsh.png " '/>
 56                           </Appearance>
 57                           <IndexedFaceSet solid='falsecoordIndex='0 1 2 3texCoordIndex='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.6translation='-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='bounceTimetype='SFTimevalue='1.0accessType='initializeOnly'/>
 76                      <field name='bounceHeighttype='SFFloatvalue='1.0accessType='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.5diffuseColor='1.0 1.0 1.0shininess='0.4specularColor='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='Clockloop='truestartTime='1.0'>
 90                           <IS>
 91                                <connect nodeField='cycleIntervalprotoField='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_changedtype='SFVec3faccessType='outputOnly'/>
 96                           <field name='bounceHeighttype='SFFloataccessType='initializeOnly'/>
 97                           <field name='set_fractiontype='SFFloataccessType='inputOnly'/>
 98                           <IS>
 99                                <connect nodeField='bounceHeightprotoField='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='bounceTimevalue='2.0'/>
109                 <fieldValue name='bounceHeightvalue='3.0'/>
110            </ProtoInstance>
111            <Transform translation='2.0 0.0 -2.0'>
112                 <ProtoInstance name='BouncingBall'>
113                      <fieldValue name='bounceTimevalue='2.2'/>
114                      <fieldValue name='bounceHeightvalue='2.5'/>
115                 </ProtoInstance>
116            </Transform>
117            <Transform translation='-2.0 0.0 -2.0'>
118                 <ProtoInstance name='BouncingBall'>
119                      <fieldValue name='bounceTimevalue='2.4'/>
120                      <fieldValue name='bounceHeightvalue='3.5'/>
121                 </ProtoInstance>
122            </Transform>
123       </Scene>
124  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Ball, Bouncer, Clock, Palm

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: BouncingBall
-->
X3D Tooltips element index: 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, accessType and type, XML data types, field types

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

ROUTE
event to
(1)
Bouncer
Script
set_fraction
SFFloat
then
 
 
 
Bouncer
Script
value_changed
SFVec3f

ROUTE
event to
(2)
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. 
Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3Index.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3.x3d -->

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

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