http://www.sgi.com/tech/Inventor/VRML/TrackLight.html (Silicon Surf Promotional CD, 01/1995)
#Inventor V2.0 ascii
# By putting the light underneath a TransformSeparator,
# the transforms have only a local effect, but the
# transformed light will affect objects outside the
# TransformSeparator.
TransformSeparator {
# This Translate1Dragger/Translation pair serves
# to slide the plank left and right within the room
DEF PLANK_DRAGGER Translate1Dragger {
translation 0 20 0
translator DEF PLANK_GEOM Separator {
Material { emissiveColor .1 .3 .3 }
Cube { width .5 height .5 depth 20 }
}
translatorActive USE PLANK_GEOM
}
Translation { translation = USE PLANK_DRAGGER . translation }
# This rotated Translate1Dragger/Translation pair serves
# to slide the bulb socket forward and back along the plank
RotationXYZ { axis Y angle 1.57079 }
DEF SOCKET_DRAGGER Translate1Dragger {
translator DEF SOCKET_GEOM Separator {
Material { emissiveColor .3 .1 .3 }
Cylinder { radius .5 height 1 }
}
translatorActive USE SOCKET_GEOM
}
Translation { translation = USE SOCKET_DRAGGER . translation }
# This RotateSphericalDragger/Rotation pair serves to rotate
# the bulb relative to its mount point in the bulb socket.
DEF BULB_DRAGGER RotateSphericalDragger {
rotation 1 0 0 -1.57079
rotator DEF BULB_GEOM Separator {
Material { emissiveColor .3 .3 .1 }
RotationXYZ { axis X angle 1.57079 }
Translation { translation 0 -1 0 }
Cone { height 2 }
Translation { translation 0 2 0 }
Cylinder { radius .1 height 2 }
}
rotatorActive USE BULB_GEOM
feedback Separator {}
feedbackActive Separator {}
}
Rotation { rotation = USE BULB_DRAGGER . rotation }
# At this point, the light has been transformed by the
# preceding Translation and rotation nodes. So the light
# appears to emit from the conical BULB_DRAGGER
SpotLight {
# The intensity and cutOffAngle of the spotlight
# are controlled by the previously defined DIMMERs
# DecomposeVec3f engines extract the x values from their
# translations.
intensity = DecomposeVec3f {
vector = DEF INTENSITY_DIMMER Translate1Dragger {
# Start at intensity of .5
translation .5 0 0
translator DEF DIMMER_GEOM Separator {
Cube { width .2 height .2 depth .2 }
}
translatorActive USE DIMMER_GEOM
} . translation
} . x
cutOffAngle = DecomposeVec3f {
vector = DEF ANGLE_DIMMER Translate1Dragger {
# Start with angle of .5 radians
translation .5 0 0
translator DEF ANGLE_DIMMER_GEOM Separator {
RotationXYZ { axis Z angle -1.57079 }
Cone { bottomRadius .1 height .2 }
}
translatorActive USE ANGLE_DIMMER_GEOM
} . translation
} . x
}
}
# Draw the DIMMERs. They are arranged on a panel which remains
# stationary when the track light parts are dragged around.
Separator {
Transform { rotation 1 0 0 1.57079 translation 0 10 -10 scaleFactor 5 5 5 }
RotationXYZ { axis Y angle 1.57079 }
# The panel
Separator {
Material { diffuseColor .6 .6 1 emissiveColor .6 .6 1 }
Translation { translation .6 0 0 }
Cube { width 1.2 height .01 depth .75 }
}
# The Dimmers
Separator {
Material { diffuseColor .25 .5 .25 emissiveColor .25 .5 .25 }
Translation { translation 0 0 -.25 }
USE INTENSITY_DIMMER
Translation { translation 0 0 .5 }
USE ANGLE_DIMMER
}
}