pfDirData(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
NAMEpfDirData - A class used to associate a set of data with a set of
directions.
FUNCTION SPECIFICATION
#include <Performer/pf/pfIBR.h>
void pfDirData::setData(int num, pfVec3 *directions,
void **userData);
void pfDirData::getDirData(int *num, pfVec3 **directions,
void ***userData);
void pfDirData::setDirections(int num, pfVec3 *directions);
void pfDirData::getDirections(int *num, pfVec3 **directions);
void pfDirData::generateDirections(int num, int type, float *data);
void * pfDirData::findData(pfVec3 *dir, pfVec3 *resDir);
void * pfDirData::findData2(pfVec3 *dir, pfVec3 *resDir,
void **resData, float *weight);
void * pfDirData::findData3(pfVec3 *dir, pfVec3 *resDir,
void **resData, float *weight);
void * pfDirData::findData4(pfVec3 *dir, pfVec3 *resDir,
void **resData, float *weight);
int pfDirData::getNumGroups(int *viewsPerGroup);
int pfDirData::getGroup(int group, int *views);
int pfDirData::getNeighboringViews(int viewIndex, int **neighbors);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfDirData is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfDirData. This is also true for
ancestor classes of class pfObject.
void* pfObject::operator new(size_t);
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();
Page 1
pfDirData(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfDirData 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
A pfDirData is used to store directional data, that is data that depend
on direction. Most common use is in case of image based rendering where a
complex object viewed from a certain direction is replaced by a texture
representing a view from this direction or a close direction.
A pfDirData stores an array of directions and an array of (void *)
pointers representing the data associated with each direction. The
directions and data can be set using pfDirData::setData. Optionally, the
user can set only the directions using pfDirData::setDirections in case
the associated data are defined later or generated internally by a
Performer class (such as pfShadow).
Directions can be also generated automatically using
pfDirData::generateDirections. The parameter type defines one of the
default sets of directions and parameter data is used to specify
additional values. At present three types of direction distributions are
supported.
When type is set to PFDD_2D_ROTATE_AROUND_UP parameter data points to a
3D vector that is rotated around the up vector, creating num directions.
When type is set to PFDD_RINGS_OF_VIEWS parameter data points to an array
of 2*num floats that specify num rings of views. The first float
specifies the angle of all views in the given ring from the horizontal
plane (in degrees) and the second float specifes the number of views in
the ring. The views are distributed uniformly around the vertical axis.
Page 2
pfDirData(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
When type is set to PFDD_3D_UNIFORM num direction are generated and they
are uniformly distributed all around. The parameter data is ignored.
If user specifies the directions, it is detected whether the directions
are of type PFDD_2D_ROTATE_AROUND_UP or PFDD_RINGS_OF_VIEWS. Otherwise it
is assumed that direction are distributed without any pattern.
The data can be queried using pfDirData::findData, pfDirData::findData2,
pfDirData::findData3, and pfDirData::findData4. In the first case, the
function finds the closest direction to the specified direction dir,
copies it to the second parameter resDir, and returns the pointer to the
data associated with it. The input direction has to be normalized.
The second function finds the two closest directions to the specified
direction dir. It copies the two directions to the second parameter
resDir (which should point to an array of two vectors). The two pointers
to the data associated with the two directions are copied to the array of
two (void *) pointers specified as the third parameter resData. In
addition, two weights associated with each direction are copied to the
array weight. These weights are determined based on the distance of the
end point of the input direction and each of the two closest directions.
The third and fourth function operate similarly as the second function,
but they return 3 or 4 directions and associated weights, respectively.
Note that pfDirData::findData3 should be not be used when the directions
are of type PFDD_2D_ROTATE_AROUND_UP or PFDD_RINGS_OF_VIEWS. Also,
pfDirData::findData4 should be used only when the directions are of type
PFDD_RINGS_OF_VIEWS and more than one ring of views is specified.
Otherwise the result is undefined.
In case of 3D uniform views and ring of views it is possible to determine
how many groups of views there are. A group is a triplet or quadruplet of
views that is returned for an arbitrary view. It maybe desirable to know
how many possible groups there are and what directions they consist of.
To obtain this information, you can use function pfDirData::getNumGroups
and pfDirData::getGroup. All functions findData return the group the
given direction falls to.
Function pfDirData::getNeighboringViews returns the list of views that
are part of all groups that contain the given view.
SEE ALSO
pfObject, pfShadow
Page 3