[x3d-public] Anchor target within scene: code example

Joseph D Williams joedwil at earthlink.net
Thu Jan 24 17:56:20 PST 2019


Detail added below


From: Joseph D Williams
Sent: Thursday, January 24, 2019 4:36 PM
To: Albert Jan Wonnink; x3d-public at web3d.org; Brutzman, Donald (Don) (CIV); Nicholas Polys
Subject: Re: [x3d-public] Anchor target within scene: code example


Anchor always loads a new scene and goes to a defined viewpoint or directly to another 
viewpoint in the same scene. 
If you want to do something else then customize isactive and/or isover of pointing device(s) along with some routes and maybe some utility nodes, or even a script. How can an anchor know that all you want to do is change all or some part of a scene somewhere in some other part of the scene you are in?  

Pointing device
Group of Buttons...

  ...     DEF Stop_Text Transform { translation 0 0.4 0
       children [
        DEF Stop_Touch TouchSensor {  }
        DEF StopText Shape {
         appearance Appearance { material USE text_color }
         geometry Text { string ["Stop"] 
          fontStyle FontStyle {
            family [ "SANS"  ] 
          }
         }
        }
        DEF Stop_Back Shape {
         appearance Appearance { material USE Clear }
        geometry USE Backing
        }
       ]
      }
... 
ROUTE Stop_Touch.touchTime or isOver or isActive TO 
Some utility node or script that changes whatever 
you want to change. 

There may be better devices. For instance they could all be there and you just turn on the one(s) you want to show. 
And, if you move to a selected viewpoint there are plenty of triggers to capture movement and gaze and set features for decoration, touch, and isover, I would say. 

Here is one in x3d the scene gets built using one inline, then inline changed using touchsensor and small script.

...
<Transform DEF='MainSceneNode' scale='3 3 3'>
  <TouchSensor DEF='NextSensor'/>
  <Inline DEF='MainScene' url='"Instancing.x3dv" ""'/>
</Transform>

<Script DEF='LoadNewURL' url='"RouteURLFieldChange.js" ""'> 
  <field name='znext' accessType='inputOnly' type='SFBool'/> 
  <field name='newurl' accessType='outputOnly' type='MFString'/> 
  <field name='nexturl' accessType='initializeOnly' type='MFString' 
    value='"RedSphereBlueBox.x3dv" ""'/>

function znext (value,ts) { if(value == true) { newurl = nexturl; } }

</Script>


<ROUTE fromNode='NextSensor' fromField='isActive' 
       toNode='LoadNewURL'   toField='znext'/>
<ROUTE fromNode='LoadNewURL' fromField='newurl' 
       toNode='MainScene'    toField='url'/>


Maybe keep in mind how html/css does stuff like this and the interfaces you need to make it happen. x3d no CSS yet. However, what would the style be for an anchor that is not really an anchor but is really some other type of control that actually handles different sets of features than an expected anchor input from the simulation? 

Thanks and Best, 
Joe


From: Albert Jan Wonnink
Sent: Wednesday, January 23, 2019 5:25 PM
To: x3d-public at web3d.org; Brutzman, Donald (Don) (CIV); Nicholas Polys
Subject: Re: [x3d-public] Anchor target within scene: code example

Hi Don,

the code behind the pages could be something like this

mainPage.x3d:
<X3D>
 <Scene>
 <!--first menu-->
  <Transform translation="-1 1 3">
   <!--first item-->
   <Transform translation="0 0 0">
    <Anchor url="'menu2_1.x3d'" parameter="'target=menu2'">
     <Shape …
    </Anchor>
 </Transform>
   <!--second item-->
   <Transform translation="0 -0.2 0">
    <Anchor url="'menu2_2.x3d'" parameter="'target=menu2'">
     <Shape …
    </Anchor>
 </Transform>
  <!--third item-->
...
</Transform>
<!--position menu2-->
<Transform translation="0 1 3">
  <Inline DEF="menu2"></Inline>
</Transform>
<!--position models to display-->
<Transform translation="1 1 3">
  <Inline DEF="modelsToDisplay"></Inline>
</Transform>
</Scene>
</X3D>


For each 'submenu' there is a separate file 
menu2_1.x3d ( menu2_2.x3d, …)
<X3D>
 <Scene>
 <!--first menu-->
  <Transform>
   <!--first item-->
   <Transform translation="0 0 0">
    <Anchor url="'model_1.x3d'" parameter="'target=modelsToDisplay'">
     <Shape …
    </Anchor>
 </Transform>
   <!--second item-->
   <Transform translation="0 -0.2 0">
    <Anchor url="'menu2_2.x3d'" parameter="'target=modelsToDisplay'">
     <Shape …
    </Anchor>
 </Transform>
  <!--third item-->
...
</Transform>
</Scene>
</X3D>

And there are the files that actually contain the models:
model_1.x3d, model_2.x3d ...

I think the bottom line is to allow the 'target' parameter not only have the predefined values (_blank, _self etc.) or frame names of the html page, but also allow the names of the inlines as a target.

Regards,

Albert Jan

Sent from Mail for Windows 10



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190124/81506c1c/attachment-0001.html>


More information about the x3d-public mailing list