pfRotorWash(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
NAME
pfNewRotorWash, pfGetRotorWashClassType, pfGetRotorWashNode,
pfGetRotorWashTexture, pfRotorWashTextures, pfRotorWashColor,
pfRotorWashRadii, pfRotorWashAlpha, pfRotorWashDisplacement,
pfRotorWashSubdivisionLevel, pfRotorWashMaxTriangles,
pfRotorWashHighlight, pfRotorWashUnhighlight, pfRotorWashCompute - Create
dynamic rotor wash graph
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfRotorWash* pfNewRotorWash(int mesh_rings, int mesh_spokes,
void *arena);
pfType* pfGetRotorWashClassType(void);
pfNode* pfGetRotorWashNode(pfRotorWash* rotorwash);
pfTexture* pfGetRotorWashTexture(pfRotorWash* rotorwash,
pfGeoState *gstate, int frame);
void pfRotorWashTextures(pfGeoState **geostates, int num,
char *name, int numtex);
void pfRotorWashColor(pfRotorWash* rotorwash,
pfGeoState *geostate, float red, float green,
float blue, float alpha);
void pfRotorWashRadii(pfRotorWash* rotorwash, float in_1,
float in_2, float out_1, float out_2);
void pfRotorWashAlpha(pfRotorWash* rotorwash, float a_inner,
float a_outer);
void pfRotorWashDisplacement(pfRotorWash* rotorwash,
float value);
void pfRotorWashSubdivisionLevel(pfRotorWash* rotorwash,
int level);
void pfRotorWashMaxTriangles(pfRotorWash* rotorwash,
int maxTris);
void pfRotorWashHighlight(pfRotorWash* rotorwash, float red,
float green, float blue);
void pfRotorWashUnhighlight(pfRotorWash* rotorwash);
void pfRotorWashCompute(pfRotorWash* rotorwash,
pfNode *terrain, float x, float y, float phase);
Page 1
pfRotorWash(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfRotorWash is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfRotorWash. Casting an object of
class pfRotorWash 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 pfRotorWash 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 pfRotorwash is a high level OpenGL Performer class, it is derived from
a pfObject for memory allocation purposes. A pfRotorwash is used to
create a graph including geometry and pfState which represents the visual
downwash effect on terrain or water. The geometry changes dynamically
with the scene and position from which it is generated. The
pfNewRotorWash function has an argument to specify the number of radial
subdivisions or spokes in the circular rotor wash pattern. A sensible
value would be something like 12 or less. More are possible but the
computational overhead increases with the number and the complexity of
the terrain for which the wash must be computed. The rings argument is
not currently supported but is provided for possible future use.
Page 2
pfRotorWash(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
Once created the pfRotorWash can be querried for the pfNode it will use
as the root of it's graph using the pfRotorWashGetNode function, the same
node is also returned by the constructor. This pfNode must then be added
to the scene graph to display the visual results of the calculation.
Whenever the application wants a new mesh calculated or the texture
coordinates animated it should call the pfRotorWashCompute function
providing, as arguments, the position of the rotorwash, the pfNode
containing the graph to be traversed for the creation of the geometry and
the phase for animation of texture images and coordinates. The geometry
is processed and should be used entirely in object space. Transformation
nodes are not supported at this time due to the computational cost of
this feature. All pfSequence and pfLOD children will contribute triangles
to the final mesh, currently there is no discrimination of children for
these types of nodes. This means that the pfNode obtained from the
pfRotorWash must be added below the same transformation as the leaf
geometry it uses to generate it's mesh.
pfRotorWashDisplacement In order to prevent zfighting artifacts the
application may set a displacement value for the pfRotorWash geometry
above the terrain it rests upon. Displacement is along the Z axis.
pfRotorWashRadii is provided to specify the radii of the rotor wash.
pfRotorWashAlpha specifies two transparency levels for the rotorwash
effect. The effect is bound by two concentric circles at radii in_1 and
out_2. The transparency of the rotorwash is controlled by four
concentric circles at radii in_1, in_2, out_1 and out_2. The
transparency of the effect is zero at radius in_1 and out_2. It is
a_inner at radius in_2 and a_outer at radius out_1. The per vertex alpha
values of the geometry created by the pfRotorWash are based on the vertex
distance in the x-y plane from the center of the pfRotorWash position.
The transparency level between the above radii is piecewise linearly
interpolated between the four alpha values.
pfRotorWashSubdivisionLevel controls the way scene geometry is
subdivided. Each scene primitive within the rotor wash radius out_2 is
subdivided along rotorwash spokes and a set of rotor wash triangles is
generated. If the underlying primitives are large these triangles span
all concentric circles and the alpha values specified at the triangle
vertices do not interpolate correctly across the circles. Thus the
triangles are further subdivided along the boundaries of circles
specified by rotor wash radii. The subdivision can result in too many
triangles, slowing down the draw process. You can set the subdivision
level to values between 0 and 4 to control how many circles are used to
subdivide the triangles. If the value is set to 0, no circle is used. If
it is set to 1, the circle at radius out_1 is used. If it is set to 2,
the circles at radii out_1 and out_2 are used. If it is set to 3, the
circles at radii out_1, out_2, and in_2 are used. If it is set to 4, all
four circles ar used. The default value is 4, but 2 is often sufficient.
You can see subdivided triangles in the rotor wash demo program in
/usr/share/Performer/src/sample/C++/rotorwash/. Press key 'w' to display
the rotor wash wireframe and then press keys '0' to '4' to change the
Page 3
pfRotorWash(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages
subdivision level.
If the number of rotor wash triangles hits a predefined number no
additional triangles are subdivided. This may result in artifacts in some
spokes of the rotor wash over large scene primitives - suddenly some
parts of the rotor wash become too large. If that happens try to increase
the maximum number of triangles using pfRotorWashMaxTriangles. The
default value is 3000 and you can increase it to up to 10,000 triangles.
pfRotorWashColor specifies the color that is used to modulate the alpha
value for the inner and outer radii methods.
pfRotorWashTextures The pfRotorWash also supports a general means of
associating different types of wash with different types of scene data.
This is done when specifying the texture animation images to be used by
the pfRotorWash. Many textures may be used by a pfRotorWash, each set of
textures is associated with a list of pfGeoStates. If geostates is set to
NULL, then a wildcard texture animation will be used when no other
explicit texture set is specified for geostate encountered during the
compute traversal. The name and number are used to load a group of
textures which will be animated in sequence based on the value of phase.
The name for the image file loader is formulated based on the following
code fragment: sprintf(name_used, "%s0%d", name_supplied, number) for
values less then 10 and sprintf(name_used, "%s%d", name_supplied, number)
for values greater than 10. If name is set to NULL a default texture
animation will be used for the given list of geosets. The user can change
the color of the amination for the given geosets by caling
pfRotorWashColor with one of the geosets from the list.
pfRotorWashHighlight Highlighting is supported by pfRotorWash, when
activated the mesh will be drawn in wireframe in the color supplied as
the red, green and blue color component arguments.
SEE ALSO
pfObject, pfNode
Page 4