#VRML V2.0 utf8 #
##ex-normalinterpolator.wrl # example of NormalInterpolator ## the interpolator interpolates the value of normals associated ## to the vertices of a IndexedFaceSet (actually 1 surface) # Camera Viewpoint { position 1 6 1 orientation 1 0 0 -1.5 fieldOfView 0.785398 } # define the geometry Transform { translation -1 0 -1 children [ Shape { geometry IndexedFaceSet { ccw TRUE # normal following the direction # of the right hand rule (see coordIndex # order under); so pointing to the viewer solid FALSE # when FALSE polygon sides are always # displayed regardless of the viewing direction coordIndex [ 0,1,2, -1 ] # defining a face coord Coordinate { point [ 0 0 0, 2.5 0 3.5, 0 0 2, 2 3 2 ] } # defining and associating colors to vertices colorIndex [ 0,1,2,-1] colorPerVertex TRUE # signalizes we use one color per face color Color { color [ 1 0 0 , 1 1 0 , 0 1 0] } # defining and associating normals to vertices normalIndex [ 0,1,2,-1] normalPerVertex TRUE normal DEF NORM Normal { vector [ 0 1 0, 0 -1 0, 0 1 0 ] } } } ] } # Timer DEF TIMER TimeSensor { loop TRUE cycleInterval 4 } # Interpolation of Normals DEF INTERP NormalInterpolator { key [ 0, 0.25, 0.5, 0.75, 1.] keyValue [ 0 1 0, 0 1 0, 0 1 0, 0 -1 0, 0 1 0, 0 1 0, 0 -1 0, 0 -1 0, 0 1 0 0 -1 0, 0 -1 0, 0 -1 0 0 -1 0, 0 -1 0, 0 -1, 0 ] } #run interpolator : INTERP ROUTE TIMER.fraction_changed TO INTERP.set_fraction #associate interpolator and geometry : ROUTE INTERP.value_changed TO NORM.set_vector #