X3D Model Documentation: RoomDirect.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
  3  <X3D profile='Immersive' version='3.2 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.2.xsd'>
  4       <head>
  5            <meta name='titlecontent='RoomDirect.x3d'/>
  6            <meta name='descriptioncontent='X3D Follower example'/>
  7            <meta name='creatorcontent='Herbert Stocker'/>
  8            <meta name='translatorcontent='Don Brutzman'/>
  9            <meta name='createdcontent='18 April 2006'/>
 10            <meta name='translatedcontent='2 December 2011'/>
 11            <meta name='modifiedcontent='20 October 2019'/>
 12            <meta name='referencecontent='originals/room-direct.wrl'/>
 13            <meta name='referencecontent='Stocker_06_Followers.pdf'/>
 14            <meta name='referencecontent='http://www.hersto.com/Publications/Followers'/>
 15            <meta name='requirescontent='X3D version 3.2 or greater'/>
 16            <meta name='subjectcontent='X3D Follower Chaser Damper'/>
 17            <meta name='referencecontent='https://www.web3d.org/x3d/specifications/ISO-IEC-19775-1.2-X3D-AbstractSpecification/Part01/components/followers.html'/>
 18            <meta name='referencecontent='https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html'/>
 19            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/Followers/RoomDirect.x3d'/>
 20            <meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
 21            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 22            <meta name='licensecontent='../../license.html'/>
 23       </head>
<!--

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

