| 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='2 December 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://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 23 | <meta name='license' content='../../license.html'/> |
| 24 | </head> |
| 25 | <Scene> |
| 26 | <WorldInfo title='RoomDesired.x3d'/> |
| 27 | <ExternProtoDeclare name='Selection' url=' "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 | <!-- "urn:inet:blaxxun.com:node:Selection" --> |
| 29 | <field name='select' type='SFBool' accessType='inputOutput'/> |
| 30 | <field name='addChildren' type='MFNode' accessType='inputOnly'/> |
| 31 | <field name='bboxCenter' type='SFVec3f' accessType='initializeOnly'/> |
| 32 | <field name='removeChildren' type='MFNode' accessType='inputOnly'/> |
| 33 | <field name='children' type='MFNode' accessType='inputOutput'/> |
| 34 | <field name='proxy' type='SFNode' accessType='initializeOnly'/> |
| 35 | <field name='bboxSize' type='SFVec3f' accessType='initializeOnly'/> |
| 36 | <field name='collide' type='SFBool' accessType='inputOutput'/> |
| 37 | </ExternProtoDeclare> |
| 38 | <Background skyColor='0.1 0.2 0.3'/> |
| 39 | <Viewpoint description='inside' fieldOfView='0.785' orientation='-1.0 -0.0 0.0 0.105' position='-0.0 1.7 7.985'/> |
| 40 | <Viewpoint description='outside' fieldOfView='0.785' orientation='-1.0 0.0 0.0 0.105' position='0.0 2.068 13.879'/> |
| 41 | <NavigationInfo avatarSize='0.25 1.2 0.75' headlight='false'/> |
| 42 | <DirectionalLight intensity='0.5'/> |
| 43 | <PointLight location='2.5 1.0 0.0' radius='20.0'/> |
| 44 | <DirectionalLight direction='0.0 -1.0 0.0'/> |
| 45 | <DirectionalLight intensity='0.5'/> |
| 46 | <Group> |
| 47 |
<!-- 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'/> |
| 48 | <Shape> |
| 49 | <Appearance> |
| 50 | <TextureTransform scale='17.0 17.0'/> |
| 51 |
<ImageTexture
url=' "floor.png
" "https://www.web3d.org/x3d/content/examples/Basic/Followers/floor.png
" '/>
|
| 52 | </Appearance> |
| 53 | <Box size='10.0 0.1 10.0'/> |
| 54 | </Shape> |
| 55 | </Group> |
| 56 | <Group> |
| 57 |
<!-- 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'/> |
| 58 | <Transform translation='0.0 1.5 -5.0'> |
| 59 | |
| 60 | <Appearance> |
| 61 | <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'/> |
| 62 | </Appearance> |
| 63 | <Box size='10.0 3.0 0.1'/> |
| 64 | </Shape> |
| 65 | </Transform> |
| 66 | </Group> |
| 67 | <Group> |
| 68 |
<!-- 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'/> |
| 69 | <Transform rotation='0.0 1.0 0.0 -1.571' translation='-5.0 1.5 0.0'> |
| 70 | <Shape USE='ShWall'/> |
| 71 | </Transform> |
| 72 | </Group> |
| 73 | <Group> |
| 74 |
<!-- 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'/> |
| 75 | <Transform rotation='0.0 1.0 0.0 1.571' translation='5.0 1.5 0.0'> |
| 76 | <Shape USE='ShWall'/> |
| 77 | </Transform> |
| 78 | </Group> |
| 79 | <Group> |
| 80 |
<!-- 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'/> |
| 81 | <Transform translation='0.0 3.0 0.0'> |
| 82 | <Shape> |
| 83 | <Appearance> |
| 84 | <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'/> |
| 85 | </Appearance> |
| 86 | <Box size='10.0 0.1 10.0'/> |
| 87 | </Shape> |
| 88 | </Transform> |
| 89 | </Group> |
| 90 | <ProtoInstance name='Selection'> |
| 91 | <fieldValue name='select' value='false'/> |
| 92 | <fieldValue name='children'> |
| 93 |
<!-- 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'> |
| 94 | <Transform scale='0.223 0.341 0.5'> |
| 95 | <Shape> |
| 96 | <Appearance> |
| 97 |
<ImageTexture
url=' "Photo.jpg
" "https://www.web3d.org/x3d/content/examples/Basic/Followers/Photo.jpg
" '/>
|
| 98 | </Appearance> |
| 99 | <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'> |
| 100 |
<!-- 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'/> |
| 101 | <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'/> |
| 102 | </IndexedFaceSet> |
| 103 | </Shape> |
| 104 | <Shape> |
| 105 | <Appearance> |
| 106 |
<ImageTexture
url=' "Shadow.png
" "https://www.web3d.org/x3d/content/examples/Basic/Followers/Shadow.png
" '/>
|
| 107 | </Appearance> |
| 108 | <IndexedFaceSet coordIndex='0 1 2 3 -1'> |
| 109 | <TextureCoordinate USE='SquareTextureCoordinatePoints'/> |
| 110 | <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'/> |
| 111 | </IndexedFaceSet> |
| 112 | </Shape> |
| 113 | </Transform> |
| 114 | </Transform> |
| 115 | </fieldValue> |
| 116 | </ProtoInstance> |
| 117 |
<!-- 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'> |
| 118 | <field name='set_hitPoint' type='SFVec3f' accessType='inputOnly'/> |
| 119 | <field name='touchedWallLeft' type='SFTime' accessType='inputOnly'/> |
| 120 | <field name='indPos' type='SFVec3f' accessType='outputOnly'/> |
| 121 | <field name='touchedWallRight' type='SFTime' accessType='inputOnly'/> |
| 122 | <field name='cRoomDepth' type='SFFloat' value='9.9' accessType='initializeOnly'/> |
| 123 | <field name='cPaintingWidth' type='SFFloat' value='1.561' accessType='initializeOnly'/> |
| 124 | <field name='cFloorY' type='SFFloat' value='0.05' accessType='initializeOnly'/> |
| 125 | <field name='cPaintingHeight' type='SFFloat' value='2.046' accessType='initializeOnly'/> |
| 126 | <field name='touchedWallFront' type='SFTime' accessType='inputOnly'/> |
| 127 | <field name='touchedFloor' type='SFTime' accessType='inputOnly'/> |
| 128 | <field name='touchedRoof' type='SFTime' accessType='inputOnly'/> |
| 129 | <field name='indOri' type='SFRotation' accessType='outputOnly'/> |
| 130 | <field name='cRoomHeight' type='SFFloat' value='2.9' accessType='initializeOnly'/> |
| 131 | <field name='cRoomWidth' type='SFFloat' value='9.9' accessType='initializeOnly'/> |
| 132 | <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;
}
]]>
|
|
| 134 | </Script> |
| 135 | < ROUTE fromNode='TouchFloor' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/> |
| 136 | < ROUTE fromNode='TouchWallLeft' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/> |
| 137 | < ROUTE fromNode='TouchWallRight' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/> |
| 138 | < ROUTE fromNode='TouchWallFront' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/> |
| 139 | < ROUTE fromNode='TouchRoof' fromField='hitPoint_changed' toNode='Worker' toField='set_hitPoint'/> |
| 140 | < ROUTE fromNode='TouchFloor' fromField='touchTime' toNode='Worker' toField='touchedFloor'/> |
| 141 | < ROUTE fromNode='TouchWallLeft' fromField='touchTime' toNode='Worker' toField='touchedWallLeft'/> |
| 142 | < ROUTE fromNode='TouchWallRight' fromField='touchTime' toNode='Worker' toField='touchedWallRight'/> |
| 143 | < ROUTE fromNode='TouchWallFront' fromField='touchTime' toNode='Worker' toField='touchedWallFront'/> |
| 144 | < ROUTE fromNode='TouchRoof' fromField='touchTime' toNode='Worker' toField='touchedRoof'/> |
| 145 |
<!-- ROUTE information for PaintingPositionChaser node:
[from Worker.indPos to set_destination
]
[from value_changed to TransInd.translation
]
-->
<PositionChaser DEF='PaintingPositionChaser' containerField='children'/> |
| 146 |
<!-- ROUTE information for PaintingOrientationChaser node:
[from Worker.indOri to set_destination
]
[from value_changed to TransInd.rotation
]
-->
<OrientationChaser DEF='PaintingOrientationChaser' containerField='children'/> |
| 147 | < ROUTE fromNode='Worker' fromField='indPos' toNode='PaintingPositionChaser' toField='set_destination'/> |
| 148 | < ROUTE fromNode='Worker' fromField='indOri' toNode='PaintingOrientationChaser' toField='set_destination'/> |
| 149 | < ROUTE fromNode='PaintingPositionChaser' fromField='value_changed' toNode='TransInd' toField='translation'/> |
| 150 | < ROUTE fromNode='PaintingOrientationChaser' fromField='value_changed' toNode='TransInd' toField='rotation'/> |
| 151 | </Scene> |
| 152 | </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 |
|||||
| line 90
ProtoInstance Selection |
No direct ROUTE connection found for events to/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-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>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->