An RWX file is a list of commands. Most are one word and a few numbers; the begin and end commands group the others into a model, clumps and prototypes. This page is the grammar and the table of every command. Where a rule comes from one of the sample files on the author’s Mac it says so, and where it comes from memory of RenderWare and Active Worlds documentation, and no file here uses it, it says that too.
Lines, comments and white space
A command and its arguments sit on one line. A # starts a comment that
runs to the end of the line, and it may follow a command on the same line, as in
TransformBegin # Upper arm in HUMAN.RWX. Blank lines and
comment lines mean nothing. Tabs and spaces separate words, and the indentation in the
sample files (spaces and tabs, mixed) carries no meaning.
All 114 files end their lines with CR LF. The viewer also reads LF and a lone CR, and it reads a second command on the same line, which starts at the next word that is a command name. No sample file does that, and whether RenderWare accepts it was not checked.
The sample files write every command with a capital letter at the start of each word,
as in the tables here. This reader accepts any case. The flags of Hints
vary in the sample files: HS in all but TABLE.RWX, which has
Hs.
Numbers and names
Numbers are decimal: an optional sign, digits, an optional fraction and an optional
exponent (0.121212, -4, 6, 1e-3). The sample files
use no other form, and integers such as vertex numbers and side counts are written
without a fraction. Names, for prototypes and textures, are single words. The words
that follow a few commands, such as Facet after LightSampling
or Mask after a texture name, are keywords.
Blocks
Five pairs of commands open and close a block. A block holds the commands between its begin and its end, and blocks nest. The table says what each one keeps apart from the rest of the file.
| Block | Opens and closes with | What it does |
|---|---|---|
| Model | ModelBegin … ModelEnd | The whole model. Every sample file has exactly one, which holds everything else. |
| Clump | ClumpBegin … ClumpEnd | A part of the model. It has its own vertex list, so its faces number the vertices defined inside it from 1. What is set inside (transform and materials) is set back at ClumpEnd. HUMAN.RWX nests clumps for an arm, a forearm and a hand, each moved by the one around it. |
| Prototype | ProtoBegin name … ProtoEnd | A named piece of the model that is not drawn where it is defined. It is drawn at each ProtoInstance or ProtoInstanceGeometry of its name. It has its own vertex list: in TRIAD.RWX the prototypes X, Y and Z each number their vertices from 1. |
| Transform scope | TransformBegin … TransformEnd | Whatever transform commands are used inside are undone at the end, so the commands after it use the transform that was set before it. See Transforms. |
| Material scope | MaterialBegin … MaterialEnd | Whatever material commands are used inside are undone at the end. See Materials. |
The ends are ModelEnd, ClumpEnd,
ProtoEnd, TransformEnd and
MaterialEnd, each closing the nearest open block of its own kind. A begin that is never closed, and an
end with nothing open to close, are reported as problems; the viewer then carries on, an
unclosed block lasting until the block around it ends.
What each block saves, and the vertex lists, are known for certain only where the sample files use them. That the transform scope saves the transform and the material scope the material, and that a clump sets both back and starts a vertex list, is how this viewer does it and how the scripts read; no file has a case that would show a difference, and RenderWare’s documentation was not available to check.
Prototype instances
ProtoInstance name draws the prototype of
that name at the current transform, with the materials the prototype’s own commands
set. ProtoInstanceGeometry name draws
only its geometry: the material commands inside it are ignored, so it takes the colour
and surface in force where it is instanced. TRIAD.RWX uses the second to
draw the same arrow in cyan, magenta and yellow by wrapping each use in a
MaterialBegin with a different Color. The difference between
the two commands is the one the names and that file suggest; it is not checked against
RenderWare. A prototype that is instanced inside itself would never end: this viewer
stops at sixteen levels and reports it. The name is looked up without regard to case,
and a prototype defined twice uses the first definition.
Hints and other commands
Hints takes words and means nothing to the geometry.
All 94 glyph files, TABLE.RWX and TRIAD.RWX have
Hints HS Editable (once as Hints HS Editable with two spaces,
once as Hs); it reads as flags for RenderWare’s own tools, and nothing on
this Mac says what HS stands for. Collision
and AxisAlignment, with Tag,
Ambient, Diffuse and Specular, are
Active Worlds additions as far as the author remembers. No sample file uses them, so the
viewer keeps their words and ignores them when drawing.
All commands
The commands this reader knows, by group. An argument written … repeats.
A word that is not in this table is reported as not a command, and the rest of its
line is read as its arguments.
| Command | Arguments | Group and page |
|---|---|---|
ModelBegin, ModelEnd | none | Structure, on this page |
ClumpBegin, ClumpEnd | none | Structure, on this page |
ProtoBegin, ProtoEnd | a name, then none | Structure, on this page |
ProtoInstance, ProtoInstanceGeometry | a name | Structure, on this page |
TransformBegin, TransformEnd | none | Structure, Transforms |
MaterialBegin, MaterialEnd | none | Structure, Materials |
Vertex | x y z, optionally UV u v | Vertices, Vertices and faces |
Triangle | three vertex numbers, optionally Tag n | Faces, Vertices and faces |
Quad | four vertex numbers, optionally Tag n | Faces, Vertices and faces |
Polygon | a count, then that many vertex numbers, optionally Tag n | Faces, Vertices and faces |
Tag | a number | Faces, Vertices and faces |
Block | width height depth | Primitives, Primitives |
Cone | height radius sides | Primitives, Primitives |
Cylinder | height bottom-radius top-radius sides | Primitives, Primitives |
Disc | height radius sides | Primitives, Primitives |
Hemisphere | radius density | Primitives, Primitives |
Sphere | radius density | Primitives, Primitives |
Torus | major-radius minor-radius major-density minor-density | Primitives, Primitives |
Identity, IdentityJoint | none | Transforms, Transforms |
Translate, TranslateJoint | x y z | Transforms, Transforms |
Rotate, RotateJoint | axis-x axis-y axis-z degrees | Transforms, Transforms |
Scale | x y z | Transforms, Transforms |
Transform, TransformJoint | sixteen numbers | Transforms, Transforms |
Color | red green blue | Materials, Materials |
Surface | ambient diffuse specular | Materials, Materials |
Ambient, Diffuse, Specular | one or more numbers | Materials, Materials |
Opacity | a number | Materials, Materials |
Texture | a name or NULL, optionally Mask and a name | Materials, Materials |
TextureModes, MaterialModes | one or more words | Materials, Materials |
TextureAddressMode | a word | Materials, Materials |
LightSampling | Facet or Vertex | Materials, Materials |
GeometrySampling | Pointcloud, Wireframe or Solid | Materials, Materials |
Hints, Collision | any number of words | Other, on this page |
AxisAlignment | a word | Other, on this page |
A command with fewer arguments than it needs, or more than it takes, is reported. An argument that should be a number and is not is reported and read as 0.
Problems the viewer reports
- a word that is not a command, a missing, extra or non-numeric argument
- a begin that is never closed, an end that closes nothing
- a face that names a vertex that is not defined in its clump (yet)
- a polygon with fewer than three corners, or whose count does not match the numbers after it
- a prototype that is not defined, defined twice, or nested too deeply
- a colour value or an opacity outside 0 to 1, or a sampling mode that is not one of the known words
Not described
This page is read from the sample files and from memory, not from RenderWare’s documentation.
- Reference: whether a command may share a line with another, and whether names are case sensitive in RenderWare, were not checked.
- Reference: exactly what each block saves, and whether a clump has its own vertex list, is inferred; no sample file would show a difference.
- Reference: the exact difference between ProtoInstance and ProtoInstanceGeometry is inferred from the names and TRIAD.RWX.
- Reference: the meaning of the Hints flags, and the arguments of Collision and AxisAlignment, are unknown.
- Viewer: Hints, Collision and AxisAlignment are read and ignored; unknown commands are reported, not drawn.