pfIBRtexture(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
NAME
pfIBRtexture, getNumIBRTextures, setIBRdirections, getIBRdirections - A
class used to store a set of images, views of a object.
FUNCTION SPECIFICATION
#include <Performer/pf/pfIBR.h>
pfIBRtexture::pfIBRtexture();
void pfIBRtexture::loadIBRTexture(char *format, int num,
int step);
void pfIBRtexture::setIBRTexture(pfTexture **textures,
int numTex);
void pfIBRtexture::getIBRTextures(pfTexture ***textures,
int *numTex);
int getNumIBRTextures(void);
pfTexture * pfIBRtexture::getDefaultTexture(void);
void pfIBRtexture::setFlags(int which, int value);
int pfIBRtexture::getFlags(int which);
void setIBRdirections(pfVec3 *directions, int numDirs);
void getIBRdirections(pfVec3 **directions, int *numDirs);
void pfIBRtexture::setDirection(float dir);
float pfIBRtexture::getDirection(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfIBRtexture is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfIBRtexture. 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();
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfIBRtexture can also be used with these
functions designed for objects of class pfMemory.
Page 1
pfIBRtexture(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
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 pfIBRtexture stores a set of images of a complex object as viewed from
different directions. The directions are specified using
pfIBRtexture::setIBRdirections. Internally, pfIBRtexture uses pfDirData
to store the views. pfDirData determines the type of view distribution.
It could be a set of views around the object, all perpendicular to the
vertical axis. Or the views can be a set of rings and each ring contains
an array of evenly spaced views that have the same angle from the
horizontal plane. Otherwise, the views are assumed to be uniformly or
randomly distributed around the sphere of directions. The directions
have to be specified before the images are set.
Once the directions are specified the images are set using
pfIBRtexture::setIBRtextures. The parameters are an array of pointer to
the textures containing the views and the number of the textures in this
array.
If views are organized in rings the images can be loaded directly from a
set of files using pfIBRtexture::loadIBRtexture without the need to
specify the directions first. The parameter format specifies the path in
which the images are stored as well as how they are indexed, for example,
"images/view%03d.rgb". The other two parameters specify the number of
images and the increment between two loaded images (this is useful when
the texture memory is limited, by specifying step=2 every second image is
skipped).
If the flag PFIBR_3D_VIEWS is not set function
pfIBRtexture::loadIBRtexture sets one ring with specified number of
textures and a horizontal angle of 0. If the flag PFIBR_3D_VIEWS is set
the class checks whether a file 'info' is present in the image directory.
If it is the information about rings is loaded from that file. It contain
Page 2
pfIBRtexture(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
two values at each line - the horizontal angle and the number of texture
at each ring. If the file is not present in the image directory the
directions have to be specified before the images are loaded by calling
pfIBRtexture::setIBRdirections. Rings are indexed from 0 and should be
ordered by the horizontal angle, with the lowest angle at index 0. Each
ring can have different number of textures associated with it.
When rings of views are used the image files read by function
pfIBRtexture::loadIBRtexture should be indexed by the ring index and the
index of the image in a given ring. The format string should be set
appropriately, e.g. "images/view%02d_%03d.rgb". In case the textures are
specified by the user using pfIBRtexture::setIBRtextures the texture
pointers are all stored in a single array, starting with textures of the
first ring, followed by textures of the second ring, and so on.
It is assumed that the views in each ring are uniformly spaced and they
are ordered clockwise with respect to the vertical axis. If the views are
ordered in the opposite direction, set the direction to -1 by
pfIBRtexture::setDirection.
At present, pfIBRtexture is used only by pfIBRnode. It provides a draw
function for pfGeoSets that belong to the pfIBRnode, but the draw process
is transparent to the user. The user can control it by setting flags
using the function pfIBRtexture::setFlags. If the flag PFIBR_NEAREST is
set the closest view is selected and applied as a texture of the
pfGeoSet. This approach is fast on all platforms, but it results in
visible jumps when the texture is changed.
Thus by default the flag PFIBR_NEAREST is not set and two to four close
views are blended together, based on the distribution of the view. In
case of one ring of views, two views are blended, in case of several
rings of views four views are blended and in case of uniform or random
distribution of views 3 views are blended together.
If the graphics hardware supports register combiners flags
PFIBR_USE_REG_COMBINERS and PFIBR_USE_2D_TEXTURES are automatically set
by the class constructor and the blending of textures can be done in one
pass.
On IRIX, by default the flag PFIBR_USE_2D_TEXTURES is not set and a 3D
texture is used for fast blending between two closest views. To avoid
flickering when the object is viewed from a distance additional 3D
textures are used to store additional mipmap levels This feature is
available on machines with multisampling only (IR). To disable the
mipmapping, set flag PFIBR_MIPMAP_3DTEXTURES to zero. In case of several
rings, the nearest ring is selected and the views inside this ring are
blended using the 3D texture. 3D texture is not compatible with other
distributions of the views so make sure that in that case you set flag
PFIBR_USE_2D_TEXTURES.
Flag PFIBR_USE_PROXY is used when the views are mapped on an
Page 3
pfIBRtexture(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
approximation of the complex object (a proxy) and different version of
the draw functions have to be applied. You can read more about proxies in
the man page for pfIBRnode.
See pfIBRnode man page and program sample/pguide/C++/IBRnode for more
details of how to associate a pfIBRtexture with a pfIBRnode. See also
man page for makeIBRimages, a tool for generating views of a specified
object.
LIMITATIONS
When the flag PFIBR_3D_VIEWS is set 3D textures should not be used. This
mode is not implemented.
NOTES
When using pfIBRnodes and pfIBRtextures in perfly, you need an alpha
buffer. If the pfIBRnode is rendered as an opaque rectangle try command
line parameter -9 in which case perfly requests a visual with alpha
buffer.
SEE ALSO
pfObject, pfDirData, pfIBRnode, makeIBRimages
Page 4