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

Skybox Class Reference
[XEngineUtil Library]

List of all members.

Detailed Description

This class renders a skybox that remains relative to the camera with a given environment map. The passed in texture will have its addressing mode set to clamp-to-edge in the constructor, which should not be changed by the application afterwards or the skybox's edges will be visible.

The skybox will be rendered using a fixed-function shader program with the environment cube texture only. Additionally, the depth test and depth writes will be turned off when the skybox is being rendered. This is because it is assumed that the skybox will always surround the entire scene and there is nothing behind it. You can use this to your advantage by never clearing the color buffer explicitly every frame and rendering the skybox instead to effectively "clear" (or better set) the color buffer.


Public Member Functions

 Skybox (real edgeLength, const boost::shared_ptr< CubeTexture > &pEnvironmentMap)
 Constructs a new skybox that uses the given environment map.
boost::shared_ptr< RenderContextGetRenderContext () const
 Returns the render context used by this skybox.
void Render (const Vector3 &cameraWorldPosition)
 Renders this skybox.
real GetEdgeLength () const
 Returns the edge length of this skybox.
const boost::shared_ptr< CubeTexture > & GetEnvironmentMap () const
 Returns the environment map used by this skybox.


Constructor & Destructor Documentation

Skybox real  edgeLength,
const boost::shared_ptr< CubeTexture > &  pEnvironmentMap
 

Constructs a new skybox that uses the given environment map.


Member Function Documentation

real GetEdgeLength  )  const
 

Returns the edge length of this skybox.

const boost::shared_ptr< CubeTexture > & GetEnvironmentMap  )  const
 

Returns the environment map used by this skybox.

boost::shared_ptr< RenderContext > GetRenderContext  )  const
 

Returns the render context used by this skybox.

void Render const Vector3 cameraWorldPosition  ) 
 

Renders this skybox. Note that the skybox automatically centers itself on the given world position, which should be the world position of the currently used camera. Thus any translations in the world matrix are ignored and the skybox is instead translated so that its local origin coincides with the camera position. Orientations of the world matrix, however, are applied. Also note that the skybox is rendered with the depth test and depth writes turned off. The depth buffer state is restored to what it was before after the skybox has been rendered.


The documentation for this class was generated from the following files: