The Annotated VRML 97 Reference

1 Intro     Concepts     3 Nodes     4 Fields/Events    Conformance
A Grammar     B Java     C JavaScript     D Examples     E Related Info    References
Quick Java         Quick JavaScript         Quick Nodes   
 

  About the Book
  
Help
  Copyright © 1997-99
  Purchase the book from Amazon.com

 

Appendix H:
JavaScript API
Summary


Functions

Browser Object

SF Objects

MF Objects

Miscellaneous

 

 

 

 

 

 

 

 

 

Appendix H:
JavaScript API
Summary


Functions

Browser Object

SF Objects

MF Objects

Miscellaneous

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Appendix H:
JavaScript API
Summary


Functions

Browser Object

SF Objects

MF Objects

Miscellaneous

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Appendix H:
JavaScript API
Summary


Functions

Browser Object

SF Objects

MF Objects

Miscellaneous

Appendix H
Summary of JavaScript Scripting API

Functions

void    eventsProcessed( ) 
void    initialize( ) 
void    shutdown( )
numeric parseInt( String string, [radix] )
numeric parseFloat( String string )

Browser Object

Methods: String  browser.getName( )
         String  browser.getVersion( )
         numeric browser.getCurrentSpeed( )
         numeric browser.getCurrentFrameRate( )
         String  browser.getWorldURL( )
         void    browser.replaceWorld( MFNode nodes )
         MFNode  browser.createVrmlFromString(
                                        String vrmlSyntax )
         void    browser.createVrmlFromURL(
                       MFString url, Node node, String event )
         void    browser.addRoute( SFNode fromNode,
                                   String fromEventOut,
                                   SFNode toNode,
                                   String toEventIn)
         void    browser.deleteRoute( SFNode fromNode,
                                      String fromEventOut,
                                      SFNode toNode,
                                      String toEventIn )
         void    browser.loadURL( MFString url,
                                  MFString parameter )
         void    browser.setDescription( String description )

---------- separator bar ------------
SF Objects

color = new SFColor( float r, float g, float b )
Properties: numeric color.r or color[0]
            numeric color.g or color[1]
            numeric color.b or color[2]
Methods: void       color.setHSV( float h, float s, float v )
         numeric[3] color.getHSV( )
         String     color.toString( )

image = new SFImage( numeric x, numeric y,
                       numeric comp, MFInt32 array )
Properties: MFInt32 image.array
            numeric image.comp
            numeric image.x  numeric image.y  numeric image.z
Methods: String image.toString( )

node = new SFNode( String vrmlstring ) 
Properties: node.eventName  (eventIns and eventOuts of the node)
Methods: String node.toString( )

rotation = new SFRotation( numeric x, numeric y, numeric z,
                             numeric angle )
rotation = new SFRotation( SFVec3f axis, numeric angle )
rotation = new SFRotation( SFVec3f fromVector,
                             SFVec3f toVector )
Properties: numeric rotation.x or rotation[0]
            numeric rotation.y or rotation[1]
            numeric rotation.z or rotation[2]
            numeric rotation.angle or rotation[3]
Methods: SFVec3f    rotation.getAxis( )
         SFRotation rotation.inverse( )
         SFRotation rotation.multiply( SFRotation rot )
         SFVec3f    rotation.multVec( SFVec3f vec )
         void       rotation.setAxis( SFVec3f vec )
         SFRotation rotation.slerp( SFRotation dest,
                                    numeric t ) 
         String     rotation.toString( )

vec2f = new SFVec2f( numeric x, numeric y )
Properties: numeric vec2f.x or vec2f[0]
            numeric vec2f.y or vec2f[1]
Methods: SFVec2f vec2f.add( SFVec2f vec )
         SFVec2f vec2f.divide( numeric n )
         numeric vec2f.dot( SFVec2f vec )
         numeric vec2f.length( )
         SFVec2f vec2f.multiply( numeric n )
         SFVec2f vec2f.normalize( )
         SFVec2f vec2f.subtract( SFVec2f vec )
         String  vec2f.toString( )

vec3f = new SFVec3f( numeric x, numeric y, numeric z ) 
Properties: numeric vec3f.x or vec3f[0]
            numeric vec3f.y or vec3f[1]
            numeric vec3f.z or vec3f[2]
Methods: SFVec3f vec3f.add( SFVec3f vec )
         SFVec3f vec3f.cross( SFVec3f vec )
         SFVec3f vec3f.divide( numeric n )
         numeric vec3f.dot( SFVec3f vec )
         numeric vec3f.length( )
         SFVec3f vec3f.multiply( numeric n )
         SFVec3f vec3f.negate( )
         SFVec3f vec3f.normalize( )
         SFVec3f vec3f.subtract( SFVec3f vec )
         String  vec3f.toString( )

---------- separator bar ------------
MF Objects

colorArray = new MFColor( SFColor c1, SFColor c2, ... ) 
Properties: numeric colorArray.length
Methods: SFColor colorArray[i]
         String  colorArray.toString( )

floatArray = new MFFloat( numeric n1, numeric n2, ... ) 
Properties: SFFloat floatArray[i]
            numeric floatArray.length
Methods: String floatArray.toString( )

intArray = new MFInt32( numeric n1, numeric n2, ... ) 
Properties: SFInt32 intArray[i]
            numeric intArray.length
Methods: String intArray.toString( )

nodeArray = new MFNode( SFNode n1, SFNode n2, ... ) 
Properties: SFNode nodeArray[i]
            numeric nodeArray.length
Methods: String nodeArray.toString( )

rotArray = new MFRotation( SFRotation r1, SFRotation r2,...) 
Properties: SFRotation rotArray[i]
            numeric rotArray.length
Methods: String rotArray.toString( )

stringArray = new MFString( SFString n1, SFString n2, ... ) 
Properties: SFFloat stringArray[i]
            numeric stringArray.length
Methods: String stringArray.toString( )

vecArray = new MFVec2f( SFVec2f v1, SFVec2f v2, ... ) 
Properties: SFFloat vecArray[i]
            numeric vecArray.length
Methods: String vecArray.toString( )

vecArray = new MFVec3f( SFVec3f v1, SFVec3f v2, ... ) 
Properties: SFFloat vecArray[i]
            numeric vecArray.length
Methods: String vecArray.toString( )

---------- separator bar ------------
Miscellaneous

mx = new VrmlMatrix(
            numeric f11, numeric f12, numeric f13, numeric f14,
            numeric f21, numeric f22, numeric f23, numeric f24,
            numeric f31, numeric f32, numeric f33, numeric f34,
            numeric f41, numeric f42, numeric f43, numeric f44 )
mx = new VrmlMatrix( )
Properties: mx[i][j]  (e.g. mx[2][1] = f21)
Methods: void mx.setTransform(
                   SFVec3f translation, SFRotation rotation,
                   SFVec3f scale, SFRotation scaleOrientation, 
                   SFVec3f center ) 
         void mx.getTransform( SFVec3f translation,
                   SFRotation rotation, SFVec3f scale) 
         VrmlMatrix mx.inverse( ) 
         VrmlMatrix mx.transpose( ) 
         VrmlMatrix mx.multLeft( VrmlMatrix matrix ) 
         VrmlMatrix mx.multRight( VrmlMatrix matrix ) 
         SfVec3f    mx.multVecMatrix( SFVec3f vec ) 
         SFVec3f    mx.multMatrixVec( SFVec3f vec ) 
         String     mx.toString( )