anachronox-sdk/docs/procedural/ape_animate.html

62 lines
4.4 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>APE Animated Texture Control</TITLE>
<LINK type="text/css" rel="stylesheet" href="../webdocs.css">
</HEAD>
<BODY>
<H1>APE Animated Texture Control</H1>
<p>You can easily control animated textures from APE by using these functions. Remember that animated textures are not limited to world polys, they can be on models, sprites, and 2D controls. <b>RegisterTexture</b> is used to load new textures with specific parameters. <b>FindTexture</b> is used to get handles to textures already loaded for interface, world, or model objects. <b>SetAnimFrame</b> is used to set the next animation frame for an animating texture, using a handle obtained from RegisterTexture or FindTexture.
<pre class="syntax">
<b>extern RegisterTexture</b>
<b>floatvar</b> <i>handle</i> // returned handle to image
<b>string</b> <i>filename</i> // texture file name with path, but no extension
<b>float</b> <i>bilerp</i> // (optional) bilinear filter flag
<b>float</b> <i>mipmap</i> // (optional) mipmap generation flag
<b>float</b> <i>repeat</i> // (optional) repeat mode flag
</pre>
<h4>Parameters</h4>
<dl>
<dt>handle
<dd>[out] Variable to receive the image handle. Subsequent calls should specify this variable. A return value of zero in the variable is an invalid handle, and means the function failed.
<dt>filename
<dd>[in] File name of the animated texture <em>without extension</em> relative to anoxdata. For example, if the full texture path is "Anachronox/anoxdata/textures/joey/happy.atd" then you would specify "textures/joey/happy" for this parameter. Note that because of flexible file extension searching, if you have two different graphic files in the same directory that differ only in extension, which file will get loaded is unpredictable. Even if you specify an extension for the graphic, it will be happily ignored. (How this "feature" came about is a long, sordid story that I won't go into here...)
<dt>bilerp
<dd>[in/optional] This optional flag specifies whether the texture will be bilinear filtered or not on the screen. Specify 1 for on, 0 for off, or -1 for automatic. If it is not specified or you specify automatic, it will assume the texture will be used for 2d interface graphics, and will automatically determine the bilerp value depending on the screen resolution. If the screen resolution is a multiple of 640x480, then bilerp will be 1, otherwise it will be 0. For 3D textures, you should usually use 1.
<dt>mipmap
<dd>[in/optional] This optional flag specifies whether the texture should have mipmaps generated for it. Specify 1 for on, 0 for off. It should be off for 2D interface graphics, and on for textures on 3D objects.
<dt>repeat
<dd>[in/optional] This optional flag specifies whether the texture will have the GL_REPEAT or GL_CLAMP texturing mode. Specify 1 for GL_REPEAT and 0 for GL_CLAMP. The default is GL_CLAMP. If you created 2D interface graphics that need to tile, you should specify 1.
</dl>
<pre class="syntax">
<b>extern FindTexture</b>
<b>floatvar</b> <i>handle</i> // returned handle to image
<b>string</b> <i>filename</i> // texture file name with path, but no extension
</pre>
<h4>Parameters</h4>
<dl>
<dt>handle
<dd>[out] Variable to receive the image handle. Subsequent calls should specify this variable. A return value of zero in the variable is an invalid handle, and means the function failed.
<dt>filename
<dd>[in] Filename, same as for <b>RegisterTexture</b> above.
</dl>
<pre class="syntax">
<b>extern SetAnimFrame</b>
<b>float</b> <i>handle</i> // image handle
<b>float</b> <i>framenum</i> // animation frame number
<b>float</b> <i>nowait</i> // (optional) ignore current delay
</pre>
<h4>Parameters</h4>
<dl>
<dt>handle
<dd>Non-zero handle received from a previous call to <b>RegisterTexture</b>.
<dt>framenum
<dd>Frame number which you want displayed next in the animation sequence.
<dt>nowait
<dd>Flag to specify whether or not the currently displayed frame's wait value should be ignored. If you specify 1, then <b>framenum</b> will be processed immediately. The default value is 0.
</dl>
<h4>Example</h4>
<p>Please see <b>map joeyproc</b> and the corresponding <b>joeyproc.txt</b> APE script for examples of APE control of animated textures on entities and world brushes.
</body>
</html>