Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::SkyBackground Class Reference
[Backgrounds]

Background clearing class using a sky sphere and box. See Sky Background for a description. More...

#include <OSGSkyBackground.h>

Inheritance diagram for osg::SkyBackground:

osg::SkyBackgroundBase osg::Background osg::BackgroundBase osg::AttachmentContainer osg::FieldContainer List of all members.

Public Types

typedef SkyBackgroundPtr Ptr
enum  {
  SkyColorFieldId = Inherited::NextFieldId, SkyAngleFieldId = SkyColorFieldId + 1, GroundColorFieldId = SkyAngleFieldId + 1, GroundAngleFieldId = GroundColorFieldId + 1,
  SphereResFieldId = GroundAngleFieldId + 1, BackTextureFieldId = SphereResFieldId + 1, BottomTextureFieldId = BackTextureFieldId + 1, FrontTextureFieldId = BottomTextureFieldId + 1,
  LeftTextureFieldId = FrontTextureFieldId + 1, RightTextureFieldId = LeftTextureFieldId + 1, TopTextureFieldId = RightTextureFieldId + 1, BoxInsideFieldId = TopTextureFieldId + 1,
  TopTexCoordFieldId = BoxInsideFieldId + 1, BottomTexCoordFieldId = TopTexCoordFieldId + 1, RightTexCoordFieldId = BottomTexCoordFieldId + 1, LeftTexCoordFieldId = RightTexCoordFieldId + 1,
  FrontTexCoordFieldId = LeftTexCoordFieldId + 1, BackTexCoordFieldId = FrontTexCoordFieldId + 1, NextFieldId = BackTexCoordFieldId + 1
}

Public Member Functions

Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Background
*virtual void clear (DrawActionBase *action, Viewport *port)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*MFColor4fgetMFSkyColor (void)
 Get the SkyBackground::_mfSkyColor field.
MFReal32getMFSkyAngle (void)
 Get the SkyBackground::_mfSkyAngle field.
MFColor4fgetMFGroundColor (void)
 Get the SkyBackground::_mfGroundColor field.
MFReal32getMFGroundAngle (void)
 Get the SkyBackground::_mfGroundAngle field.
SFUInt32getSFSphereRes (void)
 Get the SkyBackground::_sfSphereRes field.
SFTextureChunkPtrgetSFBackTexture (void)
 Get the SkyBackground::_sfBackTexture field.
SFTextureChunkPtrgetSFBottomTexture (void)
 Get the SkyBackground::_sfBottomTexture field.
SFTextureChunkPtrgetSFFrontTexture (void)
 Get the SkyBackground::_sfFrontTexture field.
SFTextureChunkPtrgetSFLeftTexture (void)
 Get the SkyBackground::_sfLeftTexture field.
SFTextureChunkPtrgetSFRightTexture (void)
 Get the SkyBackground::_sfRightTexture field.
SFTextureChunkPtrgetSFTopTexture (void)
 Get the SkyBackground::_sfTopTexture field.
SFBoolgetSFBoxInside (void)
 Get the SkyBackground::_sfBoxInside field.
MFVec3fgetMFTopTexCoord (void)
 Get the SkyBackground::_mfTopTexCoord field.
MFVec3fgetMFBottomTexCoord (void)
 Get the SkyBackground::_mfBottomTexCoord field.
MFVec3fgetMFRightTexCoord (void)
 Get the SkyBackground::_mfRightTexCoord field.
MFVec3fgetMFLeftTexCoord (void)
 Get the SkyBackground::_mfLeftTexCoord field.
MFVec3fgetMFFrontTexCoord (void)
 Get the SkyBackground::_mfFrontTexCoord field.
MFVec3fgetMFBackTexCoord (void)
 Get the SkyBackground::_mfBackTexCoord field.
UInt32getSphereRes (void)
 Get the value of the SkyBackground::_sfSphereRes field.
const UInt32getSphereRes (void) const
 Get the value of the SkyBackground::_sfSphereRes field.
TextureChunkPtrgetBackTexture (void)
 Get the value of the SkyBackground::_sfBackTexture field.
const TextureChunkPtrgetBackTexture (void) const
 Get the value of the SkyBackground::_sfBackTexture field.
TextureChunkPtrgetBottomTexture (void)
 Get the value of the SkyBackground::_sfBottomTexture field.
const TextureChunkPtrgetBottomTexture (void) const
 Get the value of the SkyBackground::_sfBottomTexture field.
