pfDirData(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfDirData(3pf)NAME
pfNewDirData, pfDirDataData, pfGetDirDataDirData, pfDirDataDirections,
pfGetDirDataDirections, pfDirDataGenerateDirections, pfDirDataFindData,
pfDirDataFindData2, pfDirDataFindData3, pfDirDataFindData4,
pfGetDirDataNumGroups, pfGetDirDataGroup, pfGetDirDataNeighboringViews-
A class used to associate a set of data with a set of directions.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfDirData* pfNewDirData(void *arena);
void pfDirDataData(pfDirData* _dirdata, int num,
pfVec3 *directions, void **userData);
void pfGetDirDataDirData(pfDirData* _dirdata, int *num,
pfVec3 **directions, void ***userData);
void pfDirDataDirections(pfDirData* _dirdata, int num,
pfVec3 *directions);
void pfGetDirDataDirections(pfDirData* _dirdata, int *num,
pfVec3 **directions);
void pfDirDataGenerateDirections(pfDirData* _dirdata, int num,
int type, float *data);
void* pfDirDataFindData(pfDirData* _dirdata, pfVec3 *dir,
pfVec3 *resDir);
void* pfDirDataFindData2(pfDirData* _dirdata, pfVec3 *dir,
pfVec3 *resDir, void **resData, float *weight);
void* pfDirDataFindData3(pfDirData* _dirdata, pfVec3 *dir,
pfVec3 *resDir, void **resData, float *weight);
void* pfDirDataFindData4(pfDirData* _dirdata, pfVec3 *dir,
pfVec3 *resDir, void **resData, float *weight);
int pfGetDirDataNumGroups(pfDirData* _dirdata,
int *viewsPerGroup);
int pfGetDirDataGroup(pfDirData* _dirdata, int group,
int *views);
int pfGetDirDataNeighboringViews(pfDirData* _dirdata,
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. Casting an object of
Page 1
pfDirData(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfDirData(3pf)
class pfDirData to an object of class pfObject is taken care of
automatically. This is also true for casts to objects of ancestor
classes of class pfObject.
void pfUserDataSlot(pfObject *obj, int slot, void *data);
void pfUserData(pfObject *obj, void *data);
void* pfGetUserDataSlot(pfObject *obj, int slot);
void* pfGetUserData(pfObject *obj);
int pfGetNumUserData(pfObject *obj);
int pfGetNamedUserDataSlot(const char *name);
const char* pfGetUserDataSlotName(int slot);
int pfGetNumNamedUserDataSlots(void);
int pfDeleteGLHandle(pfObject *obj);
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.
pfType * pfGetType(const void *ptr);
int pfIsOfType(const void *ptr, pfType *type);
int pfIsExactType(const void *ptr, pfType *type);
const char * pfGetTypeName(const void *ptr);
int pfRef(void *ptr);
int pfUnref(void *ptr);
int pfUnrefDelete(void *ptr);
int pfUnrefGetRef(void *ptr);
int pfGetRef(const void *ptr);
int pfCopy(void *dst, void *src);
int pfDelete(void *ptr);
int pfIsFluxed(void *ptr);
int pfCompare(const void *ptr1, const void *ptr2);
void pfPrint(const void *ptr, uint which, uint verbose,
FILE *file);
void * pfGetArena(void *ptr);
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 pfDirDataData. Optionally, the user
can set only the directions using pfDirDataDirections 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
pfDirDataGenerateDirections. The parameter type defines one of the
default sets of directions and parameter data is used to specify
Page 2
pfDirData(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfDirData(3pf)
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.
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 pfDirDataFindData, pfDirDataFindData2,
pfDirDataFindData3, and pfDirDataFindData4. 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 pfDirDataFindData3 should be not be used when the directions
are of type PFDD_2D_ROTATE_AROUND_UP or PFDD_RINGS_OF_VIEWS. Also,
pfDirDataFindData4 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 pfGetDirDataNumGroups
and pfGetDirDataGroup. All functions findData return the group the given
direction falls to.
Page 3
pfDirData(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfDirData(3pf)
Function pfGetDirDataNeighboringViews returns the list of views that are
part of all groups that contain the given view.
SEE ALSO
pfObject, pfShadow
Page 4