nAnimation Class Reference
[Animation Subsystem]
#include <nanimation.h>
Inheritance diagram for nAnimation:

Detailed Description
An nAnimation is a nResource subclass which holds one or more animation curves, which must all share the same number of keys, frame rate and loop type. The nAnimation object can be sampled for a given curve index at a given sample time.One nAnimation object points to the data of exactly one "animation group" in an animation file (an animation group is a collection of curves that share the same attributes (number of keys, frame rate and looping type). Several nAnimation objects may access one animation file (since one animation file may contain several animation groups).
Subclasses of nAnimation may provide file streaming or sampling in-memory animation data.
After creation the object should be configured by setting the file and group name, after that, LoadResource() should be called (and also when IsValid() returns false), this is normal nResource class behavior.
To get a sample from a curve, call the SampleCurves() method.
Animation file formats:
ASCII: .nanim2 (not streamable)
type nanim2
numgroups [numGroups]
numkeys [numKeys]
FOR EACH GROUP {
group [numCurves] [startKey] [numKeys] [keyStride] [keyTime] [FadeInFrames] [clamp|repeat]
FOR EACH CURVE {
curve [step|linear|quat|none] [firstKeyIndex] [collapsedKey(x,y,z,w)]
curve
...
}
FOR EACH KEY (Keys are interleaved) {
key [x y z w] // first key of first non-collapsed curve
key [x y z w] // first key of second non-collapsed curve
key [x y z w] // first key of third non-collapsed curve
... // etc...
}
}
BINARY: .nax2 (optionally streamable)
HEADER {
int32 magic // NAX2
int32 numGroups // number of groups in file
int32 numKeys // number of keys in file
}
FOR EACH GROUP {
int32 numCurves // number of curves in group
int32 startKey // first key index
int32 numKeys // number of keys in group
int32 keyStride // key stride in key pool
float keyTime // key duration
float fadeInFrames // number of fade in frames
int32 loopType // nAnimation::LoopType
}
FOR EACH CURVE {
int16 ipolType // nAnimation::Curve::IpolType
int32 firstKeyIndex // index of first curve key in key pool (-1 if collapsed!)
int32 isAnimated // flag, if the curve's joint is animated
float[4] collapsedKey // the key value if this is a collapsed curve
}
FOR EACH KEY {
float[4] value
}
(C) 2003 RadonLabs GmbH
Definition at line 92 of file nanimation.h.
Public Member Functions | |
| nAnimation () | |
| constructor | |
| virtual | ~nAnimation () |
| destructor | |
| virtual void | SampleCurves (float time, int groupIndex, int firstCurveIndex, int numCurves, vector4 *keyArray) |
| sample values from curve range | |
| nTime | GetDuration (int groupIndex) const |
| get duration of entire animation | |
| void | SetNumGroups (int g) |
| set number of groups in animation | |
| int | GetNumGroups () const |
| get number of groups in animation | |
| Group & | GetGroupAt (int i) const |
| get group at index | |
Protected Member Functions | |
| virtual void | UnloadResource () |
| unload the resource (clears the valid flag) | |
| void | FixKeyOffsets () |
| fix the firstKeyIndex and keyStride members in the contained animation curve objects | |
Protected Attributes | |
| nArray< Group > | groupArray |
Classes | |
| class | Curve |
| holds animation curve information More... | |
| class | Group |
| holds animation group information (a group of curves) More... | |
Constructor & Destructor Documentation
|
|
constructor
Definition at line 12 of file nanimation_main.cc. |
|
|
destructor
Definition at line 21 of file nanimation_main.cc. |
Member Function Documentation
|
||||||||||||||||||||||||
|
sample values from curve range This method should be overwritten by subclasses. Reimplemented in nMemoryAnimation. Definition at line 43 of file nanimation_main.cc. |
|
|
get duration of entire animation Returns the playback duration in seconds of an animation group. Definition at line 53 of file nanimation_main.cc. |
|
|
set number of groups in animation
Definition at line 668 of file nanimation.h. |
|
|
get number of groups in animation
Definition at line 678 of file nanimation.h. |
|
|
get group at index
Definition at line 688 of file nanimation.h. |
|
|
unload the resource (clears the valid flag)
Reimplemented from nResource. Reimplemented in nMemoryAnimation. Definition at line 33 of file nanimation_main.cc. |
|
|
fix the firstKeyIndex and keyStride members in the contained animation curve objects
|
Member Data Documentation
|
|
Definition at line 234 of file nanimation.h. |
The documentation for this class was generated from the following files: