One of the most exciting new features of Web Driver 3.0 is the generic mesh
object. A generic mesh is a new flavor of WTModel that allows you to
create geometry on the fly by defining vertices, polygons, vertex normals,
and UV coordinates.
The scene above lets you create a generic mesh by using one of the most powerful
methods in the generic mesh API, sweep. This method allows you to turn
a series of vertices into a revolved mesh by sweeping them through some angle.
You may know this type of geometry as a "lathe" or "surface of revolution."
In the scene above, click to create new vertices. If you want to move a vertex
once it's been created, just drag it. When you are finished placing your
vertices, fill in the attributes and click the "Sweep" button. These attributes
are the parameters of the sweep method. A mesh is created by sweeping
the vertices around the axis (red line). Finally, drag the mouse to spin
the model and use +/- to scale.
You have complete control over all attributes of a generic mesh.
Awesome effects can be achieved by making real-time changes to things like
vertex position, UV coordinates, and vertex normals.
Like other WTModels, a generic mesh must first be attached
to a WTGroup before it can be added to the stage.
It's possible to make the mesh inside-out depending upon which order
you create your vertices. You'll get the same effect if your
startAngle is greater than your endAngle.
You'll need to call updateNormals any time you have just
completed building a mesh. This corrects how the mesh will be affected
by scene lighting.
This lab doesn't have the option for it, but you can also specify the
world-space axis of revolution for the mesh. This lab just uses Y or 0, 1, 0,
which is shown as the red line.
You can specify the origin or frame of reference of the mesh as well.
This lab just uses 0, 0, 0. This feature may be helpful, say, if you wanted
the origin of your wine glass to be at the center of the base rather than
somewhere along the stem.
If you try to call methods specific to generic mesh on a regular
WTModel, you will get a script error.