Shape Node
The shape node is one of the most commonly used nodes in VRML. A shape node is used to define any kind of object in VRML. The following code creates a generic Box with generic appearance:
Shape {
appearance Appearance {}
geometry Box {}
}
Another commonly used feature is the DEF and the USE statement. DEF allows the programmer to reuse commonly used pieces of code. For instance, in the world a designer is creating, all objects will appear with the same diffuse color and shininess. The designer writes the following code segment:
material DEF object_color Material {
DiffuseColor .7 .7 .7
Shininess .5
}
The designer can than resuse this code with the USE statement. The following uses the the above code:
Shape {
appearance Appearance {
Material USE object_color
}
geometry Box {}
}