VRML_POLY Procedure

Constructs a surface or a solid described by a set of polygons.

Usage

VRML_POLY, vlist, plist 

Input Parameters

vlist—Vertex list (3,NVERT) of x, y, z coordinates for NVERT vertices of the polygons.

plist—Polygon list describing NPOLY polygons. (See the POLYSHADE function for more information about this parameter.)

Keywords

Use these keywords to set the object properties and material properties.

Object Properties

The following keywords describe or define the VRML polygon object.

Solid—If set, indicates that the polygon encloses a solid.

Note:

Browser viewing efficiency is enhanced by using the Solid keyword, because the browser knows to look only at the specified inside or outside of the polygon shape instead of both.

Transform—A 4-by-4 matrix containing the transformation to be applied to the object.

Material Properties

The following properties, when set, are applied to the polygons.

AmbientColor—A (3, n) array of RGB color, in the range of 0 and 255. If AmbientColor is an n-element array, then the color is interpreted as grayscale.

DiffuseColor—A (3, n) array of RGB color, in the range of 0 and 255. If DiffuseColor is an n-element array, then the color is interpreted as grayscale.

EmissiveColor—A (3, n) array of RGB color, in the range of 0 and 255. If EmissiveColor is an n-element array, then the color is interpreted as grayscale.

MaterialIndices—An array of indices into the material property arrays in the range of 0 to n – 1, relating each polygon face to one of the set of material properties (AmbientColor, DiffuseColor, EmissiveColor, Shininess, SpecularColor, Transparency). There should be NPOLY elements in this array (one per polygon). (Default: n = NPOLY, where the set of material properties relates one-to-one to its corresponding polygon)

Shininess—An n-element array of shininess, in the range of 0 to 255.

SpecularColor—(3, n) array of RGB color, in the range of 0 to 255. If SpecularColor is an n-element array, then the color is interpreted as grayscale.

Transparencyn-element array of transparency, in the range of 0 to 255.

VertexColor—If set, MaterialIndices are per-vertex rather than per-polygon, so that the material properties describe each vertex, rather than describing each polygon.

Discussion

The VRML_POLY procedure creates a VRML node, based on the PV‑WAVE variables for vertex list and polygon list.

This procedures allows for any polygonal shape to be drawn in a VRML world, with input parameters tailored to fit with other PV‑WAVE routines.

Example

; Build a vertex/polygon set from surface data.
z = HANNING(14,8) * 10.
POLY_SURF, z, vlist, plist
; Open a VRML file.
VRML_OPEN, 'vrml_poly.wrl'
; Set up a light source and an initial viewpoint.
VRML_LIGHT, [7, 4, 20]
VRML_CAMERA, [0, -0, 20], LookAt = [7, 4, 0]
; Make up some RGB color values -- one color for each
; element of z (thus, one color per polygon).
r = BYTSCL(z(*))
g = BYTSCL(DIST(14, 8))
g = g(*)
b = BYTSCL(INDGEN(14, 8))
b = b(*)
; Put the colors into a (3, NPOLY) array.
rgb = TRANSPOSE([[r], [g], [b]])
; Write the surface to the VRML file.
VRML_POLY, vlist, plist, EmissiveColor = rgb
; Close the VRML file.
VRML_CLOSE

See Also

MESH, POLY_MERGE, POLY_PLOT, POLY_SURF, POLYSHADE, VRML_LINE, VRML_OPEN, VRML_SURFACE

For a discussion of VRML polygons, see The VRML Sourcebook, by Andrea L. Ames, et al., John Wiley & Sons, Inc., 1996, Chapter 14.