TextureChunkPtrgetFrontTexture (void)
 Get the value of the SkyBackground::_sfFrontTexture field.
const TextureChunkPtrgetFrontTexture (void) const
 Get the value of the SkyBackground::_sfFrontTexture field.
TextureChunkPtrgetLeftTexture (void)
 Get the value of the SkyBackground::_sfLeftTexture field.
const TextureChunkPtrgetLeftTexture (void) const
 Get the value of the SkyBackground::_sfLeftTexture field.
TextureChunkPtrgetRightTexture (void)
 Get the value of the SkyBackground::_sfRightTexture field.
const TextureChunkPtrgetRightTexture (void) const
 Get the value of the SkyBackground::_sfRightTexture field.
TextureChunkPtrgetTopTexture (void)
 Get the value of the SkyBackground::_sfTopTexture field.
const TextureChunkPtrgetTopTexture (void) const
 Get the value of the SkyBackground::_sfTopTexture field.
bool & getBoxInside (void)
 Get the value of the SkyBackground::_sfBoxInside field.
const bool & getBoxInside (void) const
 Get the value of the SkyBackground::_sfBoxInside field.
Color4fgetSkyColor (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfSkyColor field.
MFColor4fgetSkyColor (void)
 Get the SkyBackground::_mfSkyColor field.
const MFColor4fgetSkyColor (void) const
 Get the SkyBackground::_mfSkyColor field.
Real32getSkyAngle (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfSkyAngle field.
MFReal32getSkyAngle (void)
 Get the SkyBackground::_mfSkyAngle field.
const MFReal32getSkyAngle (void) const
 Get the SkyBackground::_mfSkyAngle field.
Color4fgetGroundColor (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfGroundColor field.
MFColor4fgetGroundColor (void)
 Get the SkyBackground::_mfGroundColor field.
const MFColor4fgetGroundColor (void) const
 Get the SkyBackground::_mfGroundColor field.
Real32getGroundAngle (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfGroundAngle field.
MFReal32getGroundAngle (void)
 Get the SkyBackground::_mfGroundAngle field.
const MFReal32getGroundAngle (void) const
 Get the SkyBackground::_mfGroundAngle field.
Vec3fgetTopTexCoord (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfTopTexCoord field.
MFVec3fgetTopTexCoord (void)
 Get the SkyBackground::_mfTopTexCoord field.
const MFVec3fgetTopTexCoord (void) const
 Get the SkyBackground::_mfTopTexCoord field.
Vec3fgetBottomTexCoord (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfBottomTexCoord field.
MFVec3fgetBottomTexCoord (void)
 Get the SkyBackground::_mfBottomTexCoord field.
const MFVec3fgetBottomTexCoord (void) const
 Get the SkyBackground::_mfBottomTexCoord field.
Vec3fgetRightTexCoord (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfRightTexCoord field.
MFVec3fgetRightTexCoord (void)
 Get the SkyBackground::_mfRightTexCoord field.
const MFVec3fgetRightTexCoord (void) const
 Get the SkyBackground::_mfRightTexCoord field.
Vec3fgetLeftTexCoord (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfLeftTexCoord field.
MFVec3fgetLeftTexCoord (void)
 Get the SkyBackground::_mfLeftTexCoord field.
const MFVec3fgetLeftTexCoord (void) const
 Get the SkyBackground::_mfLeftTexCoord field.
Vec3fgetFrontTexCoord (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfFrontTexCoord field.
MFVec3fgetFrontTexCoord (void)
 Get the SkyBackground::_mfFrontTexCoord field.
const MFVec3fgetFrontTexCoord (void) const
 Get the SkyBackground::_mfFrontTexCoord field.
Vec3fgetBackTexCoord (const UInt32 index)
 Get the value of the index element the SkyBackground::_mfBackTexCoord field.
MFVec3fgetBackTexCoord (void)
 Get the SkyBackground::_mfBackTexCoord field.
const MFVec3fgetBackTexCoord (void) const
 Get the SkyBackground::_mfBackTexCoord field.
Field Set
*void setSphereRes (const UInt32 &value)
 Set the value of the SkyBackground::_sfSphereRes field.
void setBackTexture (const TextureChunkPtr &value)
 Set the value of the SkyBackground::_sfBackTexture field.
void setBottomTexture (const TextureChunkPtr &value)
 Set the value of the SkyBackground::_sfBottomTexture field.
void setFrontTexture (const TextureChunkPtr &value)
 Set the value of the SkyBackground::_sfFrontTexture field.
void setLeftTexture (const TextureChunkPtr &value)
 Set the value of the SkyBackground::_sfLeftTexture field.
void setRightTexture (const TextureChunkPtr &value)
 Set the value of the SkyBackground::_sfRightTexture field.
void setTopTexture (const TextureChunkPtr &value)
 Set the value of the SkyBackground::_sfTopTexture field.
void setBoxInside (const bool &value)
 Set the value of the SkyBackground::_sfBoxInside field.
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const

Static Public Member Functions

Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static SkyBackgroundPtr create (void)
 create a new instance of the class
static SkyBackgroundPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype
Class Get
*static const Char8getClassname (void)

Static Public Attributes

static const osg::BitVector SkyColorFieldMask
static const osg::BitVector SkyAngleFieldMask
static const osg::BitVector GroundColorFieldMask
static const osg::BitVector GroundAngleFieldMask
static const osg::BitVector SphereResFieldMask
static const osg::BitVector BackTextureFieldMask
static const osg::BitVector BottomTextureFieldMask
static const osg::BitVector FrontTextureFieldMask
static const osg::BitVector LeftTextureFieldMask
static const osg::BitVector RightTextureFieldMask
static const osg::BitVector TopTextureFieldMask
static const osg::BitVector BoxInsideFieldMask
static const osg::BitVector TopTexCoordFieldMask
static const osg::BitVector BottomTexCoordFieldMask
static const osg::BitVector RightTexCoordFieldMask
static const osg::BitVector LeftTexCoordFieldMask
static const osg::BitVector FrontTexCoordFieldMask
static const osg::BitVector BackTexCoordFieldMask
static const osg::BitVector MTInfluenceMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask

Protected Member Functions

Constructors
SkyBackground (void)
 SkyBackground (const SkyBackground &source)
Destructors
*virtual ~SkyBackground (void)
Draw Helper
*void drawFace (DrawActionBase *action, TextureChunkPtr tex, StateChunk *&oldtex, const Pnt3f &p1, const Pnt3f &p2, const Pnt3f &p3, const Pnt3f &p4, const Vec3f *texCoord)
Sync
*void executeSyncImpl (SkyBackgroundBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)

Protected Attributes

Fields
*MFColor4f _mfSkyColor
MFReal32 _mfSkyAngle
MFColor4f _mfGroundColor
MFReal32 _mfGroundAngle
SFUInt32 _sfSphereRes
SFTextureChunkPtr _sfBackTexture
SFTextureChunkPtr _sfBottomTexture
SFTextureChunkPtr _sfFrontTexture
SFTextureChunkPtr _sfLeftTexture
SFTextureChunkPtr _sfRightTexture
SFTextureChunkPtr _sfTopTexture
SFBool _sfBoxInside
MFVec3f _mfTopTexCoord
MFVec3f _mfBottomTexCoord
MFVec3f _mfRightTexCoord
MFVec3f _mfLeftTexCoord
MFVec3f _mfFrontTexCoord
MFVec3f _mfBackTexCoord

Private Types

typedef SkyBackgroundBase Inherited

Private Member Functions

void operator= (const SkyBackground &source)

Static Private Member Functions

static void initMethod (void)

Friends

class FieldContainer
class SkyBackgroundBase

Detailed Description

A Sky/Ground/Skybox background, inspired by VRML, see Sky Background for a description.

The sky is defined by the _mfSkyAngle and _mfSkyColor fields, the ground by the _mfGroundAngle and _mfGround Color fields. The resolution of the sky sphere can be influenced by the _sfSphereRes field. The sky box is defined by the _sfBackTexture, _sfFrontTexture, _sfLeftTexture, _sfRightTexture, _sfTopTexture and _sfBottomTexture fields.

Definition at line 58 of file OSGSkyBackground.h.


Member Typedef Documentation

typedef SkyBackgroundBase osg::SkyBackground::Inherited [private]
 

Reimplemented from osg::SkyBackgroundBase.

Definition at line 62 of file OSGSkyBackground.h.

typedef SkyBackgroundPtr osg::SkyBackgroundBase::Ptr [inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 107 of file OSGSkyBackgroundBase.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
SkyColorFieldId 
SkyAngleFieldId 
GroundColorFieldId 
GroundAngleFieldId 
SphereResFieldId 
BackTextureFieldId 
BottomTextureFieldId 
FrontTextureFieldId 
LeftTextureFieldId 
RightTextureFieldId 
TopTextureFieldId 
BoxInsideFieldId 
TopTexCoordFieldId 
BottomTexCoordFieldId 
RightTexCoordFieldId 
LeftTexCoordFieldId 
FrontTexCoordFieldId 
BackTexCoordFieldId 
NextFieldId 

Reimplemented from osg::AttachmentContainer.

Definition at line 109 of file OSGSkyBackgroundBase.h.

00110     {
00111         SkyColorFieldId       = Inherited::NextFieldId,
00112         SkyAngleFieldId       = SkyColorFieldId       + 1,
00113         GroundColorFieldId    = SkyAngleFieldId       + 1,
00114         GroundAngleFieldId    = GroundColorFieldId    + 1,
00115         SphereResFieldId      = GroundAngleFieldId    + 1,
00116         BackTextureFieldId    = SphereResFieldId      + 1,
00117         BottomTextureFieldId  = BackTextureFieldId    + 1,
00118         FrontTextureFieldId   = BottomTextureFieldId  + 1,
00119         LeftTextureFieldId    = FrontTextureFieldId   + 1,
00120         RightTextureFieldId   = LeftTextureFieldId    + 1,
00121         TopTextureFieldId     = RightTextureFieldId   + 1,
00122         BoxInsideFieldId      = TopTextureFieldId     + 1,
00123         TopTexCoordFieldId    = BoxInsideFieldId      + 1,
00124         BottomTexCoordFieldId = TopTexCoordFieldId    + 1,
00125         RightTexCoordFieldId  = BottomTexCoordFieldId + 1,
00126         LeftTexCoordFieldId   = RightTexCoordFieldId  + 1,
00127         FrontTexCoordFieldId  = LeftTexCoordFieldId   + 1,
00128         BackTexCoordFieldId   = FrontTexCoordFieldId  + 1,
00129         NextFieldId           = BackTexCoordFieldId   + 1
00130     };


Constructor & Destructor Documentation

SkyBackground::SkyBackground void   )  [protected]
 

Definition at line 80 of file OSGSkyBackground.cpp.

00080                                  :
00081     Inherited()
00082 {
00083 }

SkyBackground::SkyBackground const SkyBackground source  )  [protected]
 

Definition at line 85 of file OSGSkyBackground.cpp.

00085                                                         :
00086     Inherited(source)
00087 {
00088 }

SkyBackground::~SkyBackground void   )  [protected, virtual]
 

Definition at line 90 of file OSGSkyBackground.cpp.

00091 {
00092 }


Member Function Documentation

void SkyBackground::changed BitVector  whichField,
UInt32  origin
[virtual]
 

Reimplemented from osg::Background.

Definition at line 100 of file OSGSkyBackground.cpp.

References osg::Background::changed().

00101 {
00102     Inherited::changed(whichField, origin);
00103 }

void SkyBackground::clear DrawActionBase action,
Viewport port
[virtual]
 

Implements osg::Background.

Definition at line 164 of file OSGSkyBackground.cpp.

References osg::SkyBackgroundBase::_mfGroundAngle, osg::SkyBackgroundBase::_mfGroundColor, osg::SkyBackgroundBase::_mfSkyAngle, osg::SkyBackgroundBase::_mfSkyColor, osg::SkyBackgroundBase::_sfSphereRes, osg::StateChunk::deactivate(), drawFace(), osg::Eps, osg::SkyBackgroundBase::getBackTexCoord(), osg::SkyBackgroundBase::getBackTexture(), osg::SkyBackgroundBase::getBottomTexCoord(), osg::SkyBackgroundBase::getBottomTexture(), osg::DrawActionBase::getCamera(), osg::CameraBase::getFar(), osg::SkyBackgroundBase::getFrontTexCoord(), osg::SkyBackgroundBase::getFrontTexture(), osg::SkyBackgroundBase::getLeftTexCoord(), osg::SkyBackgroundBase::getLeftTexture(), osg::CameraBase::getNear(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::Camera::getProjection(), osg::Camera::getProjectionTranslation(), osg::SkyBackgroundBase::getRightTexCoord(), osg::SkyBackgroundBase::getRightTexture(), osg::SkyBackgroundBase::getTopTexCoord(), osg::SkyBackgroundBase::getTopTexture(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::Color4< ValueTypeT >::getValuesRGBA(), osg::Camera::getViewing(), GLboolean, osg::TransformationMatrix< ValueTypeT >::multLeft(), osg::osgabs(), osg::osgcos(), osg::osgsin(), osg::Pi, osg::MField< FieldTypeT, fieldNameSpace >::size(), and tfac.

00165 {
00166     GLboolean light = glIsEnabled(GL_LIGHTING);
00167 
00168     if (light == GL_TRUE)  
00169         glDisable(GL_LIGHTING);
00170 
00171     GLint fill[2];
00172     glGetIntegerv(GL_POLYGON_MODE, fill);
00173     glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
00174 
00175     GLint depth;
00176     glGetIntegerv(GL_DEPTH_FUNC, &depth);
00177     glDepthFunc(GL_ALWAYS);
00178 
00179     glMatrixMode(GL_MODELVIEW);
00180     glPushMatrix();
00181 
00182     Matrix m,pt;
00183     action->getCamera()->getViewing(m, viewport->getPixelWidth(),
00184                                         viewport->getPixelHeight());
00185     action->getCamera()->getProjectionTranslation(pt, 
00186                                         viewport->getPixelWidth(),
00187                                         viewport->getPixelHeight());
00188     m.multLeft(pt);
00189     
00190     m[3][0] = m[3][1] = m[3][2] = 0;
00191     glLoadMatrixf(m.getValues());         
00192     Real32 viewscale = (m[0].length() + m[1].length() + m[2].length()) / 3.f;
00193     float scale = (action->getCamera()->getFar() + 
00194                     action->getCamera()->getNear()) / 2 / viewscale;
00195     glScalef(scale, scale, scale);
00196 
00197     glMatrixMode(GL_PROJECTION);
00198     glPushMatrix();
00199 
00200     action->getCamera()->getProjection(m, viewport->getPixelWidth(),
00201                                            viewport->getPixelHeight());
00202     glLoadMatrixf(m.getValues());         
00203     
00204     UInt32 i, j;
00205     UInt32 sr = _sfSphereRes.getValue() + 1;      // sphere resolution
00206     
00207     // These should be stored somewhere, not recalced.
00208     Real32 *cosval = new Real32 [ sr ];
00209     Real32 *sinval = new Real32 [ sr ];
00210     
00211     Real32  vcos1,vsin1,vcos2,vsin2;
00212     
00213     Real32 da = 2 * Pi / (sr - 1);    
00214     for(i = 0; i < sr; ++i)
00215     {
00216         cosval[i] = osgcos(i * da);
00217         sinval[i] = osgsin(i * da);     
00218     }
00219     
00220     if(_mfSkyAngle.size() > 0)
00221     {
00222         vcos1 = osgcos(_mfSkyAngle[0]);
00223         vsin1 = osgsin(_mfSkyAngle[0]);
00224 
00225         glBegin(GL_TRIANGLE_FAN);
00226         glColor4fv((GLfloat*) _mfSkyColor[0].getValuesRGBA());
00227         glVertex3f(0, 1, 0);
00228         glColor4fv((GLfloat*) _mfSkyColor[1].getValuesRGBA());
00229 
00230         for(i = 0; i < sr; ++i)
00231         {
00232             glVertex3f(vsin1 * sinval[i], vcos1, vsin1 * cosval[i]);
00233         }
00234 
00235         glEnd();
00236 
00237 
00238         for(j = 0; j < _mfSkyAngle.size() - 1; ++j)
00239         {
00240             Color4f c1, c2;
00241 
00242             c1 = _mfSkyColor[j+1];
00243             c2 = _mfSkyColor[j+2];
00244 
00245             vcos1 = osgcos(_mfSkyAngle[j  ]);
00246             vsin1 = osgsin(_mfSkyAngle[j  ]);
00247             vcos2 = osgcos(_mfSkyAngle[j+1]);
00248             vsin2 = osgsin(_mfSkyAngle[j+1]);
00249 
00250             glBegin(GL_TRIANGLE_STRIP);
00251 
00252             for(i = 0; i < sr; ++i)
00253             {
00254                 glColor4fv((GLfloat*) c1.getValuesRGBA());
00255                 glVertex3f(vsin1 * sinval[i], vcos1, vsin1 * cosval[i]);
00256                 glColor4fv((GLfloat*) c2.getValuesRGBA());
00257                 glVertex3f(vsin2 * sinval[i], vcos2, vsin2 * cosval[i]);
00258             }
00259             glEnd();
00260         }
00261 
00262         if(osgabs(_mfSkyAngle[j] - Pi) > Eps)
00263         {
00264             glBegin(GL_TRIANGLE_FAN);
00265             glColor4fv((GLfloat*) _mfSkyColor[j+1].getValuesRGBA());
00266             glVertex3f(0, -1, 0);
00267             vcos1 = osgcos(_mfSkyAngle[j]);
00268             vsin1 = osgsin(_mfSkyAngle[j]);
00269 
00270             for(i = 0; i < sr; ++i)
00271             {
00272                 glVertex3f(vsin1 * sinval[i], vcos1, vsin1 * cosval[i]);
00273             }
00274 
00275             glEnd();
00276         }
00277     }
00278     else // no angles, just fill single color
00279     {
00280         if(_mfSkyColor.size() > 0)
00281         {
00282             glClearColor(_mfSkyColor[0][0], _mfSkyColor[0][1], 
00283                          _mfSkyColor[0][2], 0);
00284         }
00285         else
00286         {
00287             glClearColor(0, 0, 0, 0);
00288         }
00289         glClear(GL_COLOR_BUFFER_BIT);
00290     }
00291     
00292     // Draw the ground.
00293     // It's possible to be smarter about this, but for now just overdraw.
00294 
00295     if(_mfGroundAngle.size() > 0)
00296     {    
00297         vcos1 = -osgcos(_mfGroundAngle[0]);
00298         vsin1 =  osgsin(_mfGroundAngle[0]);
00299 
00300         glBegin(GL_TRIANGLE_FAN);
00301         glColor4fv((GLfloat*) _mfGroundColor[0].getValuesRGBA());
00302         glVertex3f(0, -1, 0);
00303         glColor4fv((GLfloat*) _mfGroundColor[1].getValuesRGBA());
00304 
00305         for(i = 0; i < sr; ++i)
00306         {
00307             glVertex3f(vsin1 * sinval[i], vcos1, vsin1 * cosval[i]);
00308         }
00309 
00310         glEnd();
00311 
00312 
00313         for(j = 0; j < _mfGroundAngle.size() - 1; ++j)
00314         {
00315             Color4f c1, c2;
00316 
00317             c1 = _mfGroundColor[j+1];
00318             c2 = _mfGroundColor[j+2];
00319 
00320             vcos1 = -osgcos(_mfGroundAngle[j  ]);
00321             vsin1 =  osgsin(_mfGroundAngle[j  ]);
00322             vcos2 = -osgcos(_mfGroundAngle[j+1]);
00323             vsin2 =  osgsin(_mfGroundAngle[j+1]);
00324 
00325             glBegin(GL_TRIANGLE_STRIP);
00326 
00327             for(i = 0; i < sr; ++i)
00328             {
00329                 glColor4fv((GLfloat*) c1.getValuesRGBA());
00330                 glVertex3f(vsin1 * sinval[i], vcos1, vsin1 * cosval[i]);
00331                 glColor4fv((GLfloat*) c2.getValuesRGBA());
00332                 glVertex3f(vsin2 * sinval[i], vcos2, vsin2 * cosval[i]);
00333             }
00334             glEnd();
00335         }
00336     }
00337     
00338     // now draw the textures, if set
00339     StateChunk *tchunk = NULL;
00340     static Vec3f defaulttc[7][4] = {
00341      // 2D default TCs
00342      { Vec3f(0,0,0), Vec3f(1,0,0), Vec3f(1,1,0), Vec3f(0,1,0) },
00343      
00344      // Cubetex Default TCs
00345      { Vec3f(-1, 1,-1), Vec3f( 1, 1,-1), Vec3f( 1,-1,-1), Vec3f(-1,-1,-1) },
00346      { Vec3f( 1, 1, 1), Vec3f(-1, 1, 1), Vec3f(-1,-1, 1), Vec3f( 1,-1, 1) },
00347      { Vec3f( 1, 1,-1), Vec3f(-1, 1,-1), Vec3f(-1, 1, 1), Vec3f( 1, 1, 1) },       
00348      { Vec3f( 1,-1, 1), Vec3f(-1,-1, 1), Vec3f(-1,-1,-1), Vec3f( 1,-1,-1) },
00349      { Vec3f( 1, 1,-1), Vec3f( 1, 1, 1), Vec3f( 1,-1, 1), Vec3f( 1,-1,-1) },        
00350      { Vec3f(-1, 1, 1), Vec3f(-1, 1,-1), Vec3f(-1,-1,-1), Vec3f(-1,-1, 1) },
00351      };
00352     
00353     #undef tfac
00354     #define tfac(t,c)  \
00355         defaulttc[(c)*((t) != NullFC && (t)->getImage() != NullFC && \
00356                   (t)->getImage()->getSideCount() == 6)]
00357      
00358     drawFace(action, getBackTexture(),   tchunk,
00359                                          Pnt3f(0.5, -0.5,  0.5),
00360                                          Pnt3f(-0.5, -0.5,  0.5),
00361                                          Pnt3f(-0.5,  0.5,  0.5),
00362                                          Pnt3f(0.5,  0.5,  0.5),
00363                                          getBackTexCoord().size()?
00364                                          &getBackTexCoord()[0]:
00365                                           tfac(getBackTexture(), 1));
00366     
00367     drawFace(action, getFrontTexture(),  tchunk,
00368                                          Pnt3f(-0.5, -0.5, -0.5),
00369                                          Pnt3f(0.5, -0.5, -0.5),
00370                                          Pnt3f(0.5,  0.5, -0.5),
00371                                          Pnt3f(-0.5,  0.5, -0.5),
00372                                          getFrontTexCoord().size()?
00373                                          &getFrontTexCoord()[0]:
00374                                           tfac(getFrontTexture(), 2));
00375     
00376     drawFace(action, getBottomTexture(), tchunk,
00377                                          Pnt3f(-0.5, -0.5,  0.5),
00378                                          Pnt3f(0.5, -0.5,  0.5),
00379                                          Pnt3f(0.5, -0.5, -0.5),
00380                                          Pnt3f(-0.5, -0.5, -0.5),
00381                                          getBottomTexCoord().size()?
00382                                          &getBottomTexCoord()[0]:
00383                                           tfac(getBottomTexture(), 3));
00384     
00385     drawFace(action, getTopTexture(),    tchunk,
00386                                          Pnt3f(-0.5,  0.5, -0.5),
00387                                          Pnt3f(0.5,  0.5, -0.5),
00388                                          Pnt3f(0.5,  0.5,  0.5),
00389                                          Pnt3f(-0.5,  0.5,  0.5),
00390                                          getTopTexCoord().size()?
00391                                          &getTopTexCoord()[0]:
00392                                           tfac(getTopTexture(), 4));
00393     
00394     drawFace(action, getLeftTexture(),   tchunk,
00395                                          Pnt3f(-0.5, -0.5,  0.5),
00396                                          Pnt3f(-0.5, -0.5, -0.5),
00397                                          Pnt3f(-0.5,  0.5, -0.5),
00398                                          Pnt3f(-0.5,  0.5,  0.5),
00399                                          getLeftTexCoord().size()?
00400                                          &getLeftTexCoord()[0]:
00401                                           tfac(getLeftTexture(), 5));
00402     
00403     drawFace(action, getRightTexture(),  tchunk,
00404                                          Pnt3f(0.5, -0.5, -0.5),
00405                                          Pnt3f(0.5, -0.5,  0.5),
00406                                          Pnt3f(0.5,  0.5,  0.5),
00407                                          Pnt3f(0.5,  0.5, -0.5),
00408                                          getRightTexCoord().size()?
00409                                          &getRightTexCoord()[0]:
00410                                           tfac(getRightTexture(), 6));  
00411     #undef tfac
00412     
00413     if(tchunk != NULL)
00414         tchunk->deactivate(action);
00415     
00416     glClear(GL_DEPTH_BUFFER_BIT);
00417 
00418     glPopMatrix();
00419     glMatrixMode(GL_MODELVIEW);
00420     glPopMatrix();
00421 
00422     glDepthFunc(depth);
00423     glPolygonMode(GL_FRONT, fill[0]);
00424     glPolygonMode(GL_BACK , fill[1]);
00425     if (light == GL_TRUE)  
00426         glEnable(GL_LIGHTING);
00427     glColor3f(1.0, 1.0, 1.0);
00428 
00429     delete [] sinval;
00430     delete [] cosval;
00431 }