| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
| 3 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
| 4 | <head> |
| 5 | <component level='1' name='DIS'/> |
| 6 | <meta name='title' content=' NetworkedCamera.x3d '/> |
| 7 | <meta name='description' content='Networked control of master/slave viewpoints using DIS EspduTransform node.'/> |
| 8 | <meta name='creator' content='Alan Hudson and Don Brutzman'/> |
| 9 | <meta name='translator' content='LT Patrick Sullivan'/> |
| 10 | <meta name='created' content='19 April 2005'/> |
| 11 | <meta name='translated' content='19 April 2005'/> |
| 12 | <meta name='modified' content='9 October 2023'/> |
| 13 | <meta name=' warning ' content=' under development. will split into simple Inline-capable camera scene and usage example. Xj3D chat-server fallback needs to be checked. '/> |
| 14 | <meta name='reference' content=' http://www.xj3d.org/extensions/DIS.html '/> |
| 15 | <meta name='reference' content='http://www.yumetech.com'/> |
| 16 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/NetworkedCamera.x3d '/> |
| 17 | <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 18 | <meta name='license' content='../license.html'/> |
| 19 | </head> |
| 20 | <Scene> |
| 21 | <WorldInfo title='NetworkedCamera.x3d'/> |
| 22 | <Background groundAngle='1.45 1.57' groundColor='.005 .05 .03 .01 .13 .09 .025 .22 .17' skyAngle='.9 1.57' skyColor='0 0 .2 .1 .1 .8 .7 .7 1'/> |
| 23 | <Viewpoint description='Free Navigation' position='28.85 3.978 -98.85'/> |
| 24 |
<!-- ROUTE information for MasterViewpoint node:
[from isBound to ViewpointControlScript.bindMaster
]
[from isBound to WorldProximitySensor.enabled
]
-->
<Viewpoint DEF='MasterViewpoint' description='Master Viewpoint' orientation='0.001188 -1 -0.008389 -2.86' position='28.85 3.978 -98.85'/> |
| 25 |
<!-- ROUTE information for WorldProximitySensor node:
[from MasterViewpoint.isBound to enabled
]
[from position_changed to ViewpointControlScript.user_translation
]
[from orientation_changed to ViewpointControlScript.user_rotation
]
-->
<ProximitySensor DEF='WorldProximitySensor' size='1000000 1000000 1000000'/> |
| 26 |
<!-- ROUTE information for CameraEspduTransform node:
[from ViewpointControlScript.sharedTranslation to set_translation
]
[from ViewpointControlScript.sharedRotation to set_rotation
]
[from ViewpointControlScript.networkMode to networkMode
]
-->
<EspduTransform DEF='CameraEspduTransform' address='224.2.181.145' networkMode='networkWriter' port='62040' writeInterval='.01' containerField='children'> |
| 27 |
<!-- ROUTE information for SlavedViewpoint node:
[from isBound to ViewpointControlScript.bindSlave
]
-->
<Viewpoint DEF='SlavedViewpoint' description='Slaved Viewpoint' position='0 0 0'/> |
| 28 | </EspduTransform> |
| 29 |
<!-- ROUTE information for ViewpointControlScript node:
[from MasterViewpoint.isBound to bindMaster
]
[from SlavedViewpoint.isBound to bindSlave
]
[from WorldProximitySensor.position_changed to user_translation
]
[from WorldProximitySensor.orientation_changed to user_rotation
]
[from sharedTranslation to CameraEspduTransform.set_translation
]
[from sharedRotation to CameraEspduTransform.set_rotation
]
[from networkMode to CameraEspduTransform.networkMode
]
-->
<Script DEF='ViewpointControlScript'> |
| 30 | <field name='bindMaster' type='SFBool' accessType='inputOnly'/> |
| 31 | <field name='bindSlave' type='SFBool' accessType='inputOnly'/> |
| 32 | <field name='user_translation' type='SFVec3f' accessType='inputOnly'/> |
| 33 | <field name='user_rotation' type='SFRotation' accessType='inputOnly'/> |
| 34 | <field name='sharedTranslation' type='SFVec3f' accessType='outputOnly'/> |
| 35 | <field name='sharedRotation' type='SFRotation' accessType='outputOnly'/> |
| 36 | <field name='networkMode' type='SFString' accessType='outputOnly'/> |
| 37 | <field name='isMaster' type='SFBool' value='false' accessType='initializeOnly'/> |
| 38 | <field name='isSlave' type='SFBool' value='false' accessType='initializeOnly'/> |
<![CDATA[
ecmascript:
function bindMaster (value)
{
Browser.println ('[NetworkedCamera] Master viewpoint bound');
isMaster = value;
if (isMaster) networkMode ='networkWriter';
}
function bindSlave (value)
{
Browser.println ('[NetworkedCamera] Slave viewpoint bound');
isSlave = value;
if (isSlave) networkMode ='networkReader';
}
function user_translation(value)
{
if (isMaster) sharedTranslation = value;
}
function user_rotation(value)
{
if (isMaster) sharedRotation = value;
}
]]>
|
|
| 40 | </Script> |
| 41 | < ROUTE fromNode='MasterViewpoint' fromField='isBound' toNode='ViewpointControlScript' toField='bindMaster'/> |
| 42 | < ROUTE fromNode='MasterViewpoint' fromField='isBound' toNode='WorldProximitySensor' toField='enabled'/> |
| 43 | < ROUTE fromNode='SlavedViewpoint' fromField='isBound' toNode='ViewpointControlScript' toField='bindSlave'/> |
| 44 | < ROUTE fromNode='WorldProximitySensor' fromField='position_changed' toNode='ViewpointControlScript' toField='user_translation'/> |
| 45 | < ROUTE fromNode='WorldProximitySensor' fromField='orientation_changed' toNode='ViewpointControlScript' toField='user_rotation'/> |
| 46 | < ROUTE fromNode='ViewpointControlScript' fromField='sharedTranslation' toNode='CameraEspduTransform' toField='set_translation'/> |
| 47 | < ROUTE fromNode='ViewpointControlScript' fromField='sharedRotation' toNode='CameraEspduTransform' toField='set_rotation'/> |
| 48 | < ROUTE fromNode='ViewpointControlScript' fromField='networkMode' toNode='CameraEspduTransform' toField='networkMode'/> |
| 49 | <!-- ====================================================== --> |
| 50 | <!-- Integrate heads-up display with onscreen networkMode selection and position/orientation tracing --> |
| 51 | <!-- use of HeadsUpDislay and ViewPositionOrientation prototypes will be helpful if Xj3D supports them --> |
| 52 | <!-- consider entity discovery as well --> |
| 53 | <!-- ====================================================== --> |
| 54 | <!-- Example background viewing scene, split out into separate example next --> |
| 55 | <Background groundAngle='1.45 1.57' groundColor='.005 .05 .03 .01 .13 .09 .025 .22 .17' skyAngle='.9 1.57' skyColor='0 0 .2 .1 .1 .8 .7 .7 1'/> |
| 56 | <NavigationInfo speed='10' type='"WALK" "ANY"'/> |
| 57 | <Transform translation='0 -0.1 0'> |
| 58 | <Shape> |
| 59 | <Appearance> |
| 60 | <PixelTexture DEF='PT' image='2 2 3 0x0 0x00FF00 0x0000FF 0xFF0000'/> |
| 61 | <TextureTransform scale='100 100'/> |
| 62 | </Appearance> |
| 63 | <IndexedFaceSet colorPerVertex='false' coordIndex='0 1 2 3 0 -1'> |
| 64 | <Coordinate point='1000 0 1000 1000 0 -1000 -1000 0 -1000 -1000 0 1000'/> |
| 65 | </IndexedFaceSet> |
| 66 | </Shape> |
| 67 | </Transform> |
| 68 | </Scene> |
| 69 | </X3D> |
Event Graph ROUTE Table entries with 8 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.
|
SlavedViewpoint
Viewpoint isBound SFBool |
ViewpointControlScript
Script bindSlave SFBool |
then
|
ViewpointControlScript
Script networkMode SFString |
CameraEspduTransform
EspduTransform networkMode SFString |
||
|
then
|
ViewpointControlScript
Script sharedRotation SFRotation |
CameraEspduTransform
EspduTransform set_rotation SFRotation |
||||
|
then
|
ViewpointControlScript
Script sharedTranslation SFVec3f |
CameraEspduTransform
EspduTransform set_translation SFVec3f |
||||
<!--
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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->