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

EnvMap Class Reference

#include <EnvMap.h>

List of all members.

Public Member Functions

 EnvMap ()
void InvalidateCubeMap ()
void InvalidateShininess ()
D3DXVECTOR3 & GetReferencePos ()
void ChooseMesh (int whichMesh)
void KeyboardProc (UINT nChar, bool bKeyDown, bool bAltDown)
void DoRendering (D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
void DrawCenterObjects (D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
void DrawEnvObjects (D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
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 ()
 Generates precomputed texture to store values for the reflectivity integral. Uses the eval() function.
void GenerateCosTextureIfNotFound ()
 Calls GenerateCosTexture() if the specified texture is not yet calculated and stored as a texture in the cos subdirectory.
float eval (float cos_theta, float dw)
 Calculates the reflectivity integral for a given texel.
void OnFrameRender (IDirect3DDevice9 *pd3dDevice, D3DXMATRIXA16 &mView, D3DXMATRIXA16 &mProj)
void OnCreateDevice (IDirect3DDevice9 *pd3dDevice, ID3DXEffect *g_pEffect)
void OnDestroyDevice ()
void OnResetDevice ()
void OnLostDevice ()
void InitFullScreenQuad ()
void DrawFullScreenQuad ()
void ReduceCubeMapSize (IDirect3DCubeTexture9 *pSourceCube, IDirect3DCubeTexture9 *pDestCube)
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

CModelViewerCamera * camera
IDirect3DVertexBuffer9 * pVertexBuffer

Private Attributes

IDirect3DDevice9 * pd3dDevice
IDirect3DTexture9 * pRoomTexture
IDirect3DCubeTexture9 * pCubeTexture
IDirect3DCubeTexture9 * pCubeTextureFromFile
IDirect3DCubeTexture9 * pCubeTextureSmall
IDirect3DCubeTexture9 * pCubeTexturePreConvolved
IDirect3DTexture9 * pCosValuesTexture
ID3DXEffect * g_pEffect
HRESULT hr
bool bCubeMapIsValid
bool bShininessIsValid
Cubecube
Meshmesh
Meshmeshes [10]
int meshCount
int whichMesh
float roomSize
D3DXVECTOR3 reference_pos


Constructor & Destructor Documentation

EnvMap::EnvMap  )  [inline]
 


Member Function Documentation

void EnvMap::ChooseMesh int  whichMesh  ) 
 

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

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

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

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

void EnvMap::DrawFullScreenQuad  )  [inline]
 

float EnvMap::eval float  cos_theta,
float  dw
 

Calculates the reflectivity integral for a given texel.

The angle between the surface normal and texel center is described by cos_theta and the solid angle occupied by the texel is denoted by dw.

Instead of evaluating the reflectivity integral with only one sample belongig to the texel center (that would give us a result of cos_theta x dw), we use 2 M x 2 M x M regulary spaced samples, and discard those that lie outside the unit hemisphere. The remaining samples are regulary distributed over the hemisphere.

For each sample, we check if it lies inside the cone of the specified solid angle. If yes, its contribution is considered.

IDirect3DTexture9 * EnvMap::GenerateCosTexture  ) 
 

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

void EnvMap::GenerateCosTextureIfNotFound  ) 
 

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

D3DXVECTOR3& EnvMap::GetReferencePos  )  [inline]
 

void EnvMap::InitFullScreenQuad  )  [inline]
 

void EnvMap::InvalidateCubeMap  )  [inline]
 

void EnvMap::InvalidateShininess  )  [inline]
 

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

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

void EnvMap::OnDestroyDevice  ) 
 

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

void EnvMap::OnLostDevice  ) 
 

void EnvMap::OnResetDevice  ) 
 

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
 

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::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]
 

CModelViewerCamera* EnvMap::camera
 

Cube* EnvMap::cube [private]
 

ID3DXEffect* EnvMap::g_pEffect [private]
 

HRESULT EnvMap::hr [private]
 

Mesh* EnvMap::mesh [private]
 

int EnvMap::meshCount [private]
 

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

IDirect3DTexture9* EnvMap::pCosValuesTexture [private]
 

IDirect3DCubeTexture9* EnvMap::pCubeTexture [private]
 

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

IDirect3DCubeTexture9* EnvMap::pCubeTextureFromFile [private]
 

IDirect3DCubeTexture9* EnvMap::pCubeTexturePreConvolved [private]
 

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

IDirect3DCubeTexture9* EnvMap::pCubeTextureSmall [private]
 

IDirect3DDevice9* EnvMap::pd3dDevice [private]
 

IDirect3DTexture9* EnvMap::pRoomTexture [private]
 

IDirect3DVertexBuffer9* EnvMap::pVertexBuffer
 

D3DXVECTOR3 EnvMap::reference_pos [private]
 

float EnvMap::roomSize [private]
 

int EnvMap::whichMesh [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Apr 27 11:58:00 2006 for gyak by  doxygen 1.4.2