<!-- to top Index for DEF nodes: ShWall, SquareTextureCoordinatePoints, TouchFloor, TouchRoof, TouchWallFront, TouchWallLeft, TouchWallRight, TransInd, Worker

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ExternProtoDeclare definition: Selection
-->
 24       <Scene>
 25            <WorldInfo title='RoomDirect.x3d'/>
 26            <ExternProtoDeclare name='Selection'   url=' "urn:inet:blaxxun.com:node:Selection" "originals/bitmanagement-nodes.x3d#Selection" "https://www.web3d.org/x3d/content/examples/Basic/Followers/originals/bitmanagement-nodes.x3d#Selection" "originals/bitmanagement-nodes.wrl#Selection" "https://www.web3d.org/x3d/content/examples/Basic/Followers/originals/bitmanagement-nodes.wrl#Selection" '>
 27                 <field name='selecttype='SFBoolaccessType='inputOutput'/>
 28                 <field name='addChildrentype='MFNodeaccessType='inputOnly'/>
 29                 <field name='bboxCentertype='SFVec3faccessType='initializeOnly'/>
 30                 <field name='removeChildrentype='MFNodeaccessType='inputOnly'/>
 31                 <field name='childrentype='MFNodeaccessType='inputOutput'/>
 32                 <field name='proxytype='SFNodeaccessType='initializeOnly'/>
 33                 <field name='bboxSizetype='SFVec3faccessType='initializeOnly'/>
 34                 <field name='collidetype='SFBoolaccessType='inputOutput'/>
 35            </ExternProtoDeclare>
 36            <Background skyColor='0.1 0.2 0.3'/>
 37            <Viewpoint description='insidefieldOfView='0.785orientation='-1.0 -0.0 0.0 0.105position='-0.0 1.7 7.985'/>
 38            <Viewpoint description='outsidefieldOfView='0.785orientation='-1.0 0.0 0.0 0.105position='0.0 2.068 13.879'/>
 39            <NavigationInfo avatarSize='0.25 1.2 0.75headlight='false'/>
 40            <DirectionalLight intensity='0.5'/>
 41            <PointLight location='2.5 1.0 0.0radius='20.0'/>
 42            <DirectionalLight direction='0.0 -1.0 0.0'/>
 43            <DirectionalLight intensity='0.5'/>
 44            <Group>
 45 
               <!-- ROUTE information for TouchFloor node:  [from hitPoint_changed to Worker.set_hitPoint ] [from touchTime to Worker.touchedFloor ] -->
               <TouchSensor DEF='TouchFloordescription='Touch to move picture here'/>
 46                 <Shape>
 47                      <Appearance>
 48                           <TextureTransform scale='17.0 17.0'/>
 49                           <ImageTexture   url=' "floor.png " "https://www.web3d.org/x3d/content/examples/Basic/Followers/floor.png " '/>
 50                      </Appearance>
 51                      <Box size='10.0 0.1 10.0'/>
 52                 </Shape>
 53            </Group>
 54            <Group>
 55 
               <!-- ROUTE information for TouchWallFront node:  [from hitPoint_changed to Worker.set_hitPoint ] [from touchTime to Worker.touchedWallFront ] -->
               <TouchSensor DEF='TouchWallFrontdescription='Touch to move picture here'/>
 56                 <Transform translation='0.0 1.5 -5.0'>
 57 
                    <!-- Shape ShWall is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                    <Shape DEF='ShWall'>
 58                           <Appearance>
 59                                <Material ambientIntensity='0.0567diffuseColor='0.52 0.51 0.45emissiveColor='0.28 0.27 0.24shininess='0.53specularColor='0.76 0.78 0.54'/>
 60                           </Appearance>
 61                           <Box size='10.0 3.0 0.1'/>
 62                      </Shape>
 63                 </Transform>
 64            </Group>
 65            <Group>
 66 
               <!-- ROUTE information for TouchWallLeft node:  [from hitPoint_changed to Worker.set_hitPoint ] [from touchTime to Worker.touchedWallLeft ] -->
               <TouchSensor DEF='TouchWallLeftdescription='Touch to move picture here'/>
 67                 <Transform rotation='0.0 1.0 0.0 -1.571translation='-5.0 1.5 0.0'>
 68                      <Shape USE='ShWall'/>
 69                 </Transform>
 70            </Group>
 71            <Group>
 72 
               <!-- ROUTE information for TouchWallRight node:  [from hitPoint_changed to Worker.set_hitPoint ] [from touchTime to Worker.touchedWallRight ] -->
               <TouchSensor DEF='TouchWallRightdescription='Touch to move picture here'/>
 73                 <Transform rotation='0.0 1.0 0.0 1.571translation='5.0 1.5 0.0'>
 74                      <Shape USE='ShWall'/>
 75                 </Transform>
 76            </Group>
 77            <Group>
 78 
               <!-- ROUTE information for TouchRoof node:  [from hitPoint_changed to Worker.set_hitPoint ] [from touchTime to Worker.touchedRoof ] -->
               <TouchSensor DEF='TouchRoofdescription='Touch to move picture here'/>
 79                 <Transform translation='0.0 3.0 0.0'>
 80                      <Shape>
 81                           <Appearance>
 82                                <Material ambientIntensity='0.0567diffuseColor='0.522 0.451 0.447emissiveColor='0.306 0.235 0.176shininess='0.53specularColor='0.761 0.541 0.584'/>
 83                           </Appearance>
 84                           <Box size='10.0 0.1 10.0'/>
 85                      </Shape>
 86                 </Transform>
 87            </Group>
 88            <ProtoInstance name='Selection'>
 89                 <fieldValue name='selectvalue='false'/>
 90                 <fieldValue name='children'>
 91 
                    <!-- ROUTE information for TransInd node:  [from Worker.indPos to translation ] [from Worker.indOri to rotation ] -->
                    <Transform DEF='TransIndscale='3.5 3.0 3.0'>
 92                           <Transform scale='0.223 0.341 0.5'>
 93                                <Shape>
 94                                     <Appearance>
 95                                          <ImageTexture   url=' "Photo.jpg " "https://www.web3d.org/x3d/content/examples/Basic/Followers/Photo.jpg " '/>
 96                                     </Appearance>
 97                                     <IndexedFaceSet solid='falsecoordIndex='0 1 2 3 -1 4 5 6 7 -1 4 0 3 7 -1 5 1 0 4 -1 6 2 1 5 -1 7 3 2 6 -1texCoordIndex='0 1 2 3 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1'>
 98 
                                        <!-- TextureCoordinate SquareTextureCoordinatePoints is a DEF node that has 1 USE node: USE_1 -->
                                        <TextureCoordinate DEF='SquareTextureCoordinatePointspoint='0 0 1 0 1 1 0 1'/>
 99                                          <Coordinate point='-1.0 -1.0 0.03 1.0 -1.0 0.03 1.0 1.0 0.03 -1.0 1.0 0.03 -1.0 -1.0 0.0 1.0 -1.0 0.0 1.0 1.0 0.0 -1.0 1.0 0.0'/>
