pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
NAMEpfvmSkyDome - SkyDome module for pfvViewer
FUNCTION SPECIFICATION
#include <Performer/pfvm/pfvmSkyDome.h>
pfvmSkyDome::pfvmSkyDome();
pfEarthSky* pfvmSkyDome::getESky();
void pfvmSkyDome::calcSunPos(uint seconds, pfVec4 &pos);
void pfvmSkyDome::updateTimeOfDay(time_t dateTime);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfvmSkyDome is derived from the parent class
pfvModule, so each of these member functions of class pfvModule are also
directly usable with objects of class pfvmSkyDome. This is also true for
ancestor classes of class pfvModule.
int pfvModule::getScope();
int pfvModule::getScopeIndex();
pfvObject* pfvModule::getScopeTarget();
int pfvModule::autoScope( int*scopeIndex );
void pfvModule::bindCallback(int which);
void pfvModule::unbindCallback(int which);
int pfvModule::getCBMask();
virtual void pfvModule::preConfig();
virtual void pfvModule::postConfig();
virtual void pfvModule::enterView(pfvView*v);
virtual void pfvModule::exitView(pfvView*v);
virtual void pfvModule::enterWorld();
virtual void pfvModule::exitWorld();
virtual void pfvModule::sync();
virtual void pfvModule::frame();
virtual void pfvModule::preCull(pfvDispChan*chan);
virtual void pfvModule::postCull(pfvDispChan*chan);
virtual void pfvModule::preDraw(pfvDispChan*chan);
virtual void pfvModule::postDraw(pfvDispChan*chan);
virtual void pfvModule::overlay(pfvDispChan*chan);
int pfvModule::bindKeys(char*keys);
int pfvModule::unbindKeys(char*keys)
char* pfvModule::getEventMask()
void pfvModule::setEventMask(char* str);
virtual int pfvModule::handleEvent(int evType, char key);
uint64_t pfvModule::getViewMask();
Since the class pfvModule is itself derived from the parent class
pfvobject, objects of class pfvmSkyDome can also be used with these
functions designed for objects of class pfvobject.
Page 1
pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
virtual int pfvObject::parseXml(pfvXmlNode*xml);
virtual int pfvObject::setXmlField(pfvXmlNode*xml);
char* pfvObject::getName();
void pfvObject::setName(char*_name);
Since the class pfvobject is itself derived from the parent class
pfObject, objects of class pfvmSkyDome can also be used with these
functions designed for objects 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 pfvmSkyDome 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();
DESCRIPTIONpfvmSkyDome is a pfv module that renders color-correct sky domes in
pfvViewer based applications.
The sky dome has the shape of a tent with 16 corners. Additionally
pfvmSkyDome modules may be configured to render a ground plane with an
optional grid using user provided parameters.
Page 2
pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
The behavior of this module is very similar to that of the pfvmEarthSky
module, in that its purpose is to initialize the scene background. In
fact, pfvmSkyDome modules will internally create a pfEarthSky object
which is attached to the master channel and used to set the clear mode.
All colors of the tent geometry may be set manually or computed
automatically according to the current time of day, date, and position on
earth (longitude/latitude) (and some extra colors used for that ToD
computations).
Time of day may be set to a static value or may be automatically advanced
by the pfvmSkyDome module, in which case all dynamic colors of skydome
will be recomputed at regular intervals of time.
The rendering of stars during night time can also be enabled. The stars
to be rendered are loaded from a geometry file called 3010.star, which is
with OpenGL Performer and contains a number of points of different size,
color and intensity.
Stars will fade in/out during twilights and will also move during the
night following a simple but configurable rotation path.
Additionally, during twilights a horizontal band will be added to the
tent geometry so that sunrise/sunsets effects can be rendered better.
Note that no sun geometry is drawn, and no pfLightSources or pfLights are
created or managed by the pfvmSkyDome module.
getESky() returns a pointer to the pfEarthSky object created by this
module. Note that if this method is called before module's postConfig
callback has been called (by pfvViewer), it will return NULL.
calcSunPos() computes the position of the sun at the specified time (Unix
time in seconds).
updateTimeOfDay forces the colors of the skydome vertices to be
recomputed based on the specified time parameter.
========
XML tags
========
<module>
<class>pfvmSkyDome</class>
<data>
...
parameters
Page 3
pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
...
</data>
</module>
where parameters is one or more of the following:
<mode>value</mode> where value is one of:
skyClear specifies that no ground should be rendered by pfvmSkyDome.
In this case the depth buffer will be cleared before skydome
geometry is rendered.
skyGrnd specifies that ground geometry should also be rendered. In
this case the framebuffer will not be cleared before rendering
skydome geometry.
The default value is skyGrnd.
<DepthMode>value</DepthMode> where value is one of:
depthOff specifies that no depth clearing should be carried out, and
that depth test should be disabled while drawing the sky dome
geometry.
depthInit specifies that depth values should be initialized to the
max depth value when rendering sky dome geometry.
<GrndHt>float</GrndHt> takes a float representing what the ground height
should be. The default is: 0.0
<Far>float</GrndHt> Specifies the Far plane distance.
<HorizAngle>float</HorizAngle>
<ComputeTodColors>bool</ComputeTodColors> Specifies whether sky dome
colors should be computed automatically based on time-of-day.
<TimeWarp>float</TimeWarp> Specifies the rate at which time-of-day will
be automatically updated. Default is 1.0, meaning that simulation time
will run at the same speed as real-life time.
<TimeOffset>float</TimeOffset> Specifies an offset to be added to the
time-of-day. The default value is 0.0.
Page 4
pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
<UnixTime>current date/time plus TimeOffset as integer</UnixTime>
Specifies the simulation starting time-of-day.
<Latitude>float</Latitude> and <Longitude>float</Longitude> specify
latitude and longitude values used in the computation to determine the
colors of the sky dome vertices.
The default value is 0.0 for both.
<SkyColor>float,float,float</SkyColor> takes three floats representing
r,g,b respectively. The default is: 0.7,0.7,1.0.
<SkyTopColor>float,float,float</SkyTopColor> takes three floats
representing r,g,b respectively. The default is: 0.3,0.3,1.0.
<SkyMidColor>int,float,float,float</SkyMidColor> Specifies SkyMidColor
for a single vertex (or for all vertices) of sky dome. Takes an integer
value representing vertex index, followed by three floats representing
r,g,b respectively. An index value of -1 will set SkyMidColor for all 16
vertices of sky dome. The default is: -1, 0.55,0.55,1.0.
<SkyBotColor>int,float,float,float</SkyBotColor> Specifies SkyBotColor
for a single vertex (or for all vertices) of sky dome. Takes an integer
value representing vertex index, followed by three floats representing
r,g,b respectively. An index value of -1 will set SkyBotColor for all 16
vertices of sky dome. The default is: -1, 0.8,0.8,1.0.
<GroundColor>float,float,float</GroundColor> takes three floats
representing r,g,b respectively. The default is: 0.3,0.5,0.3.
<GrndFarColor>int,float,float,float</GrndFarColor> Specifies GrndFarColor
for a single vertex (or for all vertices) of sky dome. Takes an integer
value representing vertex index, followed by three floats representing
r,g,b respectively. An index value of -1 will set GrndFarColor for all 16
vertices of sky dome. The default is: -1, 0.5,0.8,0.5.
<GrndNearColor>float,float,float</GrndNearColor> takes three floats
representing r,g,b respectively. The default is: 0.3,0.5,0.3.
<HorizColor>int,float,float,float</HorizColor> Specifies HorizColor for a
single vertex (or for all vertices) of sky dome. Takes an integer value
Page 5
pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
representing vertex index, followed by three floats representing r,g,b
respectively. An index value of -1 will set HorizColor for all 16
vertices of sky dome. The default is: -1, 0.5,0.8,0.5.
<NightSkyCol>float,float,float</NightSkyCol> takes three floats
representing r,g,b respectively. The default is: 0.04,0.04,0.08.
<AstroTwilightColor>float,float,float</AstroTwilightColor> takes three
floats representing r,g,b respectively. The default is: 0.04,0.04,0.18.
<NauticalTwilightColor>float,float,float</NauticalTwilightColor> takes
three floats representing r,g,b respectively. The default is:
0.28,0.28,0.50.
<RedSunColor>float,float,float</RedSunColor> takes three floats
representing r,g,b respectively. The default is: 0.4,0.1,0.1.
<YellowSunColor>float,float,float</YellowSunColor> takes three floats
representing r,g,b respectively. The default is: 0.7,0.7,0.1.
<HorizonColor>float,float,float</HorizonColor> takes three floats
representing r,g,b respectively. The default is: 0.7,0.7,1.0.
<Stars>bool</Stars> Specifies whether stars should be rendered (at night
time).
<StarAngle>float</StarAngle> Specifies orientation of the axis around
which stars revolve. Default value is 0.0
<StarTransp>float</StarTransp> Specifies alpha value used when rendering
star points. Default value is 1.0 (fully opaque).
<Grid>bool</Grid> Specifies whether a grid should be rendered at ground
level. Default is 0.
<GridSize>int</GridSize> Specifies the overall size of the grid on the x
and y axis. The default is (int)(0.6f * farPlaneDistance).
<GridStep>int</GridStep> Specifies the distance between consecutive lines
in grid. Default value is (int)(gridSize/10).
Page 6
pfvmSkyDome(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
<GridColor>float,float,float,float</GridColor> Specifies color used to
render grid lines. takes four floats representing r,g,b,a respectively.
The default is: 0.28,0.28,0.50.
============
RunTime Keys
============
Some features can be controlled by (hardcoded) keys:
# toggle drawing of the ground grid
* toggle drawing of the starts (only at night)
{ increase timeOffset by 5 minutes
} decrease timeOffset by 5 minutes
=======
Scoping
=======
A pfvmSkyDome module can be scoped globally, to a single view, or to a
single world.
NOTES
The source code for the pfvmSkyDome Module is not provided, but the
header file pfvSkyDome.h can be found in /usr/include/Performer/pfvm/
For examples of pfvViewer XML configuration files, look at the sample
SEE ALSO
pfEarthSky, pfvModule, pfvViewer, pfvXml
Page 7