Main Page | Class List | File List | Class Members | File Members

EnvMap Class Reference

Most of application-specific logic is here. More...

#include <EnvMap.h>

List of all members.

Public Member Functions

 EnvMap ()
void SetCamera (CModelViewerCamera *camera)
void InvalidateCubeMap ()
void InvalidateShininess ()
void InvalidateResolution ()
D3DXVECTOR3 & GetReferencePos ()
void ChooseMesh (int whichMesh)
 Loads the specified mesh.
void SetMeshSize (float d)
void SetMeshPosition (D3DXVECTOR3 pos)
D3DXVECTOR3 GetMeshPosition ()
void KeyboardProc (UINT nChar, bool bKeyDown, bool bAltDown)
 Handles keystroke messages.
void DoRendering (D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
 Render the scene.
void DrawCenterObjects (D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
 Draw the central diffuse/glossy object.
void DrawEnvObjects (D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
 Draw environment objects.
void SetWorldViewProj (D3DXMATRIXA16 &mWorld, D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
 Uploads the specified world/view/projection transformation matrices to the GPU.
D3DXMATRIXA16 ScaleAndOffset (float fScale, D3DXVECTOR3 vOffset)
D3DXMATRIXA16 ScaleAndOffset (D3DXVECTOR3 vScale, D3DXVECTOR3 vOffset)
void RenderCubeMap (IDirect3DCubeTexture9 *pCubeTexture)
 Renders the environment into the specified cubemap.
IDirect3DTexture9 * GenerateCosTexture (eval_fn evaluator)
 Generates precomputed texture to store values for the reflectivity integral. Uses the eval() function.
void GenerateCosTextureIfNotFound (wchar_t *fileName, eval_fn evaluator)
 Calls GenerateCosTexture() if the specified texture is not yet calculated and stored as a texture in the cos subdirectory.
void OnFrameRender (IDirect3DDevice9 *pd3dDevice, D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
 Performs prepocessing steps if necessary and then renders the scene.
void OnCreateDevice (IDirect3DDevice9 *pd3dDevice, ID3DXEffect *g_pEffect)
 Called by OnCreateDevice() (Main.cpp) to perform app-specific tasks.
void OnDestroyDevice ()
 Called by OnDestroyDevice() (Main.cpp) to perform app-specific tasks.
void OnResetDevice ()
 Called by OnResetDevice() (Main.cpp) to perform app-specific tasks.
void OnLostDevice ()
 Called by OnLostDevice() (Main.cpp) to perform app-specific tasks.
void InitFullScreenQuad ()
void DrawFullScreenQuad ()
void ReduceCubeMapSize (IDirect3DCubeTexture9 *pSourceCube, IDirect3DCubeTexture9 *pDestCube)
 Downsample a cube map to resolution LR_CUBEMAP_SIZE.
void PreConvolve (IDirect3DCubeTexture9 *pSourceCube, IDirect3DCubeTexture9 *pDestCube)
 Calculates the irradiance map by convolution.
void SaveCubeMap (IDirect3DCubeTexture9 *pCubeTexture, char *FileNamePrefix, char *FileNameSuffix="")
IDirect3DCubeTexture9 * CreateCubeTexture (int size, D3DFORMAT Format)

Public Attributes

IDirect3DVertexBuffer9 * pVertexBuffer

Private Types

typedef float(* eval_fn )(float, float)
 Callback function to evaluate reflectivity integral. See GenerateCosTexture() and eval().

Private Attributes

IDirect3DDevice9 * pd3dDevice
 THE D3D DEVICE.
ID3DXEffect * g_pEffect
 THE EFFECT FILE.
CModelViewerCamera * camera
 Rotate/zoom camera, always looking to the origin.
HRESULT hr
IDirect3DCubeTexture9 * pCubeTexture
 Cubemap that stores the environment as seen from the reference point. See method RenderCubeMap().
IDirect3DCubeTexture9 * pCubeTextureSmall
 Low-resolution (downsampled) cubemap, derived from pCubeTexture. See ReduceCubeMapSize().
IDirect3DCubeTexture9 * pCubeTexturePreConvolved
 Low-resolution cubemap that stores preconvolved data for diffuse/specular environment mapping. See method PreConvolve().
IDirect3DTexture9 * pCosValuesTexture
 Helper texture with precomputed geometric factor values.
IDirect3DTexture9 * pRoomTexture
 Texture to be displayed on the walls of the cubic room.
bool bCubeMapIsValid
bool bShininessIsValid
 indicates that the cube map has to be re-generated
Cubecube
 indicates that the reflectivity integral has to be re-calculated
float roomSize
 Simple cube centralMesh for the room. See EnvMap::DrawEnvObjects().
MeshcentralMesh
 Size of the cubic room.
Meshmeshes [10]
 The diffuse/glossy object to be shaded.
int meshCount
 Objects of the environment (fireballs, etc.).
D3DXVECTOR3 reference_pos
 Number of objects in the environment.


Detailed Description

Most of application-specific logic is here.


Member Typedef Documentation

typedef float(* EnvMap::eval_fn)(float, float) [private]
 

Callback function to evaluate reflectivity integral. See GenerateCosTexture() and eval().


Constructor & Destructor Documentation

EnvMap::EnvMap  )  [inline]
 


Member Function Documentation

void EnvMap::ChooseMesh int  whichMesh  ) 
 

Loads the specified mesh.

IDirect3DCubeTexture9* EnvMap::CreateCubeTexture int  size,
D3DFORMAT  Format
[inline]
 

void EnvMap::DoRendering D3DXMATRIXA16 &  mView,
D3DXMATRIXA16 &  mProj
 

Render the scene.

void EnvMap::DrawCenterObjects D3DXMATRIXA16 &  mView,
D3DXMATRIXA16 &  mProj
 

Draw the central diffuse/glossy object.

void EnvMap::DrawEnvObjects D3DXMATRIXA16 &  mView,
D3DXMATRIXA16 &  mProj
 

Draw environment objects.

void EnvMap::DrawFullScreenQuad  )  [inline]
 

IDirect3DTexture9 * EnvMap::GenerateCosTexture eval_fn  evaluator  ) 
 

Generates precomputed texture to store values for the reflectivity integral. Uses the eval() function.

void EnvMap::GenerateCosTextureIfNotFound wchar_t *  fileName,
eval_fn  evaluator
 

Calls GenerateCosTexture() if the specified texture is not yet calculated and stored as a texture in the cos subdirectory.

D3DXVECTOR3 EnvMap::GetMeshPosition  )  [inline]
 

