RenderWare V2.1

Previous Page Index Next Page

Miscellaneous Notes


This section contains certain important notes concerning the use of the scripting language.

· Scripts are read using the RenderWare API function RwReadShape() which returns a pointer to the clump built by the script.
· All of the scripting keywords are case-insensitive, i.e., upper and lower case may be freely mixed. Keyword values are also case-insensitive with the exception of filename. The case sensitivity of filenames is dependent upon the host operating system.
· Every script file should have exactly one top-level ModelBeginModelEnd block. Within such a block, zero or more ProtoBegin ProtoEnd blocks followed by one top-level ClumpBegin ClumpEnd block are expected. The ProtoBegin ProtoEnd blocks are prototype declarations, and the top-level ClumpBegin ClumpEnd block is an actual clump being constructed by the script.
· The keywords Vertex and VertexExt are exactly equivalent. Both may be used to specify a vertex with texture coordinates and a unit shading normal. This is in contrast to the API level object builder functions where only RwVertexExt() may be used to specify a vertex with texture coordinates and unit shading normal.
· The keywords Polygon and PolygonExt are exactly equivalent. Both may be used to specify a polygon with an integer tag. This is in contrast to the API level object builder functions where only RwPolygonExt() may be used to specify a polygon with an integer tag. This also applies to Quad and QuadExt and Triangle and TriangleExt.
· Scripting keywords which take vertices as arguments, such as Triangle, require a vertex to be identified by its vertex number. Vertex numbers start at one and each time that the Vertex (or VertexExt) keyword is used within a script, they are incremented by one. The number of the first vertex created by the Vertex (or VertexExt) keyword is one, the second is two, and so on. Note that the vertex numbering is not affected by any scripting keywords which add vertices (such as Include or Sphere) other than Vertex (or VertexExt).
· Scripting keyword that take a 4 x 4 transformation matrix as an argument, e.g., Transform, require the matrix to be specified by a sequence of sixteen real numbers (separated by spaces) representing its elements. The Transform and TransformJoint scripting keywords expect the matrix elements to be specified in row-major order, i.e., the first four elements specify the first row of the matrix, and so on.
· Rotation, translation and scaling are performed by pre-concatenation.
· The Tag keyword is mainly useful for identifying parts of a hierarchical model so that they may be located and manipulated in an application program. A RenderWare application can then locate a particular clump within a clump hierarchy by using the RwFindTaggedClump() function.
· PolygonExt, QuadExt and TriangleExt allow an optional integer tag to be specified using the keyword modifier Tag. This tagging of polygons serves a similar purpose as the tagging of clumps. Application clumps can use the tags to identify and modify particular polygons in a script. The API function RwFindTaggedPolygon() searches for a polygon with a particular tag in the polygon list of a clump.
· The Texture keyword accepts NULL as its argument, in which case any texture associated with the current material is removed. From that point on, no texture is applied to the geometry created.

The following is a simple, example script which builds a clump that consists of a red cube:


ModelBegin


ClumpBegin
Surface 0.2 0.3 0.7 # shiny
Color 1.0 0.0 0.0 # red
Block 0.5 0.5 0.5
ClumpEnd
ModelEnd

The Surface keyword sets ambient, diffuse, and specular reflection coefficients of the current material to 0.2, 0.3 and 0.7 respectively.

The current material’s color is set to red using the Color keyword.

The Block keyword adds a block (whose width, height, and depth are all 0.5) to the current clump under construction. The current transformation (in this case the identity) is applied to the polygons being added and the materials of these polygons are set to the current material.