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='RoomDesired.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='11 August 2024'/> |
12 | <meta name='reference' content='originals/room-desired.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=' warning ' content=' under development '/> |
18 | <meta name='reference' content='https://www.web3d.org/x3d/specifications/ISO-IEC-19775-1.2-X3D-AbstractSpecification/Part01/components/followers.html'/> |
19 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html'/> |
20 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/Followers/RoomDesired.x3d'/> |
21 | <meta name='generator' content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/> |
22 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
23 | <meta name='license' content='../../license.html'/> |
24 | </head> |
25 | <Scene> |
26 | <WorldInfo title='RoomDesired.x3d'/> |
27 | <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" '> |
28 | <field name='select' type='SFBool' accessType='inputOutput'/> |
29 | <field name='addChildren' type='MFNode' accessType='inputOnly'/> |
30 | <field name='bboxCenter' type='SFVec3f' accessType='initializeOnly'/> |
31 | <field name='removeChildren' type='MFNode' accessType='inputOnly'/> |
32 | <field name='children' type='MFNode' accessType='inputOutput'/> |
33 | <field name='proxy' type='SFNode' accessType='initializeOnly'/> |
34 | <field name='bboxSize' type='SFVec3f' accessType='initializeOnly'/> |
35 | <field name='collide' type='SFBool' accessType='inputOutput'/> |
36 | </ExternProtoDeclare> |
37 | <Background skyColor='0.1 0.2 0.3'/> |
38 | <Viewpoint description='inside' fieldOfView='0.785' orientation='-1.0 -0.0 0.0 0.105' position='-0.0 1.7 7.985'/> |
39 | <Viewpoint description='outside' fieldOfView='0.785' orientation='-1.0 0.0 0.0 0.105' position='0.0 2.068 13.879'/> |
40 | <NavigationInfo avatarSize='0.25 1.2 0.75' headlight='false'/> |
41 | <DirectionalLight intensity='0.5'/> |
42 | <PointLight location='2.5 1.0 0.0' radius='20.0'/> |
43 | <DirectionalLight direction='0.0 -1.0 0.0'/> |
44 | <DirectionalLight intensity='0.5'/> |
45 | <Group> |
46 |
<!-- 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'/> |
47 | <Shape> |
48 | <Appearance> |
49 | <TextureTransform scale='17.0 17.0'/> |
50 | <ImageTexture url=' "floor.png " "https://www.web3d.org/x3d/content/examples/Basic/Followers/floor.png " '/> |
51 | </Appearance> |
52 | <Box size='10.0 0.1 10.0'/> |
53 | </Shape> |
54 | </Group> |
55 | <Group> |
56 |
<!-- 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'/> |
57 | <Transform translation='0.0 1.5 -5.0'> |
58 | |
59 | <Appearance> |
60 | <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'/> |
61 | </Appearance> |
62 | <Box size='10.0 3.0 0.1'/> |
63 | </Shape> |
64 | </Transform> |
65 | </Group> |
66 | <Group> |
67 |
<!-- 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'/> |
68 | <Transform rotation='0.0 1.0 0.0 -1.571' translation='-5.0 1.5 0.0'> |
69 | <Shape USE='ShWall'/> |
70 | </Transform> |
71 | </Group> |
72 | <Group> |
73 |
<!-- 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'/> |
74 | <Transform rotation='0.0 1.0 0.0 1.571' translation='5.0 1.5 0.0'> |
75 | <Shape USE='ShWall'/> |
76 | </Transform> |
77 | </Group> |
78 | <Group> |
79 |
<!-- 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'/> |
80 | <Transform translation='0.0 3.0 0.0'> |
81 | <Shape> |
82 | <Appearance> |
83 | <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'/> |
84 | </Appearance> |
85 | <Box size='10.0 0.1 10.0'/> |
86 | </Shape> |
87 | </Transform> |
88 | </Group> |
89 | <ProtoInstance name='Selection'> |
90 | <fieldValue name='select' value='false'/> |
91 | <fieldValue name='children'> |
92 |
<!-- ROUTE information for TransInd node:
[from PaintingPositionChaser.value_changed to translation
]
[from PaintingOrientationChaser.value_changed to rotation
]
-->
<Transform DEF='TransInd' scale='3.5 3.0 3.0'> |
93 | <Transform scale='0.223 0.341 0.5'> |
94 | <Shape> |
95 | <Appearance> |
96 | <ImageTexture url=' "Photo.jpg " "https://www.web3d.org/x3d/content/examples/Basic/Followers/Photo.jpg " '/> |
97 | </Appearance> |
98 | <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'> |
99 |
<!-- 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'/> |
100 | <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'/> |
101 | </IndexedFaceSet> |
102 | </Shape> |
103 | <Shape> |
104 | <Appearance> |
105 | <ImageTexture url=' "Shadow.png " "https://www.web3d.org/x3d/content/examples/Basic/Followers/Shadow.png " '/> |
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 PaintingPositionChaser.set_destination
]
[from indOri to PaintingOrientationChaser.set_destination
]
-->
<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 information for PaintingPositionChaser node:
[from Worker.indPos to set_destination
]
[from value_changed to TransInd.translation
]
-->
<PositionChaser DEF='PaintingPositionChaser' containerField='children'/> |
145 |
<!-- ROUTE information for PaintingOrientationChaser node:
[from Worker.indOri to set_destination
]
[from value_changed to TransInd.rotation
]
-->
<OrientationChaser DEF='PaintingOrientationChaser' containerField='children'/> |
146 | < ROUTE fromNode='Worker' fromField='indPos' toNode='PaintingPositionChaser' toField='set_destination'/> |
147 | < ROUTE fromNode='Worker' fromField='indOri' toNode='PaintingOrientationChaser' toField='set_destination'/> |
148 | < ROUTE fromNode='PaintingPositionChaser' fromField='value_changed' toNode='TransInd' toField='translation'/> |
149 | < ROUTE fromNode='PaintingOrientationChaser' fromField='value_changed' toNode='TransInd' toField='rotation'/> |
150 | </Scene> |
151 | </X3D> |
Event Graph ROUTE Table entries with 14 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 |
PaintingOrientationChaser
OrientationChaser set_destination SFRotation |
then
|
PaintingOrientationChaser
OrientationChaser value_changed SFRotation |
TransInd
Transform rotation SFRotation |
|||
then
|
Worker
Script indPos SFVec3f |
PaintingPositionChaser
PositionChaser set_destination SFVec3f |
then
|
PaintingPositionChaser
PositionChaser value_changed SFVec3f |
TransInd
Transform translation SFVec3f |
|||||
TouchFloor
TouchSensor touchTime SFTime |
Worker
Script touchedFloor SFTime |
then
|
Worker
Script indOri SFRotation |
PaintingOrientationChaser
OrientationChaser set_destination SFRotation |
then
|
PaintingOrientationChaser
OrientationChaser value_changed SFRotation |
TransInd
Transform rotation SFRotation |
|||
then
|
Worker
Script indPos SFVec3f |
PaintingPositionChaser
PositionChaser set_destination SFVec3f |
then
|
PaintingPositionChaser
PositionChaser value_changed SFVec3f |
TransInd
Transform translation SFVec3f |
TouchRoof
TouchSensor hitPoint_changed SFVec3f |
Worker
Script set_hitPoint SFVec3f |
then
|
Worker
Script indOri SFRotation |
PaintingOrientationChaser
OrientationChaser set_destination SFRotation |
then
|
PaintingOrientationChaser
OrientationChaser value_changed SFRotation |
TransInd
Transform rotation SFRotation |
|||
then
|
Worker
Script indPos SFVec3f |
PaintingPositionChaser
PositionChaser set_destination SFVec3f |
then
|
PaintingPositionChaser
PositionChaser value_changed SFVec3f |
TransInd
Transform translation SFVec3f |
|||||
TouchRoof
TouchSensor touchTime SFTime |
Worker
Script touchedRoof SFTime |
then
|
Worker
Script indOri SFRotation |
PaintingOrientationChaser
OrientationChaser set_destination SFRotation |
then
|
PaintingOrientationChaser
OrientationChaser value_changed SFRotation |
TransInd
Transform rotation SFRotation |
|||
then
|
Worker
Script indPos SFVec3f |
PaintingPositionChaser
PositionChaser set_destination SFVec3f |
then
|
PaintingPositionChaser
PositionChaser value_changed 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. -->