instantreality forum
news: Welcome to the instantreality forums!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2017, 10:31:43 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: VRML to X3d  (Read 735 times)
mak
Newbie
*
Posts: 3


View Profile
« on: November 24, 2016, 06:42:48 pm »

Hello,



Trying hard, but ... no results ...

Can somebody help me to convert this VRML file into X3D?


Old VRML file:

*********************************************************

#VRML V2.0 utf8


Viewpoint { position -6 0 10
       orientation 0 1 0 -0.5 }

NavigationInfo { headlight FALSE }

Transform {
 translation -2.5 0 0
 children [
   DEF Wall Shape {
      appearance Appearance {
               material Material {
                     diffuseColor 1 1 0 }
                       }
         geometry Box {size 5 5 0.1}
         }
         ]
    }
Transform {
  translation 0 0 2.5
  rotation 0 1 0 -1.57
  children [ USE Wall ]
}

Transform {
  translation -2.5 -2.5 2.5
  rotation 1 0 0 1.57
  children [ USE Wall ]
}

Transform {
translation -2 2 2
rotation 1 0 0 0
 children [
   Shape { appearance Appearance { material Material { emissiveColor 0 0 1}}
      geometry Cone {height 1
                bottomRadius 0.5}
         }
   DEF Button TouchSensor {}
   DEF Light PointLight {on FALSE}
   ]
}

DEF turnonlight Script{
   eventIn SFTime lightswitch
   eventOut SFBool on
   field SFBool onoroff  FALSE
   url "vrmlscript:
      function lightswitch(){
         if (onoroff==true) {
         onoroff=false;
         on=false; }
         else{
         onoroff=true;
         on=true;}
      }" }

ROUTE Button.touchTime TO turnonlight.lightswitch
ROUTE turnonlight.on TO Light.on


***********************************************************


Thank You


Mak
Logged
mak
Newbie
*
Posts: 3


View Profile
« Reply #1 on: December 15, 2016, 07:03:01 pm »

I did it like that:

**********************************************

<html>
   <head>
    <meta http-equiv='X-UA-Compatible' content="IE=edge"/>
     <title>OnOff</title>
     <script type='text/javascript' src='http://www.x3dom.org/download/x3dom.js'></script>
     <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/download/x3dom.css'>

<script>
     function switcher()
     {
        if(document.getElementById("pl").getAttribute('on')=="false")
           document.getElementById("pl").setAttribute('on', 'true');
        else
           document.getElementById("pl").setAttribute('on', 'false');
     }
</script>

 
   </head>
   <body>

<x3d width='500px' height='500px'>
      
<scene>

<transform translation='-2 2 2' rotation='1 0 0 0'>

 
<shape onclick="switcher();">
   <appearance>
     <material emissiveColor='0 0 1'></material>
   </appearance>
<cone height='1' bottomRadius='0.5'></cone>     
  </shape>

<PointLight  id='pl' on='false'></PointLight>

      </transform>


<Viewpoint position='-6,0,12' orientation='0,1,0,-0.5'></Viewpoint>
<NavigationInfo headlight='false'  type='none'></NavigationInfo>

<Transform translation='-2.5 0 0'>
  <Shape DEF='Sciana'>
      <Appearance>
         <Material diffuseColor='1 1 0'></Material>
      </Appearance>                 
         <Box size='5 5 0.1'></Box>
</Shape>
</Transform>

<Transform translation='0 0 2.5' rotation='0 1 0 -1.57'>
  <Shape USE='Sciana'></Shape>
</Transform>

<Transform translation='-2.5 -2.5 2.5' rotation='1 0 0 1.57'>
  <Shape USE='Sciana'></Shape>
</Transform> 


</scene>
</x3d>
   
</body>
</html>

*****************************************************


is working


Logged
mak
Newbie
*
Posts: 3


View Profile
« Reply #2 on: December 15, 2016, 07:07:01 pm »

but another version converted by Instant Reality converter (VRML to X3DOM):

*******************************************************

<!DOCTYPE html>

  <head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'>
    <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'>
    <script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script>
  </head>
  <body>
    <x3d id='someUniqueId' showStat='false' showLog='false' x='0px' y='0px' width='400px' height='400px'>
      <scene DEF='scene'>
        <viewpoint orientation='0 1 0 -0.5' position='-6 0 10'></viewpoint>
        <navigationInfo headlight='false'></navigationInfo>
        <transform translation='-2.5 0 0'>
          <shape DEF='Sciana'>
            <appearance>
              <material diffuseColor='1 1 0'></material>
            </appearance>
            <box size='5 5 0.1'></box>
          </shape>
        </transform>
        <transform rotation='0 1 0 -1.57' translation='0 0 2.5'>
          <shape USE='Sciana'></shape>
        </transform>
        <transform rotation='1 0 0 1.57' translation='-2.5 -2.5 2.5'>
          <shape USE='Sciana'></shape>
        </transform>
        <transform translation='-2 2 2'>
          <shape>
            <appearance>
              <material emissiveColor='0 0 1'></material>
            </appearance>
            <cone bottomRadius='0.5' height='1'></cone>
          </shape>
          <touchSensor DEF='Wlacznik'></touchSensor>
          <pointLight DEF='Swiatlo' on='false'></pointLight>
        </transform>
        <script DEF='turnonlight'>
          <field accessType='inputOnly' name='lightswitch' type='SFTime'></field>
          <field accessType='outputOnly' name='on' type='SFBool'></field>
          <field accessType='initializeOnly' name='onoroff' type='SFBool' value='false'></field><![CDATA[javascript:
      function lightswitch(){
         if (onoroff==true) {
         onoroff=false;
         on=false; }
         else{
         onoroff=true;
         on=true;}
      }]]>
        </script>
        <ROUTE fromNode='Wlacznik' fromField='touchTime' toNode='turnonlight' toField='lightswitch'></ROUTE>
        <ROUTE fromNode='turnonlight' fromField='on' toNode='Swiatlo' toField='set_on'></ROUTE>
      </scene>
    </x3d>
  </body>
</html>


*******************************************************


does not work.



what is wrong in above code?


Thank You

Mak

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines