finished std library documentation

git-svn-id: svn://anubis/anaglym/trunk@195 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-11-25 01:02:31 +00:00
parent a2205bce3b
commit 07d2ceb9c0

View File

@ -324,7 +324,7 @@ These objects are "managed" by the Lua script (as opposed to having
all of their attributes defined in a model file).
The properties of managed objects, such as the color, texture, position,
and rotation, can be controlled by using the
<a href="#object">object member functions</a>.
<a href="#object">object member methods</a>.
</p>
<a name="ag_createBox" />
@ -333,6 +333,7 @@ and rotation, can be controlled by using the
<p>
This function creates a managed object which is a box with
dimensions given by (width, depth, height).
The center of the box is initially located at the origin.
</p>
<a name="ag_createBoxStatic" />
@ -365,25 +366,6 @@ Identical to <tt>ag.createCapsule()</tt> except that the created
object is static.
</p>
<a name="ag_createCylinder" />
<h3><tt>createCylinder</tt></h3>
<p><tt>obj = ag.createCylinder(radius, length)</tt></p>
<p>
This function creates a cylinder managed object.
<tt>radius</tt> specifies the radius of the cylinder.
<tt>length</tt> specifies the length of the cylinder.
The cylinder is oriented with its axis along the Z axis and its
center point at the origin.
</p>
<a name="ag_createCylinderStatic" />
<h3><tt>createCylinderStatic</tt></h3>
<p><tt>obj = ag.createCylinderStatic(radius, length)</tt></p>
<p>
Identical to <tt>ag.createCylinder()</tt> except that the created
object is static.
</p>
<a name="ag_createPlane" />
<h3><tt>createPlane</tt></h3>
<p>1) <tt>obj = ag.createPlane(a, b, c, d)</tt></p>
@ -401,7 +383,8 @@ angles around the x, y, and z axis.
Specifying no rotation would use the default plane normal of (0, 0, 1).
If you would like to create a plane by specifying a point on
the surface and the surface normal, see the
<a href="#std_createPlanePtNormal">std.createPlanePtNormal()</a> function.
<a href="#std_createPlanePointNormal">std.createPlanePointNormal()</a>
function.
</p>
<a name="ag_createSphere" />
@ -409,6 +392,7 @@ the surface and the surface normal, see the
<p><tt>obj = ag.createSphere(radius)</tt></p>
<p>
This function creates a managed sphere object with the radius given.
The center of the sphere is initially located at the origin.
</p>
<a name="ag_createSphereStatic" />
@ -446,7 +430,7 @@ relative to the local reference frame of <tt>obj</tt>.
<p><tt>obj:addTorque(xr, yr, zr)</tt></p>
<p>
This function adds torque (a rotational force) to <tt>obj</tt>.
The torque vector around global axes x, y, z is given by (xr, yr, zr).
The torque vector around global x, y, and z axes is given by (xr, yr, zr).
</p>
<a name="object_addTorqueRel" />
@ -454,7 +438,7 @@ The torque vector around global axes x, y, z is given by (xr, yr, zr).
<p><tt>obj:addTorqueRel(xr, yr, zr)</tt></p>
<p>
This function adds torque (a rotational force) to <tt>obj</tt>.
The torque vector around the local axes x, y, z of <tt>obj</tt>
The torque vector around <tt>obj</tt>'s local x, y, and z axes
is given by (xr, yr, zr).
</p>
@ -463,11 +447,11 @@ is given by (xr, yr, zr).
<p><tt>new_obj = obj:clone()</tt></p>
<p>
This function makes a copy of the object in the engine.
This is more efficient then recreating the object in whatever
This is more efficient than creating a new object in whatever
manner was used to create <tt>obj</tt>.
<tt>new_obj</tt> will have all of its own parameters - position,
rotation, color, texture, etc...
However, these parameters will be instantiated with the corresponding
However, these parameter values will be instantiated with the corresponding
values from <tt>obj</tt> at the time of cloning.
One should call
<tt>new_obj:<a href="#object_setPosition">setPosition()</a></tt>
@ -541,7 +525,7 @@ center-of-mass (local origin) to (x, y, z).
<h3>setRotation</h3>
<p><tt>obj:setRotation(xr, yr, zr)</tt></p>
<p>
This function sets the object's rotation to that specified
This function sets the object's rotation as specified
by Euler angles (xr, yr, zr).
</p>
@ -550,7 +534,7 @@ by Euler angles (xr, yr, zr).
<p><tt>obj:setTexture(tex)</tt></p>
<p>
This function sets the texture of <tt>obj</tt> to <tt>tex</tt>.
<tt>tex</tt> is a Lua reference to a texture loaded with
<tt>tex</tt> should be a Lua reference to a texture loaded with
<a href="#ag_loadTexture">ag.loadTexture()</a>.
</p>
@ -560,6 +544,7 @@ This function sets the texture of <tt>obj</tt> to <tt>tex</tt>.
<p>
This function sets the visibility of <tt>obj</tt> to <tt>visible_flag</tt>.
If <tt>visible_flag</tt> is <tt>true</tt>, then the object will be drawn.
Newly created objects are visible by default.
</p>
<hr />
@ -567,5 +552,49 @@ If <tt>visible_flag</tt> is <tt>true</tt>, then the object will be drawn.
<a name="std" />
<h2><tt>std</tt> library</h2>
<p>
The <tt>std</tt> Lua library supplies a set of Lua functions that may
be useful to Lua scripts being executed.
It is not imported by default.
Import it like this:
<pre>
ag.import("std")
</pre>
</p>
<a name="std_crossProduct" />
<h3>crossProduct</h3>
<p><tt>cp = std.crossProduct(vec1, vec2)</tt></p>
<p>
This function returns the cross product of the two vectors
<tt>vec1</tt> and <tt>vec2</tt>.
The return value is a Lua array with indices 1 to 3.
The indices of <tt>vec1</tt> and <tt>vec2</tt> should be from 1 to 3.
This allows specifying a Lua array directly as a parameter to the function.
For example:
<pre>
local z_axis = std.crossProduct({1, 0, 0}, {0, 1, 0})
</pre>
</p>
<a name="std_dotProduct" />
<h3>dotProduct</h3>
<p><tt>dp = std.dotProduct(vec1, vec2)</tt></p>
<p>
This function returns the dot product of the two vectors.
The indices of <tt>vec1</tt> and <tt>vec2</tt> should be from 1 to 3.
This allows specifying a Lua array directly as a parameter to the function.
</p>
<a name="std_createPlanePointNormal" />
<h3>createPlanePointNormal</h3>
<p><tt>obj = std.createPlanePointNormal(x, y, z, nx, ny, nz)</tt></p>
<p>
This function simply wraps
<a href="#ag_createPlane"><tt>ag.createPlane()</tt></a>
allowing the user to specify a point on the plane with coordinates (x, y, z)
and the surface normal of the plane (nx, ny, nz).
</p>
</body>
</html>