D3DXVECTOR3& EnvMap::GetReferencePos  )  [inline]
 

void EnvMap::InitFullScreenQuad  )  [inline]
 

void EnvMap::InvalidateCubeMap  )  [inline]
 

void EnvMap::InvalidateResolution  ) 
 

Called when the resolution of the cube maps is to change. To re-generate all resources, the DirectX device is simply reseted.

void EnvMap::InvalidateShininess  )  [inline]
 

void EnvMap::KeyboardProc UINT  nChar,
bool  bKeyDown,
bool  bAltDown
 

Handles keystroke messages.

void EnvMap::OnCreateDevice IDirect3DDevice9 *  pd3dDevice,
ID3DXEffect *  g_pEffect
 

Called by OnCreateDevice() (Main.cpp) to perform app-specific tasks.

void EnvMap::OnDestroyDevice  ) 
 

Called by OnDestroyDevice() (Main.cpp) to perform app-specific tasks.

void EnvMap::OnFrameRender IDirect3DDevice9 *  pd3dDevice,
D3DXMATRIXA16 &  mView,
D3DXMATRIXA16 &  mProj
 

Performs prepocessing steps if necessary and then renders the scene.

void EnvMap::OnLostDevice  ) 
 

Called by OnLostDevice() (Main.cpp) to perform app-specific tasks.

void EnvMap::OnResetDevice  ) 
 

Called by OnResetDevice() (Main.cpp) to perform app-specific tasks.