100                                     </IndexedFaceSet>
101                                </Shape>
102                                <Shape>
103                                     <Appearance>
104                                          <ImageTexture   url=' "Shadow.png " "https://www.web3d.org/x3d/content/examples/Basic/Followers/Shadow.png " '/>
105                                          <Material diffuseColor='0.321569 0.713726 1'/>
106                                     </Appearance>
107                                     <IndexedFaceSet coordIndex='0 1 2 3 -1'>
108                                          <TextureCoordinate USE='SquareTextureCoordinatePoints'/>
109                                          <Coordinate point='-1.15 -1.15 0.01 1.15 -1.15 0.01 1.15 1.15 0.01 -1.15 1.15 0.01'/>
110                                     </IndexedFaceSet>
111                                </Shape>
112                           </Transform>
113                      </Transform>
114                 </fieldValue>
115            </ProtoInstance>
116 
117                 <field name='set_hitPointtype='SFVec3faccessType='inputOnly'/>
118                 <field name='touchedWallLefttype='SFTimeaccessType='inputOnly'/>
119                 <field name='indPostype='SFVec3faccessType='outputOnly'/>
120                 <field name='touchedWallRighttype='SFTimeaccessType='inputOnly'/>
121                 <field name='cRoomDepthtype='SFFloatvalue='9.9accessType='initializeOnly'/>
122                 <field name='cPaintingWidthtype='SFFloatvalue='1.561accessType='initializeOnly'/>
123                 <field name='cFloorYtype='SFFloatvalue='0.05accessType='initializeOnly'/>
124                 <field name='cPaintingHeighttype='SFFloatvalue='2.046accessType='initializeOnly'/>
125                 <field name='touchedWallFronttype='SFTimeaccessType='inputOnly'/>
126                 <field name='touchedFloortype='SFTimeaccessType='inputOnly'/>
127                 <field name='touchedRooftype='SFTimeaccessType='inputOnly'/>
128                 <field name='indOritype='SFRotationaccessType='outputOnly'/>
129                 <field name='cRoomHeighttype='SFFloatvalue='2.9accessType='initializeOnly'/>
130                 <field name='cRoomWidthtype='SFFloatvalue='9.9accessType='initializeOnly'/>
131                 <field name='lastHitPointtype='SFVec3fvalue='0.0 0.0 0.0accessType='initializeOnly'/>
  <![CDATA[
      
ecmascript:

function set_hitPoint(hp)
{
    lastHitPoint= hp;
}

function touchedFloor(t)
{
    indPos= CheckGroundRoof(lastHitPoint);
    indOri= new SFRotation(-1, 0, 0, 1.571);
}

function touchedWallLeft(t)
{
    indPos= CheckLeftRightWall(CheckHeight(lastHitPoint));
    indOri= new SFRotation(0, 1, 0, 1.5705);
}

function touchedWallRight(t)
{
    indPos= CheckLeftRightWall(CheckHeight(lastHitPoint));
    indOri= new SFRotation(0, -1, 0, 1.5705);
}

function touchedWallFront(t)
{
    indPos= CheckFrontWall(CheckHeight(lastHitPoint));
    indOri= new SFRotation(0, 1, 0, 0);
}

function touchedRoof(t)
{
    indPos= CheckGroundRoof(lastHitPoint);
    indOri= (new SFRotation(1, 0, 0, 1.57));//.multiply(new SFRotation(0, 1, 0, 3.14159));
}

function CheckGroundRoof(pos)
{
return new SFVec3f( Limit(pos.x, -cRoomWidth/2 + cPaintingWidth/2, cRoomWidth/2 - cPaintingWidth/2)
                  , pos.y
                  , Limit(pos.z, -cRoomDepth/2 + cPaintingHeight/2, cRoomDepth/2 - cPaintingHeight/2)
                  );
}

function CheckHeight(pos)
{
return new SFVec3f( pos.x
                  , Limit(pos.y, cFloorY + cPaintingHeight/2, cFloorY + cRoomHeight - cPaintingHeight/2)
                  , pos.z
                  );
}

function CheckLeftRightWall(pos)
{
    return new SFVec3f( pos.x
                      , pos.y
                      , Limit(pos.z, -cRoomDepth/2 + cPaintingWidth/2, cRoomDepth/2 - cPaintingWidth/2)
                      );
}

function CheckFrontWall(pos)
{
    return new SFVec3f( Limit(pos.x, -cRoomWidth/2 + cPaintingWidth/2, cRoomWidth/2 - cPaintingWidth/2)
                      , pos.y
                      , pos.z
                      );
}
function Limit(x, min, max)
{
    return Min(Max(x, min), max);
}

function Max(a, b)
{
    return a > b? a:b;
}

function Min(a, b)
{
    return a > b? b:a;
}

    
]]>
133            </Script>
134            < ROUTE  fromNode='TouchFloor' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/>
135            < ROUTE  fromNode='TouchWallLeft' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/>
136            < ROUTE  fromNode='TouchWallRight' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/>
137            < ROUTE  fromNode='TouchWallFront' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/>
138            < ROUTE  fromNode='TouchRoof' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/>
139            < ROUTE  fromNode='TouchFloor' fromField='touchTime' toNode='Worker' toField='touchedFloor'/>
140            < ROUTE  fromNode='TouchWallLeft' fromField='touchTime' toNode='Worker' toField='touchedWallLeft'/>
141            < ROUTE  fromNode='TouchWallRight' fromField='touchTime' toNode='Worker' toField='touchedWallRight'/>
142            < ROUTE  fromNode='TouchWallFront' fromField='touchTime' toNode='Worker' toField='touchedWallFront'/>
143            < ROUTE  fromNode='TouchRoof' fromField='touchTime' toNode='Worker' toField='touchedRoof'/>
144            < ROUTE  fromNode='Worker' fromField='indPos' toNode='TransInd' toField='translation'/>
145            < ROUTE  fromNode='Worker' fromField='indOri' toNode='TransInd' toField='rotation'/>
146       </Scene>
147  </X3D>
<!--

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

