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

Mesh Class Reference

Encapsulates a mesh of .X format. Adds helper functions for easier scaling, moving, texturing. More...

#include <Mesh.h>

List of all members.

Public Member Functions

 Mesh (LPCWSTR fileName, LPCWSTR texFileName, float preferredDiameter, D3DXVECTOR3 position)
 ~Mesh ()
 Destructor. Deletes dynamically created resources.
void Load (LPCWSTR fileName)
 LOADS THE SPECIFIED .X FILE Eliminates mesh offset (centers the mesh to the origin) and determines mesh size (originalSize, originalDiameter).
void Move (D3DXVECTOR3 offset, bool bContainerOnly=false)
HRESULT Draw ()
 Draws the mesh. Before drawing, use GetMeshScale() to get the appropriate scaling factor.
D3DXVECTOR3 GetMeshSize ()
 current mesh size
float GetMeshScale ()
 current mesh scale
D3DXVECTOR3 GetMeshPosition ()
 current mesh position
IDirect3DTexture9 * GetTexture ()
 mesh texture
void SetContainerSize (D3DXVECTOR3 size)
 Sets the size of the encapsulating room.
void SetMeshPosition (D3DXVECTOR3 pos)
 Sets mesh position.
void SetPreferredDiameter (float d)
 Sets preferred mesh size (diameter).

Protected Member Functions

HRESULT CalculateMeshSize ()
 Calculates mesh size and updates originalSize and originalDiameter.

Private Attributes

ID3DXMesh * pMesh
 THE .X MESH OBJECT.
IDirect3DTexture9 * pMeshTexture
DWORD numMaterials
D3DXVECTOR3 originalSize
float originalDiameter
float preferredDiameter
D3DXVECTOR3 containerSize
HRESULT hr
D3DXVECTOR3 position


Detailed Description

Encapsulates a mesh of .X format. Adds helper functions for easier scaling, moving, texturing.

See also:
OptimizedMesh DirectX SDK Sample


Constructor & Destructor Documentation

Mesh::Mesh LPCWSTR  fileName,
LPCWSTR  texFileName,
float  preferredDiameter,
D3DXVECTOR3  position
 

Loads the specified .X file

Parameters:
fileName name of the mesh file
texFileName name of the texture file
preferredDiameter final size of the mesh
position initial position of the mesh. During rendering, use GetMeshScale() to get the appropriate scaling factor to achieve the preferred mesh size.

Mesh::~Mesh  ) 
 

Destructor. Deletes dynamically created resources.


Member Function Documentation

HRESULT Mesh::CalculateMeshSize  )  [protected]
 

Calculates mesh size and updates originalSize and originalDiameter.

HRESULT Mesh::Draw  ) 
 

Draws the mesh. Before drawing, use GetMeshScale() to get the appropriate scaling factor.

D3DXVECTOR3 Mesh::GetMeshPosition  )  [inline]
 

current mesh position

float Mesh::GetMeshScale  )  [inline]
 

current mesh scale

D3DXVECTOR3 Mesh::GetMeshSize  )  [inline]
 

current mesh size

IDirect3DTexture9* Mesh::GetTexture  )  [inline]
 

mesh texture

void Mesh::Load LPCWSTR  fileName  ) 
 

LOADS THE SPECIFIED .X FILE Eliminates mesh offset (centers the mesh to the origin) and determines mesh size (originalSize, originalDiameter).

void Mesh::Move D3DXVECTOR3  offset,
bool  bContainerOnly = false
 

Adds the specified offset to the mesh position.

Parameters:
bContainerOnly indicates whether the object can leave the room

void Mesh::SetContainerSize D3DXVECTOR3  size  )  [inline]
 

Sets the size of the encapsulating room.

void Mesh::SetMeshPosition D3DXVECTOR3  pos  )  [inline]
 

Sets mesh position.

void Mesh::SetPreferredDiameter float  d  )  [inline]
 

Sets preferred mesh size (diameter).


Member Data Documentation

D3DXVECTOR3 Mesh::containerSize [private]
 

HRESULT Mesh::hr [private]
 

DWORD Mesh::numMaterials [private]
 

float Mesh::originalDiameter [private]
 

D3DXVECTOR3 Mesh::originalSize [private]
 

ID3DXMesh* Mesh::pMesh [private]
 

THE .X MESH OBJECT.

IDirect3DTexture9* Mesh::pMeshTexture [private]
 

D3DXVECTOR3 Mesh::position [private]
 

float Mesh::preferredDiameter [private]
 


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