[x3d-public] [X3D-Public] camera, random path on a sphere around the center

John Carlson yottzumm at gmail.com
Sun Nov 29 11:01:06 PST 2015


I have taken the viewpoint tour from Joe's linked VRML below and put it into my JSON loader.  See a stripped down version of my loader at: http://coderextreme.net/X3DJSONLD/bubbles.html <http://coderextreme.net/X3DJSONLD/bubbles.html>

"Also consider use of the ProximitySensor. For example, try using
the sensor located at the center of interest. The sensor orientation 
output can tell you which way to look as you move the view.
Notice the possible relationship between the ProximitySensor
orientation_changed output and the ViewPoint orientation input. I have
an example around somewhere but also consider the Viewpoint 
CenterOfRotation if the interactor can also use manual navigation.
Good Luck,
Joe
http://www.hypermultimedia.com/x3d/viewpoint/SixViewpointTour2box.x3dv <http://www.hypermultimedia.com/x3d/viewpoint/SixViewpointTour2box.x3dv>
http://www.hypermultimedia.com/x3d/viewpoint/SixViewpointTour2.txt <http://www.hypermultimedia.com/x3d/viewpoint/SixViewpointTour2.txt>"

Below as text is the X3D for doing a random tour based Joe’s original viewpoint tour.  I don’t have a link for this because I want people to view in on their desktop.  Note that it doesn’t do a great circle tour as I would want.  Is there something in GeoVRML or GeoX3D that does a Great Circle Interpolator?  Thanks!


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance'>
    <Scene>
        <Viewpoint DEF='Tour' description='Tour Views'/>
        <Viewpoint position='0 0 4' description='sphere in road'/>
        <Background backUrl='"cubemap/BK.png" "http://coderextreme.net/X3DJSONLD/cubemap/BK.png"' bottomUrl='"cubemap/BT.png" "http://coderextreme.net/X3DJSONLD/cubemap/BT.png"' frontUrl='"cubemap/FR.png" "http://coderextreme.net/X3DJSONLD/cubemap/FR.png"' leftUrl='"cubemap/LF.png" "http://coderextreme.net/X3DJSONLD/cubemap/LF.png"' rightUrl='"cubemap/RT.png" "http://coderextreme.net/X3DJSONLD/cubemap/RT.png"' topUrl='"cubemap/TP.png" "http://coderextreme.net/X3DJSONLD/cubemap/TP.png"'/>
        <Transform DEF='Rose01'>
            <Shape>
                <Sphere/>
                <Appearance DEF='_01_-_Default'>
                    <Material diffuseColor='0.7 0.7 0.7' specularColor='0.5 0.5 0.5'/>
                    <!--ComposedCubeMapTexture containerField='texture'>
                        <ImageTexture url='"cubemap/BK.png" "http://coderextreme.net/X3DJSONLD/cubemap/BK.png"' containerField='back'/>
                        <ImageTexture url='"cubemap/BT.png" "http://coderextreme.net/X3DJSONLD/cubemap/BT.png"' containerField='bottom'/>
                        <ImageTexture url='"cubemap/FR.png" "http://coderextreme.net/X3DJSONLD/cubemap/FR.png"' containerField='front'/>
                        <ImageTexture url='"cubemap/LF.png" "http://coderextreme.net/X3DJSONLD/cubemap/LF.png"' containerField='left'/>
                        <ImageTexture url='"cubemap/RT.png" "http://coderextreme.net/X3DJSONLD/cubemap/RT.png"' containerField='right'/>
                        <ImageTexture url='"cubemap/TP.png" "http://coderextreme.net/X3DJSONLD/cubemap/TP.png"' containerField='top'/>
                    </ComposedCubeMapTexture>
                    <ComposedShader DEF='ComposedShader' containerField='shaders' language='GLSL'>
                        <field name='cube' accessType='inputOutput' type='SFInt32' value='0'/>
                        <field name='chromaticDispertion' accessType='inputOutput' type='SFVec3f' value='0.98 1 1.033'/>
                        <field name='bias' accessType='inputOutput' type='SFFloat' value='0.5'/>
                        <field name='scale' accessType='inputOutput' type='SFFloat' value='0.5'/>
                        <field name='power' accessType='inputOutput' type='SFFloat' value='2'/>
                        <ShaderPart url='"bubbles.vs" "http://coderextreme.net/X3DJSONLD/bubbles.vs"' containerField='parts'/>
                        <ShaderPart url='"bubbles.fs" "http://coderextreme.net/X3DJSONLD/bubbles.fs"' containerField='parts' type='FRAGMENT'/>
                    </ComposedShader-->
                </Appearance>
            </Shape>
        </Transform>
        <TimeSensor DEF='TourTime' cycleInterval='5' loop='true'/>
        <PositionInterpolator DEF='TourPosition' key='0 1' keyValue='0 0 10 0 0 -10'/>
        <OrientationInterpolator DEF='TourOrientation' key='0 1' keyValue='0 1 0 0 0 1 0 3.1416'/>
        <Script DEF='RandomTourTime'>
            <field accessType='inputOnly' name='set_fraction' type='SFFloat'/>
            <!--field name='key' accessType='inputOutput' type='MFFloat'/-->
            <field name='value_changed' accessType='inputOutput' type='SFFloat' value='0'/>
            <field name='orientations' accessType='inputOutput' type='MFRotation' value='0,1,0,0,0,1,0,-1.57,0,1,0,3.14,0,1,0,1.57,0,1,0,0,1,0,0,-1.57,0,1,0,0,1,0,0,1.57,0,1,0,0'/>
            <field name='positions' accessType='inputOutput' type='MFVec3f' value='0,0,10,-10,0,0,0,0,-10,10,0,0,0,0,10,0,10,0,0,0,10,0,-10,0,0,0,10'/>
            <field name='orientation_changed' accessType='inputOutput' type='MFRotation'/>
            <field name='position_changed' accessType='inputOutput' type='MFVec3f'/>
            ecmascript:
            
         
               function set_fraction(value) {
                        //var positions = [[0, 0, 10], [-10, 0, 0], [0, 0, -10], [10, 0, 0], [0, 0, 10], [0, 10, 0], [0, 0, 10], [0, -10, 0], [0, 0, 10]];
                        //var orientations = [[0, 1, 0, 0], [0, 1, 0, -1.57], [0, 1, 0, 3.14], [0, 1, 0, 1.57], [0, 1, 0, 0] [1, 0, 0, -1.57], [0, 1, 0, 0], [1, 0, 0, 1.57], [0, 1, 0, 0]];
                    //Browser.println(value);
                        var ov = value_changed;
                        Browser.println(ov);      
                        //Browser.println(positions.length);                  
                        value_changed = Math.round(Math.random()*positions.length);
                        Browser.println(value_changed);
                        var vc = value_changed;
                        
                        Browser.println(orientations[ov]);
                        Browser.println(orientations[vc]);
                        orientation_changed[0] = new SFRotation(orientations[ov][0], orientations[ov][1], orientations[ov][2], orientations[ov][3]);
                        orientation_changed[1] = new SFRotation(orientations[vc][0], orientations[vc][1], orientations[vc][2], orientations[vc][3]);
                        Browser.println(positions[ov]);
                        Browser.println(positions[vc]);
                        position_changed[0] = new SFVec3f(positions[ov]);
                        position_changed[1] = new SF3Vecf(positions[vc]);
                    // }
               }
        </Script>
        <ROUTE fromNode='TourTime' fromField='cycleTime' toNode='RandomTourTime' toField='set_fraction'/>
        <ROUTE fromNode='RandomTourTime' fromField='orientation_changed' toNode='TourOrientation' toField='keyValue'/>
        <ROUTE fromNode='RandomTourTime' fromField='position_changed' toNode='TourPosition' toField='keyValue'/>
        <ROUTE fromNode='TourTime' fromField='fraction_changed' toNode='TourOrientation' toField='set_fraction'/>
        <ROUTE fromNode='TourOrientation' fromField='value_changed' toNode='Tour' toField='set_orientation'/>
        <ROUTE fromNode='TourTime' fromField='fraction_changed' toNode='TourPosition' toField='set_fraction'/>
        <ROUTE fromNode='TourPosition' fromField='value_changed' toNode='Tour' toField='set_position'/>
    </Scene>
</X3D>

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


More information about the x3d-public mailing list