<!-- to top Index for DEF nodes: ShWall, SquareTextureCoordinatePoints, TouchFloor, TouchRoof, TouchWallFront, TouchWallLeft, TouchWallRight, TransInd, Worker

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ExternProtoDeclare definition: Selection
-->
X3D Tooltips element index: Appearance, Background, Box, Coordinate, DirectionalLight, ExternProtoDeclare, field, fieldValue, Group, head, ImageTexture, IndexedFaceSet, Material, meta, NavigationInfo, PointLight, ProtoInstance, ROUTE, Scene, Script, Shape, TextureCoordinate, TextureTransform, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 12 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.

TouchFloor
TouchSensor
hitPoint_changed
SFVec3f

ROUTE
event to
(1)
Worker
Script
set_hitPoint
SFVec3f
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f
TouchFloor
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Worker
Script
touchedFloor
SFTime
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f

TouchRoof
TouchSensor
hitPoint_changed
SFVec3f

ROUTE
event to
(1)
Worker
Script
set_hitPoint
SFVec3f
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f
TouchRoof
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Worker
Script
touchedRoof
SFTime
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f

TouchWallFront
TouchSensor
hitPoint_changed
SFVec3f

ROUTE
event to
(1)
Worker
Script
set_hitPoint
SFVec3f
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f
TouchWallFront
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Worker
Script
touchedWallFront
SFTime
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f

TouchWallLeft
TouchSensor
hitPoint_changed
SFVec3f

ROUTE
event to
(1)
Worker
Script
set_hitPoint
SFVec3f
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f
TouchWallLeft
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Worker
Script
touchedWallLeft
SFTime
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f

TouchWallRight
TouchSensor
hitPoint_changed
SFVec3f

ROUTE
event to
(1)
Worker
Script
set_hitPoint
SFVec3f
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f
TouchWallRight
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Worker
Script
touchedWallRight
SFTime
then
 
 
 
Worker
Script
indOri
SFRotation

ROUTE
event to
(2)
TransInd
Transform
rotation
SFRotation
  then
 
 
 
Worker
Script
indPos
SFVec3f

ROUTE
event to
(2)
TransInd
Transform
translation
SFVec3f


ProtoInstance
Selection
No ROUTE connection found for output events from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declaration 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/Basic/Followers/RoomDirectIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/Followers/RoomDirect.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. -->