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='title' content='RoomDirect.x3d'/> |
6 | <meta name='description' content='X3D Follower example'/> |
7 | <meta name='creator' content='Herbert Stocker'/> |
8 | <meta name='translator' content='Don Brutzman'/> |
9 | <meta name='created' content='18 April 2006'/> |
10 | <meta name='translated' content='2 December 2011'/> |
11 | <meta name='modified' content='20 October 2019'/> |
12 | <meta name='reference' content='originals/room-direct.wrl'/> |
13 | <meta name='reference' content='Stocker_06_Followers.pdf'/> |
14 | <meta name='reference' content='http://www.hersto.com/Publications/Followers'/> |
15 | <meta name='requires' content='X3D version 3.2 or greater'/> |
16 | <meta name='subject' content='X3D Follower Chaser Damper'/> |
17 | <meta name='reference' content='https://www.web3d.org/x3d/specifications/ISO-IEC-19775-1.2-X3D-AbstractSpecification/Part01/components/followers.html'/> |
18 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html'/> |
19 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/Followers/RoomDirect.x3d'/> |
20 | <meta name='generator' content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/> |
21 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
22 | <meta name='license' content='../../license.html'/> |
23 | </head> |
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='select' type='SFBool' accessType='inputOutput'/> |
28 | <field name='addChildren' type='MFNode' accessType='inputOnly'/> |
29 | <field name='bboxCenter' type='SFVec3f' accessType='initializeOnly'/> |
30 | <field name='removeChildren' type='MFNode' accessType='inputOnly'/> |
31 | <field name='children' type='MFNode' accessType='inputOutput'/> |
32 | <field name='proxy' type='SFNode' accessType='initializeOnly'/> |
33 | <field name='bboxSize' type='SFVec3f' accessType='initializeOnly'/> |
34 | <field name='collide' type='SFBool' accessType='inputOutput'/> |
35 | </ExternProtoDeclare> |
36 | <Background skyColor='0.1 0.2 0.3'/> |
37 | <Viewpoint description='inside' fieldOfView='0.785' orientation='-1.0 -0.0 0.0 0.105' position='-0.0 1.7 7.985'/> |
38 | <Viewpoint description='outside' fieldOfView='0.785' orientation='-1.0 0.0 0.0 0.105' position='0.0 2.068 13.879'/> |
39 | <NavigationInfo avatarSize='0.25 1.2 0.75' headlight='false'/> |
40 | <DirectionalLight intensity='0.5'/> |
41 | <PointLight location='2.5 1.0 0.0' radius='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='TouchFloor' description='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='TouchWallFront' description='Touch to move picture here'/> |
56 | <Transform translation='0.0 1.5 -5.0'> |
57 | |
58 | <Appearance> |
59 | <Material ambientIntensity='0.0567' diffuseColor='0.52 0.51 0.45' emissiveColor='0.28 0.27 0.24' shininess='0.53' specularColor='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='TouchWallLeft' description='Touch to move picture here'/> |
67 | <Transform rotation='0.0 1.0 0.0 -1.571' translation='-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='TouchWallRight' description='Touch to move picture here'/> |
73 | <Transform rotation='0.0 1.0 0.0 1.571' translation='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='TouchRoof' description='Touch to move picture here'/> |
79 | <Transform translation='0.0 3.0 0.0'> |
80 | <Shape> |
81 | <Appearance> |
82 | <Material ambientIntensity='0.0567' diffuseColor='0.522 0.451 0.447' emissiveColor='0.306 0.235 0.176' shininess='0.53' specularColor='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='select' value='false'/> |
90 | <fieldValue name='children'> |
91 |
<!-- ROUTE information for TransInd node:
[from Worker.indPos to translation
]
[from Worker.indOri to rotation
]
-->
<Transform DEF='TransInd' scale='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='false' coordIndex='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 -1' texCoordIndex='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='SquareTextureCoordinatePoints' point='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 |
<!-- ROUTE information for Worker node:
[from TouchFloor.hitPoint_changed to set_hitPoint
]
[from TouchWallLeft.hitPoint_changed to set_hitPoint
]
[from TouchWallRight.hitPoint_changed to set_hitPoint
]
[from TouchWallFront.hitPoint_changed to set_hitPoint
]
[from TouchRoof.hitPoint_changed to set_hitPoint
]
[from TouchFloor.touchTime to touchedFloor
]
[from TouchWallLeft.touchTime to touchedWallLeft
]
[from TouchWallRight.touchTime to touchedWallRight
]
[from TouchWallFront.touchTime to touchedWallFront
]
[from TouchRoof.touchTime to touchedRoof
]
[from indPos to TransInd.translation
]
[from indOri to TransInd.rotation
]
-->
<Script DEF='Worker'> |
117 | <field name='set_hitPoint' type='SFVec3f' accessType='inputOnly'/> |
118 | <field name='touchedWallLeft' type='SFTime' accessType='inputOnly'/> |
119 | <field name='indPos' type='SFVec3f' accessType='outputOnly'/> |
120 | <field name='touchedWallRight' type='SFTime' accessType='inputOnly'/> |
121 | <field name='cRoomDepth' type='SFFloat' value='9.9' accessType='initializeOnly'/> |
122 | <field name='cPaintingWidth' type='SFFloat' value='1.561' accessType='initializeOnly'/> |
123 | <field name='cFloorY' type='SFFloat' value='0.05' accessType='initializeOnly'/> |
124 | <field name='cPaintingHeight' type='SFFloat' value='2.046' accessType='initializeOnly'/> |
125 | <field name='touchedWallFront' type='SFTime' accessType='inputOnly'/> |
126 | <field name='touchedFloor' type='SFTime' accessType='inputOnly'/> |
127 | <field name='touchedRoof' type='SFTime' accessType='inputOnly'/> |
128 | <field name='indOri' type='SFRotation' accessType='outputOnly'/> |
129 | <field name='cRoomHeight' type='SFFloat' value='2.9' accessType='initializeOnly'/> |
130 | <field name='cRoomWidth' type='SFFloat' value='9.9' accessType='initializeOnly'/> |
131 | <field name='lastHitPoint' type='SFVec3f' value='0.0 0.0 0.0' accessType='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 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 |
Worker
Script set_hitPoint SFVec3f |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
||||
TouchFloor
TouchSensor touchTime SFTime |
Worker
Script touchedFloor SFTime |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
TouchRoof
TouchSensor hitPoint_changed SFVec3f |
Worker
Script set_hitPoint SFVec3f |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
||||
TouchRoof
TouchSensor touchTime SFTime |
Worker
Script touchedRoof SFTime |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
TouchWallFront
TouchSensor hitPoint_changed SFVec3f |
Worker
Script set_hitPoint SFVec3f |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
||||
TouchWallFront
TouchSensor touchTime SFTime |
Worker
Script touchedWallFront SFTime |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
TouchWallLeft
TouchSensor hitPoint_changed SFVec3f |
Worker
Script set_hitPoint SFVec3f |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
||||
TouchWallLeft
TouchSensor touchTime SFTime |
Worker
Script touchedWallLeft SFTime |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
TouchWallRight
TouchSensor hitPoint_changed SFVec3f |
Worker
Script set_hitPoint SFVec3f |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
TransInd
Transform translation SFVec3f |
||||
TouchWallRight
TouchSensor touchTime SFTime |
Worker
Script touchedWallRight SFTime |
then
|
Worker
Script indOri SFRotation |
TransInd
Transform rotation SFRotation |
||
then
|
Worker
Script indPos SFVec3f |
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. |
<!--
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. -->