void EnvMap::PreConvolve IDirect3DCubeTexture9 *  pSourceCube,
IDirect3DCubeTexture9 *  pDestCube
 

Calculates the irradiance map by convolution.

Convolves data from the source cubemap and stores the result in the target cubemap. Uses ConvolutionPS().

void EnvMap::ReduceCubeMapSize IDirect3DCubeTexture9 *  pSourceCube,
IDirect3DCubeTexture9 *  pDestCube
 

Downsample a cube map to resolution LR_CUBEMAP_SIZE.

void EnvMap::RenderCubeMap IDirect3DCubeTexture9 *  pCubeTexture  ) 
 

Renders the environment into the specified cubemap.

The camera is placed into reference_pos. Uses technique IlluminatedScenePS() for rendering.

void EnvMap::SaveCubeMap IDirect3DCubeTexture9 *  pCubeTexture,
char *  FileNamePrefix,
char *  FileNameSuffix = ""
 

D3DXMATRIXA16 EnvMap::ScaleAndOffset D3DXVECTOR3  vScale,
D3DXVECTOR3  vOffset
 

Sets the given scaling and offset.

Returns:
The resulting world transformation matrix.

D3DXMATRIXA16 EnvMap::ScaleAndOffset float  fScale,
D3DXVECTOR3  vOffset
 

Sets the given uniform scaling and an offset.

Returns:
The resulting world transformation matrix.

void EnvMap::SetCamera CModelViewerCamera *  camera  )  [inline]
 

void EnvMap::SetMeshPosition D3DXVECTOR3  pos  )  [inline]
 

void EnvMap::SetMeshSize float  d  )  [inline]
 

void EnvMap::SetWorldViewProj D3DXMATRIXA16 &  mWorld,
D3DXMATRIXA16 &  mView,
D3DXMATRIXA16 &  mProj
 

Uploads the specified world/view/projection transformation matrices to the GPU.


Member Data Documentation

bool EnvMap::bCubeMapIsValid [private]
 

bool EnvMap::bShininessIsValid [private]
 

indicates that the cube map has to be re-generated

CModelViewerCamera* EnvMap::camera [private]
 

Rotate/zoom camera, always looking to the origin.

Mesh* EnvMap::centralMesh [private]
 

Size of the cubic room.

Cube* EnvMap::cube [private]
 

indicates that the reflectivity integral has to be re-calculated

ID3DXEffect* EnvMap::g_pEffect [private]
 

THE EFFECT FILE.

HRESULT EnvMap::hr [private]
 

int EnvMap::meshCount [private]
 

Objects of the environment (fireballs, etc.).

Mesh* EnvMap::meshes[10] [private]
 

The diffuse/glossy object to be shaded.

IDirect3DTexture9* EnvMap::pCosValuesTexture [private]
 

Helper texture with precomputed geometric factor values.

IDirect3DCubeTexture9* EnvMap::pCubeTexture [private]
 

Cubemap that stores the environment as seen from the reference point. See method RenderCubeMap().

IDirect3DCubeTexture9* EnvMap::pCubeTexturePreConvolved [private]
 

Low-resolution cubemap that stores preconvolved data for diffuse/specular environment mapping. See method PreConvolve().

IDirect3DCubeTexture9* EnvMap::pCubeTextureSmall [private]
 

Low-resolution (downsampled) cubemap, derived from pCubeTexture. See ReduceCubeMapSize().

IDirect3DDevice9* EnvMap::pd3dDevice [private]
 

THE D3D DEVICE.

IDirect3DTexture9* EnvMap::pRoomTexture [private]
 

Texture to be displayed on the walls of the cubic room.

IDirect3DVertexBuffer9* EnvMap::pVertexBuffer
 

D3DXVECTOR3 EnvMap::reference_pos [private]
 

Number of objects in the environment.

float EnvMap::roomSize [private]
 

Simple cube centralMesh for the room. See EnvMap::DrawEnvObjects().


The documentation for this class was generated from the following files:
Generated on Wed Aug 23 00:00:39 2006 for Indirect Environment Mapping by  doxygen 1.4.2