start   previous   next

Shout3D™ 2.5 - Workflow Tutorial


Editing the scene file

Open your .wrl or .s3d file in a text editor and add the TimeSensor and OrientationInterpolator nodes and the ROUTE statements as indicated below. They are highlighted in boldface type on this page for clarity, but do not need to be boldface in your scene file. Add the DEF name TRANS to your Transform node, as is highlighted below, and add the rotation field to that node.

The code below is a VRML .wrl file, but the additions and changes in boldface are exactly the same for an .s3d file.


#VRML V2.0 utf8

DEF TRANS Transform {
  translation 0 0 0
  rotation 0 1 0 0	
  children [

    Shape {
      appearance Appearance {
        material Material {
          diffuseColor 0.5373 0.1961 0.1961
          ambientIntensity 0.1033
          specularColor 0.045 0.045 0.045
          shininess 0.2875
          transparency 0
        }
        texture ImageTexture {
          url "shoutlogo.gif"
        }
      }
      geometry IndexedFaceSet {
        coord Coordinate { point [
          -50 0 50, 50 0 50, -50 0 -50, 50 0 -50, -50 100 50, 50 100 50, 
          -50 100 -50, 50 100 -50]
        }
        texCoord TextureCoordinate { point [
          1 0, 0 0, 0 0, 0 0, 1 1, 0 1, 0 1, 0 1, 1 0, 1 1, 0 1, 
          0 1, 0 0, 1 0, 0 0, 1 0, 1 1, 1 1, 0 1, 0 0, 0 0, 1 0, 
          1 1, 1 1, 0 1, 0 0, 0 0, 1 0, 1 1, 1 1, 0 0, 1 0, 1 1, 
          1 1, 0 0, 1 1]
        }
        coordIndex [
          0, 2, 3, -1, 3, 1, 0, -1, 4, 5, 7, -1, 7, 6, 4, -1, 0, 1, 5, -1, 
          5, 4, 0, -1, 1, 3, 7, -1, 7, 5, 1, -1, 3, 2, 6, -1, 
          6, 7, 3, -1, 2, 0, 4, -1, 4, 6, 2, -1]
        texCoordIndex [
          8, 9, 10, -1, 11, 12, 13, -1, 14, 15, 16, -1, 17, 18, 19, -1, 
          20, 21, 22, -1, 23, 24, 25, -1, 26, 27, 28, -1, 29, 5, 1, -1, 
          30, 31, 32, -1, 33, 7, 3, -1, 34, 0, 35, -1, 4, 6, 2, -1]
        }
    }
  ]
}


DEF TIMER TimeSensor {
  cycleInterval 10
  loop TRUE
  startTime 0
}

DEF INTERP OrientationInterpolator {
  key [0, 1.0]
  keyValue [
            0 1 0 0,
            0 1 0 3.14
            ]
}


ROUTE TIMER.fraction_changed TO INTERP.set_fraction
ROUTE INTERP.value_changed To TRANS.set_rotation


Newcomers to VRML are typically unfamiliar with how rotation values are stated in axis-angle format. The first three of the four numbers indicate the axis (x, y, or z). The fourth number is the amount of rotation around that axis, measured in radians, not degrees. PI (3.14) radians is equal to 180 degrees. Thus the rotation value 0 1 0 3.14 means 180 degrees around the y axis.

Next>


Copyright© 1999-2001, Shout3D LLC.