Aztec Script Reference

AztecMesh Class

Summary

Class used to hold and manipulate a mesh within Aztec.

Methods

     The table below summarizes the methods of AztecMesh
MethodDescription
addVertex(v)Add the vertex v to the mesh.  v must be of type AztecVector
addVertsAndTriangles(v, t)Add the array of vertices and array of triangles to the mesh. v must be an array with elements of type AztecVector.  t must be an array with elements of type AztecTriangle
addTriangle(t)Add the triangle t to the mesh.  t must be of type AztecTriangle.
calculateNormals()Compute smoothing normals for the mesh.
centerMesh()Set the center point of the mesh (where the translate tool will be located) to the average value of all vertices.
collapseVertices(v)Remove redundant vertices - collapsing multiple vertices into a single one.
extrudeFaces()TBD
flipNormals()Flip all normal values to the opposite direction
getTriangle(i)Get triangle number "i" from the mesh.  The type of the returned triangle will be an AztecTriangle.
getVertex(v)Get vertex number "i" from the mesh.  The type of the returned vertex will be an AztecVertex.
scaleMesh(s)Scale the mesh in all directions by s
weldVertices(v)TBD

Properties

     The table below summarizes the properties of AztecMesh
PropertyDescription
numVertsNumber of vertices in the mesh
numTrisNumber of triangles in the mesh

Description

Class providing a reflection of the internal MMesh class into JavaScript.

Example

How to use...
     TBD

See Also

Groups [ Class ]
Documents [ LXR ID Search ]
Entries [ AztecTriangle | AztecVector3 | AztecVertex ]

AztecSceneObject Class

Summary

This class provides a reflection of an Aztec object to the scripting interface. Objects of this type are not directly created, but are accessed as either a property of the global "Scene" (for existing objects), or as a result of using a createXXX() method of "Scene".

Properties

The properties of an AztecSceneObject will depend on the underlying thing it is
reflecting.  If it is an object, then it will have the properties: Name, Tsl,
Rot, Scl, drawWire, shapeObj, mat, parent, and viewCol.  If it is a shape associated
with an object, then it will have the property "Name", plus all of the shape
specific properties (e.g., a cube will have  width, height, depth, ...).  If it
is a material it will have the properties: Name, Amb, Diff, Spec, Emm, Shin,
Opac, DiffFile, Cull.

Note that properties of scene objects are copied by value to a new object at
the time they are referenced.  This means that you cannot do something like this:
Scene.Cube01.Tsl.x = 4;  Instead you have to assign an entire AztecVector3 to
the property Tsl (e.g., v = Scene.Cube01.Tsl; v.x = 4; Scene.Cube01.Tsl = v;).
There are several boring technical reasons why this must be - but you need to
be aware that the properties of scene objects aren't quite the same as the
properties of standard JavaScript objects.

The properties listed below are for the basic object.  Shape and material objects
will reflect properties unique to themselves (material docs are TBD).
PropertyDescription
NameString holding the name of the object.
TslAztecVector3 containing the amount of translation for this object.
RotAztecVector3 containing the amount of rotation for this object.
SclAztecVector3 containing the amount of scaling for this object.
drawWireOn/Off - determines if the object will only be drawn using wireframe.  When on, the object will be wireframe, even if the window is in a solid drawing mode.
shapeObjAztecSceneObject reference to an object that holds the shape unique properties of this object.
matAztecSceneObject reference to the material assigned to this object.  Material unique properties will be reflected through it.
parentAztecSceneObject reference to the parent object of this object.
viewColColor to use when drawing this object.

Example

Typical uses:
Retrieving a scene object as a property would look like this:

js: light1 = Scene.whiteLight;
[Aztec Object: whiteLight]
js:

Below is an example of creating a cube primitive and examining it's properties.

js: cube1 = Scene.createObject('Cube')
[Aztec Object: Cube]
js: for (x in cube1) print(x)
Name
Tsl
Rot
Scl
drawWire
shapeObj
mat
parent
viewCol

js: cubetx = cube1.Tsl;
[object AztecVector3]
js: cubetx.x
0
js: cubetx.y
0
js: cubetx.set(2, 3, 10)

js: cube1.Tsl = cubetx
[object AztecVector3]


Given the cube created above, the code below gets the shape associated with
the cube at lists the properties unique to a cube.

js: cubeShp = cube1.shapeObj
[Aztec Object: cubeShape]
js: for (x in cubeShp) print(x)
Name
Wd
Hi
Dp
WdDv
HiDv
DpDv

js: 

See Also

Groups [ Class ]
Documents [ LXR ID Search ]
Entries [ AztecVector3 | Scene ]

AztecTriangle Class

Summary

Class used to hold and manipulate a triangle within Aztec.

Methods

     The table below summarizes the methods of AztecTriangle
MethodDescription
set(i0, i1, i2)Set the corners of the triangle to those vertices at the given indices in the array of vertices.

Properties

     The table below summarizes the properties of AztecTriangle
PropertyDescription
i0Index of vertex 0
i1Index of vertex 1
i2Index of vertex 1
centerAztecVector giving the center location of the triangle.
centreAztecVector giving the center location of the triangle.
normalNormal to the triangle

Description

Class providing a reflection of the internal MTriangle class into JavaScript.

Example

How to use...
     TBD

See Also

Groups [ Class ]
Documents [ LXR ID Search ]
Entries [ AztecMesh | AztecVector3 | AztecVertex ]

AztecVector3 Class

Summary

