Listing 2
#VRML V2.0 utf8
# Define a PROTOtype:
# A Thing with a given center and color
PROTO Thing [
field SFVec3f center 0 0 0
field SFColor color 0.8 0 0
field SFNode thing NULL
] {
Transform {
translation IS center
children [
Shape {
appearance Appearance {
material Material {
diffuseColor IS color
}
}
geometry IS thing
}
]
}
}
# Use the PROTOtype for displaying various things
Thing { # Small red box at origin
thing Box { size 0.5 0.5 0.5 }
}
Thing { # Red sphere at 1.5 meters up from origin
center 0 1.5 0
thing Sphere { }
}
Thing { # Blue cone at 1 meter right from origin
center 1 0 0
color 0 0 0.8 g
thing Cone { }
}