Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Sky Class Reference

A background cube with an appropriately warped texture to make it look like an infinite environment. More...

#include <Sky.h>

Inherits G3D::ReferenceCountedObject.

List of all members.

Public Member Functions

Texture::Ref getEnvironmentMap () const
void ReferenceCountedObject_zeroWeakPointers ()
void render (RenderDevice *renderDevice, const class SkyParameters &lighting)
void renderLensFlare (RenderDevice *renderDevice, const class SkyParameters &lighting)
virtual ~Sky ()

Static Public Member Functions

static SkyRef fromCubeMap (Texture::Ref _cubeMap, const std::string &directory, bool _drawCelestialBodies=true, double quality=1.0)
static SkyRef fromFile (const std::string &directory, const std::string filename[6], bool drawCelestialBodies=true, double quality=1.0, int scaleDownFactor=1)
static SkyRef fromFile (const std::string &directory, const std::string &filename="plainsky/null_plainsky512_*.jpg", bool drawCelestialBodies=true, double quality=1.0, int scaleDownFactor=1)

Public Attributes

AtomicInt32 ReferenceCountedObject_refCount
_WeakPtrLinkedListReferenceCountedObject_weakPointer


Detailed Description

A background cube with an appropriately warped texture to make it look like an infinite environment.

The sky also manages drawing the sun and moon, with lens flare effects for the sun.

Copy the images from data/sky to your project directory to use this class or provide your own.

If you already have a preloaded CubeMap texture, use Sky::fromCubeMap.

Example:

Showing the default filename mask for clarity
    SkyRef sky = Sky::fromFile(renderDevice, "data/sky/", "plainsky/null_plainsky512_*.jpg");
    SkyParameters lighting(toSeconds(9, 00, 00, AM));

    ...

Rendering loop
        sky->render(lighting);

Draw the rest of the scene
        ...

        sky->renderLensFlare(lighting);
        ...
  


Constructor & Destructor Documentation

virtual G3D::Sky::~Sky (  )  [virtual]


Member Function Documentation

static SkyRef G3D::Sky::fromCubeMap ( Texture::Ref  _cubeMap,
const std::string &  directory,
bool  _drawCelestialBodies = true,
double  quality = 1.0 
) [static]

Parameters:
_cubeMap This must be a Texture of dimension - DIM_CUBE_MAP.

static SkyRef G3D::Sky::fromFile ( const std::string &  directory,
const std::string  filename[6],
bool  drawCelestialBodies = true,
double  quality = 1.0,
int  scaleDownFactor = 1 
) [static]

static SkyRef G3D::Sky::fromFile ( const std::string &  directory,
const std::string &  filename = "plainsky/null_plainsky512_*.jpg",
bool  drawCelestialBodies = true,
double  quality = 1.0,
int  scaleDownFactor = 1 
) [static]

Parameters:
directory If directory is not "" it should end in a trailing slash.

This is the location of the real.str file and the sun, moon, etc. files.

Parameters:
filename A filename with "*" in place of {up, lt, rt, bk, ft, dn}. The filename can be either fully qualified, relative to the current directory, or relative to directory.
drawCelestialBodies If true, draw the sun, moon, and stars. Requires moon.jpg, moon-alpha.jpg, sun.jpg, lensflare.jpg, sun-rays.jpg be present in given directory. Defaults to true.
quality Trade image quality for texture memory: .5 -> 1/4 the texture memory of 1.0, 0 -> 1/8 the texture memory of 1.0. Color banding will occur at low quality settings, but rendering performance may increase.
scaleDownFactor Resize the texture resolution by 1 / scaleDownFactor in each dimension. Should be a power of two. Useful for creating a skybox that occupies less memory on low-end cards.

Texture::Ref G3D::Sky::getEnvironmentMap (  )  const [inline]

Returns an environment cube map (or the front 2D texture if cube maps are not supported on this machine).

void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers (  )  [inline, inherited]

Automatically called immediately before the object is deleted.

This is not called from the destructor because it needs to be invoked before the subclass destructor.

void G3D::Sky::render ( RenderDevice renderDevice,
const class SkyParameters lighting 
)

Call at the very beginning of your rendering routine.

Will restore all state it changes.

void G3D::Sky::renderLensFlare ( RenderDevice renderDevice,
const class SkyParameters lighting 
)

Call at the very end of your rendering routine.

Will restore all state it changes.


Member Data Documentation

The long name is to keep this from accidentally conflicting with a subclass's variable name.

Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.

Linked list of all weak pointers that reference this (some may be on the stack!).

Do not use or explicitly manipulate this value.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo