10. Prototypes

You can use a prototype to create a customized node that you can use it like any other standard VRML nodes in the scene. Since a prototyped node can be used as a black box entity, you can create a "canned object" and then create multiple independent copies of it throughout the scene.
A prototype node must follow the same rules in the scene as any of the standard VRML nodes, including Grouping. You can do anything with a prototype node that you can do with an ordinary node: if you give it a name with the DEF keyword, then you can USE it elsewhere in the scene and also route events to and from any event fields declared in that prototype.
The syntax of a prototype node is a little bit different from what you may be used to seeing. The prototype declaration consist of three parts: name, field definitions, and implementation(you can think of some similarities with JAVA:class name, class variable and class implementation).
Prototype declarations are started by the keyword PROTO and then the name that you wish to call it:

PROTO myprototype

The field and event declarations are enclosed in a pair of square brackets: they are declared just as you would see them in a written for a node in the specification.

Show the prototype example
#VRML V2.0 utf8

PROTO SimpleShape [
	exposedField SFNode myGeometry NULL
	exposedField SFColor myColor 0 0 0
	]
	{
	Shape {
	appearance Appearance {
		material Material { emissiveColor IS myColor }
	}
	geometry IS myGeometry
	}
}
#now let's create objects based on the PROTO
Transform {
translation -2 0 0
children [
	SimpleShape {
		myColor 1 0 0
		myGeometry Box {}
	}
  ]
}
Transform {
translation 2 0 0
children [
	SimpleShape {
		myColor 0 0 1
		myGeometry Sphere {}
	}
  ]
}