dtCore::SkyBox Class Reference

A six-sided textured cube to represent distant scenery. More...

#include <skybox.h>

Inheritance diagram for dtCore::SkyBox:

dtCore::EnvEffect dtCore::DeltaDrawable dtCore::Base

List of all members.

Public Types

enum  RenderProfileEnum {
  RP_FIXED_FUNCTION = 0, RP_CUBE_MAP, RP_ANGULAR_MAP, RP_DEFAULT,
  RP_COUNT
}
 This selects the render method for the SkyBox RP_DEFAULT will use a cubemap if you can support it otherwise it will use the old technique with a textured cube the angular map will only work with angular textures as those used with hdr, they are called light probes http://www.debevec.org/Probes/. More...
enum  SkyBoxSideEnum {
  SKYBOX_FRONT = 0, SKYBOX_RIGHT, SKYBOX_BACK, SKYBOX_LEFT,
  SKYBOX_TOP, SKYBOX_BOTTOM
}
 SkyBoxSideEnum selects the side of the cube to texture if RenderProfileEnum is set to RP_ANGULAR_MAP, this is irrelevant and ignores the side. More...

Public Member Functions

 SkyBox (const std::string &name="SkyBox", RenderProfileEnum pRenderProfile=RP_DEFAULT)
virtual void Repaint (const osg::Vec3 &skyColor, const osg::Vec3 &fogColor, double sunAngle, double sunAzimuth, double visibility)
 Must override this to supply the repainting routine.
void SetTexture (SkyBoxSideEnum side, const std::string &filename)
 Set the texture for this side of the skybox.

Protected Member Functions

virtual ~SkyBox ()
virtual void Config ()
virtual void CheckHardware ()
virtual void SetRenderProfile (RenderProfileEnum pRenderProfile)

Protected Attributes

RenderProfileEnum mRenderProfilePreference
bool mSupportedProfiles [RP_COUNT]
dtCore::RefPtr< RenderProfilemRenderProfile
bool mInitializedTextures
std::string mTexList [6]
bool mTexPreSetList [6]
dtCore::RefPtr< osg::Geode > mTempGeode

Friends

class ConfigCallback

Classes

class  AngularMapProfile
 this class will use an angular map or light probe to act as a skybox More...
class  ConfigCallback
class  CubeMapProfile
 this class will use a 2D ortho quad and lookup into a cubemap to find the texture value More...
class  FixedFunctionProfile
 this render profile will render the skybox as usual with the fixed function pipeline More...
class  RenderProfile
 a base class to allow the user to choose different ways to render the same scene More...
class  SkyBoxDrawable
 this is a custom drawable for the AngularMapProfile and the CubeMapProfile More...


Detailed Description

A six-sided textured cube to represent distant scenery.

The SkyBox is an Environmental Effect that is very useful in certain applications. Essentially, its a large 6-sided cube with the Camera centered in the middle. Each side of the cube has a texture applied to it representing far away scenery (sky, clouds, buildings, hills, etc.). To use this class, create an instance of it, pass in the texture filenames using SetTextureFilename(), then add it to a Environment using Environment::AddEffect(). The terms "front", "right", etc. map to compass headings. For example, front is north, right is east, top is up.

The resolution of the textures should be based on the screen resolution and the field of view ( texRes = screenRes / tan(fov/2) ) for a texel per pixel correlation.

   SkyBox *box = new SkyBox("skyBox");
   box->SetTexture( SkyBox::SKYBOX_FRONT, "front.bmp");
   box->SetTexture( SkyBox::SKYBOX_BACK, "back.bmp");
   ...
   Environment *env = new Environment("myEnv");
   env->AddEffect( box );

Typically, this would be the only environmental effect added to the Environment. Adding fog, sun, and clouds typically make things look a little weird.


Member Enumeration Documentation

enum dtCore::SkyBox::RenderProfileEnum

This selects the render method for the SkyBox RP_DEFAULT will use a cubemap if you can support it otherwise it will use the old technique with a textured cube the angular map will only work with angular textures as those used with hdr, they are called light probes http://www.debevec.org/Probes/.

Enumerator:
RP_FIXED_FUNCTION 
RP_CUBE_MAP 
RP_ANGULAR_MAP 
RP_DEFAULT 
RP_COUNT 

enum dtCore::SkyBox::SkyBoxSideEnum

SkyBoxSideEnum selects the side of the cube to texture if RenderProfileEnum is set to RP_ANGULAR_MAP, this is irrelevant and ignores the side.

Enumerator:
SKYBOX_FRONT 
SKYBOX_RIGHT 
SKYBOX_BACK 
SKYBOX_LEFT 
SKYBOX_TOP 
SKYBOX_BOTTOM 


Constructor & Destructor Documentation

SkyBox::SkyBox ( const std::string &  name = "SkyBox",
RenderProfileEnum  pRenderProfile = RP_DEFAULT 
)

SkyBox::~SkyBox (  )  [protected, virtual]


Member Function Documentation

void SkyBox::Repaint ( const osg::Vec3 &  skyColor,
const osg::Vec3 &  fogColor,
double  sunAngle,
double  sunAzimuth,
double  visibility 
) [virtual]

Must override this to supply the repainting routine.

Implements dtCore::EnvEffect.

void SkyBox::SetTexture ( SkyBoxSideEnum  side,
const std::string &  filename 
)

Set the texture for this side of the skybox.

void SkyBox::Config (  )  [protected, virtual]

void SkyBox::CheckHardware (  )  [protected, virtual]

void SkyBox::SetRenderProfile ( RenderProfileEnum  pRenderProfile  )  [protected, virtual]


Friends And Related Function Documentation

friend class ConfigCallback [friend]


Member Data Documentation

RenderProfileEnum dtCore::SkyBox::mRenderProfilePreference [protected]

bool dtCore::SkyBox::mSupportedProfiles[RP_COUNT] [protected]

dtCore::RefPtr<RenderProfile> dtCore::SkyBox::mRenderProfile [protected]

bool dtCore::SkyBox::mInitializedTextures [protected]

std::string dtCore::SkyBox::mTexList[6] [protected]

bool dtCore::SkyBox::mTexPreSetList[6] [protected]

dtCore::RefPtr<osg::Geode> dtCore::SkyBox::mTempGeode [protected]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008