pfLODState(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
NAME
pfNewLODState, pfGetLODStateClassType, pfLODStateAttr, pfGetLODStateAttr,
pfLODStateName, pfGetLODStateName, pfFindLODState - Create, modify, and
query level of detail state.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfLODState * pfNewLODState(void);
pfType * pfGetLODStateClassType(void);
void pfLODStateAttr(pfLODState *ls, long attr, float val);
float pfGetLODStateAttr(pfLODState *ls, long attr);
int pfLODStateName(pfLODState *ls, const char *name);
const char * pfGetLODStateName(const pfLODState *ls);
pfLODState * pfFindLODState(const char *name);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfLODState is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfLODState. Casting an object of
class pfLODState 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 pfLODState 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);
Page 1
pfLODState(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
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);
PARAMETERS
ls identifies a pfLODState.
DESCRIPTION
pfLODState encapsulates a definition of how an LOD or group of LODs
should respond to distance from the eyepoint and stress. Currently,
there are 8 attributes that can be used to define LOD child selection and
child transition distance based on a LOD's distance from the channel's
viewpoint and the channel's stress (see pfNewChan and pfChanStress).
pfNewLODState creates and returns a handle to a pfLODState. Like other
pfNodes, pfLODStates are always allocated from shared memory and can be
deleted using pfDelete.
pfGetLODStateClassType returns the pfType* for the class pfLODState. The
pfType* returned by pfGetLODStateClassType is the same as the pfType*
returned by invoking pfGetType on any instance of class pfLODState.
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 pfIsOfType 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.
pfLODStateAttr and pfGetLODStateAttr are used to set and get the
following attributes:
PFLODSTATE_RANGE_RANGESCALE, PFLODSTATE_RANGE_RANGEOFFSET
directly modify the geometric range used to determine the
current LOD child.
PFLODSTATE_RANGE_STRESSSCALE, PFLODSTATE_RANGE_STRESSOFFSET
modify the way the current channel stress affects the range
computation.
PFLODSTATE_TRANSITION_RANGESCALE, PFLODSTATE_TRANSITION_RANGEOFFSET
directly modify the transition widths set by pfLODTransition.
PFLODSTATE_TRANSITION_STRESSSCALE, PFLODSTATE_TRANSITION_STRESSOFFSET
modify the way transition widths are adjusted by the channel
stress value.
Page 2
pfLODState(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
These scale and offset values adjust the LOD selection process in the
following way, presented in pseudocode:
effectiveRange =
OverallLODScale *
(Range * RANGE_RANGESCALE + RANGE_RANGEOFFSET) *
(Stress * RANGE_STRESSSCALE + RANGE_STRESSOFFSET);
effectiveTransitionWidth[i] =
OverallFadeScale *
(Trans[i] * TRANSITION_RANGESCALE + TRANSITION_RANGEOFFSET) /
(Stress * TRANSITION_STRESSSCALE + TRANSITION_STRESSOFFSET);
OverallLODScale and OverallFadeScale are the PFLOD_SCALE and PFLOD_FADE
attributes set with pfChanLODAttr. Both are global values that affect the
switching and transition ranges of all pfLODs in the scene.
The default values for all SCALE and OFFSET attributes are 1.0 and 0.0
respectively except TRANSITION_STRESSSCALE and TRANSITION_STRESSOFFSET
which are 0.0 and 1.0 respectively, i.e., transition ranges are not
scaled by stress by default.
A pfLODState influences a pfLOD's behavior in one of 3 ways:
1. Direct reference. A pfLOD may directly reference a pfLODState
with pfLODLODState.
2. Indexed. A pfLOD may index a pfLODState with
pfLODLODStateIndex. When the LOD is evaluated, the indexth
entry of the evaluating pfChannel's pfLODState table is used. A
pfChannel's pfLODState table is set with (pfChanLODStateList).
With indexed pfLODStates, different pfChannels can have
different LOD behavior by using different pfLODState tables,
e.g., an infrared channel may not "see" cold objects as well as
a visual channel so "cold" pfLODs will index a different
pfLODState in the infrared channel than in the visual channel.
3. Inherited from pfChannel. A pfLOD which does not directly
reference or index a pfLODState will use the pfLODState of the
evaluating pfChannel (pfChanLODState). This is the default
pfLOD behavior.
When a pfLOD references or indexes a pfLODState, the SCALE and OFFSET
parameters of the pfLODState are multiplied and added, respectively, to
the corresponding SCALE and OFFSET parameters of the evaluating
pfChannel's pfLODState, e.g., effective RANGE_RANGESCALE = pfLODState's
RANGE_RANGESCALE * pfChannel's RANGE_RANGESCALE.
Multiple pfLODs may share the same pfLODState reference or index.
Page 3
pfLODState(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
pfLODStateName and pfGetLODStateName set and get the name of a particular
pfLODState while pfFindLODState will return the first pfLODState defined
with the given name.
SEE ALSO
pfLOD, pfChannel, pfChanLODAttr, pfChanStress
Page 4