pfMatStack(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
NAMEpfMatStack - Create and manipulate a matrix stack.
FUNCTION SPECIFICATION
#include <Performer/pr/pfLinMath.h>
pfMatStack::pfMatStack();
pfMatStack::pfMatStack(int size);
static pfType * pfMatStack::getClassType(void);
void pfMatStack::reset(void);
int pfMatStack::push(void);
int pfMatStack::pop(void);
void pfMatStack::preMult(const pfMatrix &m);
void pfMatStack::postMult(const pfMatrix &m);
void pfMatStack::load(const pfMatrix &m);
void pfMatStack::get(pfMatrix &m);
pfMatrix * pfMatStack::getTop(void);
int pfMatStack::getDepth(void);
void pfMatStack::preTrans(float x, float y, float z);
void pfMatStack::postTrans(float x, float y, float z);
void pfMatStack::preRot(float degrees, float x, float y,
float z);
void pfMatStack::postRot(float degrees, float x, float y,
float z);
void pfMatStack::preScale(float xs, float ys, float zs);
void pfMatStack::postScale(float xs, float ys, float zs);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfMatStack is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfMatStack. This is also true for
ancestor classes of class pfObject.
Page 1
pfMatStack(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
void* pfObject::operator new(size_t);
void* pfObject::operator new(size_t, void *arena);
void* pfObject::operator new(size_t, pfFluxMemory *fmem);
void pfObject::setUserData(void *data);
void pfObject::setUserData(int slot, void *data);
void* pfObject::getUserData(pfObject *obj);
void* pfObject::getUserData(pfObject *obj, int slot);
int pfObject::getNumUserData();
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfMatStack can also be used with these
functions designed for objects of class pfMemory.
void* pfMemory::getData(const void *ptr);
pfType * pfMemory::getType();
int pfMemory::isOfType(pfType *type);
int pfMemory::isExactType(pfType *type);
const char * pfMemory::getTypeName();
int pfMemory::copy(pfMemory *src);
int pfMemory::compare(const pfMemory *mem);
void pfMemory::print(uint which, uint verbose, char *prefix,
FILE *file);
int pfMemory::getArena(void *ptr);
void* pfMemory::getArena();
int pfMemory::ref();
int pfMemory::unref();
int pfMemory::unrefDelete();
int pfMemory::unrefGetRef();
int pfMemory::getRef();
int pfMemory::checkDelete();
int pfMemory::isFluxed();
void * pfMemory::getArena();
int pfMemory::getSize();
DESCRIPTION
These routines allow the creation and manipulation of a stack of 4x4
matrices.
new(arena) allocates a pfMatStack from the specified memory arena, or
from the process heap if arena is NULL. new allocates a pfMatStack from
the default memory arena (see pfGetSharedArena). Like other pfObjects,
pfMatStacks cannot be created statically, automatically on the stack or
in arrays. The default constructor creates a matrix stack 64 deep.
Another constructor is provided that takes a size argument. pfMatStacks
should be deleted with pfDelete rather than the delete operator. size is
the number of pfMatrix's in the matrix stack. The initial depth is 1 and
the top of stack is the identity matrix.
pfMatStack::getClassType returns the pfType* for the class pfMatStack.
The pfType* returned by pfMatStack::getClassType is the same as the
pfType* returned by invoking the virtual function getType on any instance
Page 2
pfMatStack(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
of class pfMatStack. Because OpenGL Performer allows subclassing of
built-in types, when decisions are made based on the type of an object,
it is usually better to use the member function isOfType to test if an
object is of a type derived from a Performer type rather than to test for
strict equality of the pfType*'s.
pfMatStack::reset sets the stack depth to 1 and sets the top of stack to
the identity matrix.
pfMatStack::push pushes down the specified matrix stack duplicating the
top. pfMatStack::pop pops the matrix stack. Attempting to pop a matrix
stack containing only a single element or pushing past the maximum depth
causes a warning and leaves the stack unchanged.
pfMatStack::preMult pre-multiplies the top of the stack by the matrix m
and replaces the top of the stack with the product. Thus if T is the top
of the stack, the operation replaces T with m*T. This order corresponds
to that used by OpenGL's glMultMatrix. pfMatStack::postMult operates
similarly but using post-multiplication, calculating T*m instead.
pfMatStack::load replaces the top of the stack with the matrix m.
pfMatStack::get copies the top of the matrix into the matrix m.
pfMatStack::getTop returns a pointer to the top of the matrix stack.
pfMatStack::getDepth returns the current depth of the stack. Initially
the depth is 1.
The following transformations pre- and post- multiply the top of the
matrix stack:
pfMatStack::preTrans and pfMatStack::postTrans respectively pre- and
post- multiply the top of the matrix stack by the translation matrix
generated by the coordinates x, y and z. (See pfMatrix::makeTrans).
pfMatStack::preRot and pfMatStack::postRot respectively pre- and post-
multiply the top of the matrix stack by the rotation by degrees about the
axis defined by (x, y, z). (See pfMatrix::makeRot). The results are
undefined if the vector (x, y, z) is not normalized.
pfMatStack::preScale and pfMatStack::postScale respectively pre- and
post- multiply the top of the matrix stack by a scaling matrix. (See
pfMatrix::makeScale). The matrix scales by x in the X direction, y and
the Y direction and z in the Z direction.
NOTES
pfMatStack::preRot and pfMatStack::postRot use pfSinCos which is faster
than the libm counterpart, but has less resolution.
pfMatStack is not related to the GL matrix stack.
IMPORTANT: The argument order of degrees and axis to the
Page 3
pfMatStack(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
pfMatStack::preRot are not the same as to the corresponding routine
pfRotMStack in the IRIS Performer 1.0 and IRIS Performer 1.1 releases.
This change was first introduced in the IRIS Performer 1.2 release and is
present in subsequent releases of OpenGL Performer.
SEE ALSO
pfDelete, pfMakeRotMat, pfMakeScaleMat, pfMakeTransMat, pfMatrix,
pfSinCos, multmatrix
Page 4