Three component floating point vector

Methods

     The table below summarizes the methods of AztecVector3
MethodDescription
add(v)Add this vector to the argument and keep the new value.
angle(v)Return the angle between this vector and the argument.
cross(v)Cross product of this vector with the parameter.
dot(v)Dot product of this vector with the parameter.
length()Return the length of this vector.
lengthSquared()Return the square of the length of this vector.
mul(v)TBD: this hasn't been implemented yet...
normalize()Set this vector to unit length, retaining direction.
normalize(v)Set this vector to the normalized value of the input vector.
set(v)Set the value of this vector to the value of a vector parameter v.
set(x, y, z)Set each component of the vector to the three floating point parameters.

Properties

     The table below summarizes the properties of AztecVector3
PropertyDescription
xX component of the vector.
yY component of the vector.
zZ component of the vector.

Description

Class providing a reflection of the internal MVector3 class into JavaScript.

Example

How to use...
js: vec.x = 42;
js: vec.z = vec.x + 2;
js: vec.x * 2
84
...

See Also

Groups [ Class ]
Documents [ LXR ID Search ]
Entries [ AztecVertex ]

AztecVertex Class

Summary

Three component floating point vector, with a normal and reference color.

Properties

     The table below summarizes the properties of AztecVertex
PropertyDescription
xX component of the vector.
yY component of the vector.
zZ component of the vector.
normalAztecVector3 representation of the vertex normal
feedbackColorAztecRGBAFloat representation of the color used for feedback of selections.

Description

Class providing a reflection of the internal MVertex class into JavaScript.

Example

How to use...
js: vec.x = 42;
js: vec.z = vec.x + 2;
js: vec.x * 2
84
...

See Also

Groups [ Class ]
Documents [ LXR ID Search ]
Entries [ AztecVector3 ]

Scene Global Object

Summary

The global object "Scene" provides access to the objects within the current Aztec scene, as well as a reflection of the MScene API.

Methods

       The table below summarizes all currently implemented methods
       of the global object "Scene".
MethodDescription
createObject(objType)Create an object of type given by the string "objType".  Choices include: mesh, light, ...
createSceneObject()Create a generic object - typically used as a parent container.
createMesh()Create a mesh object with no vertices or triangles.
createLight()Create a new light object.
deleteObject(obj)Delete the object given by "obj".  Obj may be either a scene object of type AztecObject, or a string that holds the name of an Aztec object.
clearScene()Remove all objects from the scene.
getSelectedObjectList()Return an array containing references to all objects.
redraw()Force a redraw of the scene
selectNone()Deselect all objects in the scene
selectObject(obj)Add the object "obj" to the list of of selected objects.  Obj may be either an AztecObject, or a string that holds the name of an Aztec object.
getNumSelectedObjects()Return the number of currently selected objects.
getSelectionCenter()Return the location of the center of the list of all selected objects.  The type of the returned object is AztecVector3.
anythingSelected()Boolean that is true if there are any selected objects.
setTime(t)Set the current animation time.  The value of t is given in ticks.
setStartTime(t)Set the starting time of the animation in ticks.
getStartTime()Get the current start time of the animation in ticks.
getEndTime()Get the current end time of the animation in ticks.
setEndTime(t)Set the end time of the animation in ticks.
setTimeRange(t0, t1)Set the start and end time of the animation in ticks.
getFramesPerSecond()Get the number of frames per second used to generate the animation.
setFramesPerSecond(fps)Set the number of frames per second used to generate the animation.
tickToFrame(t)Convert a tick value to the frame it lies within.
frameToTick(t)Get the tick corresponding to the beginning of a specific frame.
tickToSeconds(t)Convert from ticks to seconds.
secondsToTick(t)Convert from seconds to ticks.

Properties

       The table below summarizes the properties of the global object "Scene".
PropertyDescription
ObjectNameAny object created in Aztec will appear as a property of the global object "Scene".

See Also

Groups [ Global Object ]
Documents [ LXR ID Search ]

cat Global Method

Summary

Dump the contents of a file from the script directory.

Example

js: cat('test.js')
function showParams(obj) {
   for (x in obj)
     print(x + ": " + obj[x]);
}

function deg2rad(t) {
   return t * Math.PI / 180.0;
}

function spinObj(obj) {
   var v1 = new AztecVector3(0, 0, 0);
   for (x=0.0;x<=2.0*Math.PI;x+=0.2) {
     v1.x = 20.0 * Math.cos(x);
     v1.y = 20.0 * Math.sin(x);
  obj.Translate = v1;
   }
}

...

js:

See Also

Groups [ Global Method ]
Documents [ LXR ID Search ]

gc Global Method

Summary

Force garbage collection.

Example

js: gc()
before 6813, after 6336

js:

See Also

Groups [ Global Method ]
Documents [ LXR ID Search ]

load Global Method

Summary

Load a script file.

Example

js: load('test.js')

js: makeSpheres()

js: 

See Also

Groups [ Global Method ]
Documents [ LXR ID Search ]

ls Global Method

Summary

Get a file listing for the script directory.

Example

js: ls()
.
..
gear.js
particle.js
test.js
init.js

js:

See Also

Groups [ Global Method ]
Documents [ LXR ID Search ]

print Global Method

Summary

Print a string in the script window.

Example

js: print('1 + 1 = ' + (1 + 1))
1 + 1 = 2

js: 

See Also

Groups [ Global Method ]
Documents [ LXR ID Search ]

This page was generated by APIDOC