<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<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
'
>
<head>
</head>
<!--
-->
<Scene>
<WorldInfo title='NetworkedCamera.x3d'/>
<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'/>
<Viewpoint description='Free Navigation' position='28.85 3.978 -98.85'/>
</EspduTransform>
<field name='bindMaster' type='SFBool' accessType='inputOnly'/>
<field name='bindSlave' type='SFBool' accessType='inputOnly'/>
<field name='user_translation' type='SFVec3f' accessType='inputOnly'/>
<field name='user_rotation' type='SFRotation' accessType='inputOnly'/>
<field name='sharedTranslation' type='SFVec3f' accessType='outputOnly'/>
<field name='sharedRotation' type='SFRotation' accessType='outputOnly'/>
<field name='networkMode' type='SFString' accessType='outputOnly'/>
<field name='isMaster' type='SFBool' value='false' accessType='initializeOnly'/>
<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;
}
]]>
</Script>
<
ROUTE
fromNode='
MasterViewpoint' fromField='isBound' toNode='
ViewpointControlScript' toField='bindMaster'/>
<
ROUTE
fromNode='
MasterViewpoint' fromField='isBound' toNode='
WorldProximitySensor' toField='enabled'/>
<
ROUTE
fromNode='
SlavedViewpoint' fromField='isBound' toNode='
ViewpointControlScript' toField='bindSlave'/>
<
ROUTE
fromNode='
WorldProximitySensor' fromField='position_changed' toNode='
ViewpointControlScript' toField='user_translation'/>
<
ROUTE
fromNode='
WorldProximitySensor' fromField='orientation_changed' toNode='
ViewpointControlScript' toField='user_rotation'/>
<
ROUTE
fromNode='
ViewpointControlScript' fromField='sharedTranslation' toNode='
CameraEspduTransform' toField='set_translation'/>
<
ROUTE
fromNode='
ViewpointControlScript' fromField='sharedRotation' toNode='
CameraEspduTransform' toField='set_rotation'/>
<
ROUTE
fromNode='
ViewpointControlScript' fromField='networkMode' toNode='
CameraEspduTransform' toField='networkMode'/>
<!-- ====================================================== -->
<!-- Integrate heads-up display with onscreen networkMode selection and position/orientation tracing -->
<!-- use of HeadsUpDislay and ViewPositionOrientation prototypes will be helpful if Xj3D supports them -->
<!-- consider entity discovery as well -->
<!-- ====================================================== -->
<!-- Example background viewing scene, split out into separate example next -->
<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'/>
<NavigationInfo speed='10' type='"WALK" "ANY"'/>
<Transform translation='0 -0.1 0'>
<Shape>
<Appearance>
<PixelTexture DEF='PT' image='2 2 3 0x0 0x00FF00 0x0000FF 0xFF0000'/>
<
TextureTransform scale='
100 100'/>
</Appearance>
<IndexedFaceSet colorPerVertex='false' coordIndex='0 1 2 3 0 -1'>
<Coordinate point='1000 0 1000 1000 0 -1000 -1000 0 -1000 -1000 0 1000'/>
</IndexedFaceSet>
</Shape>
</Transform>
</Scene>
</X3D>
<!--
-->
-->
<!--
Online at
https://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/NetworkedCameraIndex.html
-->
<!--
Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/NetworkedCamera.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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->