255 lines
6.9 KiB
HTML
255 lines
6.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>Animated Textures</TITLE>
|
|
<LINK type="text/css" rel="stylesheet" href="../webdocs.css">
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
<H1>Animated Textures</H1>
|
|
|
|
<P>Forget your silly 10 fps looping quake animated textures.
|
|
Now you can create complex multi-framed animated textures AND
|
|
control them from APE. Explosion effects, computer terminal
|
|
displays, animated 2D user-interface controls, even the mouse!
|
|
....the possibilities are endless.</P>
|
|
<PRE class="syntax">
|
|
<B>ATD1</B>
|
|
|
|
<B>type = animation</B>
|
|
<B>colortype =</B> <I>integer</I>
|
|
<B>width =</B> <I>integer</I>
|
|
<B>height =</B> <I>integer</I>
|
|
<B>bilinear =</B> <I>integer</I> (optional, def=1)
|
|
<B>clamp =</B> <I>integer</I> (optional, def=0)
|
|
</PRE>
|
|
<PRE class="syntax">
|
|
<B>!bitmap</B>
|
|
<B>file =</B> <I>filename</I>
|
|
|
|
<B>!bitmap</B>
|
|
... repeat for all bitmaps
|
|
</PRE>
|
|
<PRE class="syntax">
|
|
<B>!frame</B>
|
|
<B>bitmap =</B> <I>integer</I>
|
|
<B>next =</B> <I>integer</I> (optional)
|
|
<B>wait =</B> <I>float</I> (optional)
|
|
<B>x =</B> <I>integer</I> (optional)
|
|
<B>y =</B> <I>integer</I> (optional)
|
|
|
|
<B>!frame</B>
|
|
... repeat for all frames
|
|
</PRE>
|
|
|
|
<H4>Parameters (main)</H4>
|
|
|
|
<DL>
|
|
<DT><I>colortype</I></DT>
|
|
|
|
<DD>
|
|
Determines how the texture is stored on the card. All
|
|
source bitmaps must be in the same format. Can be one of
|
|
the following values:
|
|
|
|
<TABLE>
|
|
<TR>
|
|
<TH>value</TH>
|
|
|
|
<TH>meaning</TH>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD>1</TD>
|
|
|
|
<TD>8-bit greyscale PNG</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD>2</TD>
|
|
|
|
<TD>8-bit greyscale + 8-bit alpha PNG</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD>3</TD>
|
|
|
|
<TD>24-bit RGB PNG</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD>4</TD>
|
|
|
|
<TD>24-bit RGB + 8-bit alpha PNG</TD>
|
|
</TR>
|
|
</TABLE>
|
|
</DD>
|
|
|
|
<DT><I>width</I></DT>
|
|
|
|
<DD>Width of output texture, must be power of two.</DD>
|
|
|
|
<DT><I>height</I></DT>
|
|
|
|
<DD>Height of output texture, must be power of two.</DD>
|
|
|
|
<DT><I>bilinear</I></DT>
|
|
|
|
<DD>Must be 0 or 1, controls whether bilinear filtering is
|
|
used on this image. <B>Default is 1.</B></DD>
|
|
|
|
<DT><I>clamp</I></DT>
|
|
|
|
<DD>Must be 0 or 1, controls whether the texture is clamped
|
|
to its edges or is repeated (tiled). It must be 1 if you
|
|
want to use an animated parabolic environment map. <B>
|
|
Default is 0.</B></DD>
|
|
</DL>
|
|
|
|
<H4>Parameters (bitmap list)</H4>
|
|
|
|
<DL>
|
|
<DT><I>file</I></DT>
|
|
|
|
<DD>Specifies a source image file. Must be in PNG format and
|
|
have the same color type as specified earlier by <B>
|
|
colortype</B>. It can be <I>any</I> size as long as it not
|
|
larger than the output size in any dimension.</DD>
|
|
</DL>
|
|
|
|
<H4>Parameters (frame list)</H4>
|
|
|
|
<DL>
|
|
<DT><I>bitmap</I></DT>
|
|
|
|
<DD>Integer specifying which file specified in the bitmap
|
|
list to use. The first bitmap you specified is numbered 0;
|
|
subsequent bitmaps are numbered 1, 2, 3, and so on.</DD>
|
|
|
|
<DT><I>next</I></DT>
|
|
|
|
<DD>Integer specifying the next frame in the animation
|
|
sequence. The first frame you specified is numbered 0;
|
|
subsequence frames are numbered 1, 2, 3, and so on. If you
|
|
specify −1, then the image will stop animating after
|
|
this frame. The default value is −1.</DD>
|
|
|
|
<DT><I>wait</I></DT>
|
|
|
|
<DD>Floating point value specifying the number of seconds to
|
|
wait before displaying the next frame in the animation
|
|
sequence. For example, specifying 1.5 will show a frame for
|
|
one and a half seconds. If you specify 0, then the next frame will be
|
|
uploaded on the next rendering pass. If you specify −1,
|
|
then the current frame is uploaded immediately and the next
|
|
frame in the sequence is processed (see Remarks section). The
|
|
default value is 0.</DD>
|
|
|
|
<DT><I>x</I></DT>
|
|
|
|
<DD>Integer specifying the x offset into the output texture
|
|
where the bitmap should appear.</DD>
|
|
|
|
<DT><I>y</I></DT>
|
|
|
|
<DD>Integer specifying the y offset into the output texture
|
|
where the bitmap should appear.</DD>
|
|
</DL>
|
|
|
|
<H4>Remarks</H4>
|
|
|
|
<P>Since this new animated texture code uses frame uploading,
|
|
having many frames of animation takes up main memory instead of
|
|
video card texture memory. The amount of video texture memory
|
|
used is never more than the amount required to store the output
|
|
frame. However, this doesn't mean animated textures are free
|
|
and you should frame-output the FF8 opening movie into PNG
|
|
format and watch it play in Anachronox.</P>
|
|
|
|
<H4>Examples</H4>
|
|
|
|
<P>Although they no longer take up video memory, they still do
|
|
take up main memory, and taking up too much main memory is a
|
|
bad thing. One way to reduce your RAM usage is to not change
|
|
the all of the texture in the animation frame. For example, say
|
|
you skin a robot, and you want one of his lights to blink.
|
|
Instead of making two copies of the skin with the light either
|
|
on or off, you can have one frame be the original skin, and one
|
|
frame be a very small bitmap containing only the part of the
|
|
skin that changes with the blinking light. Then you can do
|
|
something like this:</P>
|
|
|
|
<TABLE>
|
|
<TR>
|
|
<TH>base.png</TH>
|
|
|
|
<TH>on.png</TH>
|
|
|
|
<TH>off.png</TH>
|
|
|
|
<TH>output</TH>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD><IMG src="animex_base.png"></TD>
|
|
|
|
<TD><IMG src="animex_on.png"></TD>
|
|
|
|
<TD><IMG src="animex_off.png"></TD>
|
|
|
|
<TD><IMG src="animexample.gif"></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<PRE class="syntax">
|
|
ATD1
|
|
type=animation
|
|
colortype=3
|
|
width=128
|
|
height=128
|
|
|
|
!bitmap
|
|
file=models/robot/base.png
|
|
!bitmap
|
|
file=models/robot/on.png
|
|
!bitmap
|
|
file=models/robot/off.png
|
|
|
|
# Frame 0 is what is always uploaded to the texture
|
|
# before anything is displayed. In this case, wait
|
|
# is -1 so the next frame (1) is immediately processed.
|
|
|
|
!frame
|
|
bitmap=0
|
|
next=1
|
|
wait=-1
|
|
|
|
# Frame 1 says to upload on.png at the specified
|
|
# offsets into the texture. Then it waits half
|
|
# a second before processing the next frame.
|
|
|
|
!frame
|
|
bitmap=1
|
|
next=2
|
|
wait=.5
|
|
x=46
|
|
y=44
|
|
|
|
# Frame 2 uploads off.png at the specified offset.
|
|
# This replaces the center light with a picture
|
|
# of the light turned off. It then waits .2
|
|
# seconds before looping back to frame 1.
|
|
|
|
!frame
|
|
bitmap=2
|
|
next=1
|
|
wait=.2
|
|
x=46
|
|
y=44
|
|
|
|
</PRE>
|
|
|
|
<P>Look in <B>map joeyproc</B> for some examples in animated
|
|
textures.</P>
|
|
</BODY>
|
|
</HTML>
|
|
|