VRML_CUBE Procedure

Positions a VRML cube in the world.

Usage

VRML_CUBE

Input Parameters

None.

Keywords

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

Object Properties

The following keywords describe or define the VRML cube object.

Center—A 3-element array specifying the true center of the cube object. (Default: [0, 0, 0])

Rotation—A 3-element array of values in degrees, specifying the rotation about the x, y, and z axes, respectively.

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

Widths—A scalar value applied to each of the three directions, or a 3-element array of values specifying the width in each direction (x, y, z) individually. (Default: 2.0)

Material Properties

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

AmbientColor—A 3-element array of RGB color with each element ranging between 0 and 255. If the value is scalar, then the color is interpreted as grayscale.

DiffuseColor—A 3-element array of RGB color with each element ranging between 0 and 255. If the value is scalar, then the color is interpreted as grayscale.

EmissiveColor—A 3-element array of RGB color with each element ranging between 0 and 255. If the value is scalar, then the color is interpreted as grayscale.

Shininess—Scalar shininess factor, in the range of 0 to 255.

SpecularColor—A 3-element array of RGB color with each element ranging between 0 and 255. If the value is scalar, then the color is interpreted as grayscale.

Texture_Image—A texture image to apply to the object. The image is wrapped completely around the object. The texture image values and transparency values lie in the range of 0 to 255. There are four options:

(w, h) or (1, w, h)—Grayscale image

(2, w, h)—Grayscale in (0, *, *) plus transparency in (1, *, *)

(3, w, h)—True color image (red, green, blue)

(4, w, h)—True color plus transparency in (3, *, *)

Transparency—A scalar transparency factor, in the range of 0 to 255.

Discussion

The VRML_CUBE procedure produces a 2-by-2-by-2 cube centered around a defined origin. This routine supports the cube node in VRML.

Example

The 'wavelogo.dat' file used in this example is found in the following directory:

<wavedir>/demo/web/vrml
<wavedir>\demo\web\vrml

where <wavedir> is the main PV‑WAVE directory.

; Restore variables for img, r, g, b.
RESTORE, 'wavelogo.dat'   
sz = SIZE(img)
col = TRANSPOSE([[r], [g], [b]])
img24 = REFORM(col(*, img), 3, sz(1), sz(2))
; A cube with the wave logo on it.
VRML_CUBE, Center = [-5, -3, 5], Width = 3, Texture = img24
VRML_CUBE, Center = [4, -2, -2], Rotation = [0, 0, 0], $
   DiffuseColor = [127, 255, 191], AmbientColor = [55, 70, 60], $
   SpecularColor = [0, 100, 0]
VRML_CUBE, Center = [4, -2, -2], Rotation = [45, 0, 0], $
   DiffuseColor = [127, 255, 191], AmbientColor = [55, 70, 60],$
   SpecularColor = [0, 100, 0]
VRML_CUBE,Center = [4, -2, -2],   Rotation = [0, 45, 0], $
   DiffuseColor = [127, 255, 191], AmbientColor = [55, 70, 60],$
   SpecularColor = [0, 100, 0]
VRML_CUBE,Center = [4, -2, -2], Rotation = [0, 0, 45], $
   DiffuseColor = [127, 255, 191], AmbientColor = [55, 70, 60], $
   SpecularColor = [0, 100, 0]

See Also

VRML_CONE, VRML_CYLINDER, VRML_OPEN, VRML_SPHERE, VRML_TEXT

For a discussion of cubes and other VRML primitives, see The VRML Sourcebook, by Andrea L. Ames, et al., John Wiley & Sons, Inc., 1996, Chapter 3.