AssimpRendererD3d::AssimpRenderer Class Reference

This class provides the main interface for importing, rendering, storing and saving ASSIMP assets using Direct3D. More...

#include <assimprenderer.h>

List of all members.

Public Member Functions

AssetHelperLoadAssetFromFile (aiString filename)
 Creates an AssetHelper object from a file that has been created using SaveAssetToFile().
int SaveAssetToFile (const AssetHelper &asset, aiString filename)
 Serializes the given AssetHelper to a file with the given filename.
LPDIRECT3DDEVICE9 CreateD3dDevice (LPDIRECT3D9 d3d, D3DPRESENT_PARAMETERS *d3dpp, const RenderOptions &renderOptions)
 Have the AssimpRenderer create your Direct3D Device object.
void RenderAsset (const AssetHelper &assetHelper, aiMatrix4x4 argMatrix)
 Renders an Asset.
void RenderAsset (const AssetHelper &assetHelper, const aiVector3D &vPos, const aiVector3D &vRot, const aiVector3D &vScale)
 Renders an Asset.
void SetCamera (const Camera &sourceCamera)
int AttachLogStream (Assimp::LogStream *logstr, unsigned int severity)
 Attaches a LogStream for receiving logging information from the AssimpRenderer.
int DetachLogStream (Assimp::LogStream *logstr, unsigned int severity)

Static Public Member Functions

static AssimpRendererInstance ()
static AssetHelperImportAsset (const char *pFile, unsigned int aiImportFlags)
 Imports the Asset file with the given filename.
static AssetHelperImportAsset (const char *pFile, unsigned int aiImportFlags, const D3DXMATRIX &matTransform)
 Imports the Asset file with the given filename.
static D3DXMATRIX CreateTransformMatrix (float rotX, float rotY, float rotZ, float scaleFactor)
 Creates a transformation matrix for rotating and scaling an Asset upon import.

Friends

class AssetHelper
class CMaterialManager
class CMeshRenderer


Detailed Description

This class provides the main interface for importing, rendering, storing and saving ASSIMP assets using Direct3D.

Member Function Documentation

int AssimpRendererD3d::AssimpRenderer::AttachLogStream ( Assimp::LogStream *  logstr,
unsigned int  severity 
)

Attaches a LogStream for receiving logging information from the AssimpRenderer.

Assimp comes with a DefaultLogger class for receiving debug information from the Assimp library. Party of this mechanism is the LogStream interface, where you can attach your own functionality for handling debug information. If you already implemented this interface, you can pass the same instance of your implementation to AssimpRenderer::AttachLogStream(), and have the debug info from AssimpRenderer handled the same way.

Parameters:
logstr your implementation of the LogStream interface that comes with Assimp
severity the known flags from Logger class ORed together: Logger::DEBUGGING, Logger::INFO, Logger::WARN, Logger::ERR;

LPDIRECT3DDEVICE9 AssimpRendererD3d::AssimpRenderer::CreateD3dDevice ( LPDIRECT3D9  d3d,
D3DPRESENT_PARAMETERS *  d3dpp,
const RenderOptions renderOptions 
)

Have the AssimpRenderer create your Direct3D Device object.

The AssimpRenderer Instance will use the this D3d Device for every rendering operation. In this version it's not yet possible to create the d3ddevice object somewhere else and have it passed to the AssimpRenderer. Therefore it's mandatory to call this method before you can use the AssimpRenderer.

Parameters:
d3d pointer to your IDirect3D9 Interface
d3dpp Direct3D Presentation parameters for the Direct3D Device to be created. The object will be altered within the call. Make sure to set the following values:
  1. d3dpp.BackBufferWidth and d3dpp.BackBufferHeight to match the desired screen or window size
    1. set d3dpp.hDeviceWindow to true to run in windowed mode
    2. set d3dpp.hDeviceWindow to your gamescreen's hWnd
gameWindow the structure containing the screen dimensions and a window handle
renderOptions the global rendering settings for all Assets
Returns:
pointer to the d3d device

D3DXMATRIX AssimpRendererD3d::AssimpRenderer::CreateTransformMatrix ( float  rotX,
float  rotY,
float  rotZ,
float  scaleFactor 
) [static]

Creates a transformation matrix for rotating and scaling an Asset upon import.

Sometimes it may be necessary to rotate an Asset to a certain direction to match your game logic. To do Pass the returned D3DXMATRIX to ImportAsset(), if you Method: CreateTransformMatrix FullName: AssimpRendererD3d::AssimpRenderer::CreateTransformMatrix Access: public Returns: D3DXMATRIX Qualifier:

Parameters:
rotX rotate each vertex by this angle (degree)
rotY rotate each vertex by this angle (degree)
rotZ rotate each vertex by this angle (degree)
scaleFactor,: have each vertex multiplied by this value to scale the Asset.
Returns:
the transformation matrix to be passed to ImportAsset()

AssetHelper * AssimpRendererD3d::AssimpRenderer::ImportAsset ( const char *  pFile,
unsigned int  aiProcessFlags,
const D3DXMATRIX &  matTransform 
) [static]

Imports the Asset file with the given filename.

This method creates a new AssetHelper object and returns a pointer to it. The caller is responsible to release the object.

Parameters:
pFile 
aiProcessFlags - aiProcess flags ORed together. Please have a look at the Assimp documentation for the list of aiProcess flags.
matTransform - pass a transformation matrix to have each vertex transformed upon import. Use AssimpRenderer::CreateTransformationMatrix() for this.
Returns:
pointer to an AssetHelper

AssetHelper * AssimpRendererD3d::AssimpRenderer::ImportAsset ( const char *  pFile,
unsigned int  aiProcessFlags 
) [static]

Imports the Asset file with the given filename.

This method creates a new AssetHelper object and returns a pointer to it. The caller is responsible to release the object. //

Parameters:
pFile 
aiProcessFlags - aiProcess flags ORed together. Please have a look at the Assimp documentation for the list of aiProcess flags.
Returns:
pointer to an AssetHelper

AssimpRenderer * AssimpRendererD3d::AssimpRenderer::Instance (  )  [static]

Returns the AssimpRenderer Instance (Singleton)

AssetHelper * AssimpRendererD3d::AssimpRenderer::LoadAssetFromFile ( aiString  filename  ) 

Creates an AssetHelper object from a file that has been created using SaveAssetToFile().

Parameters:
filename path of the file to load
Returns:
a pointer to the newly created AssetHelper object. The caller is responsible to release the object.

void AssimpRendererD3d::AssimpRenderer::RenderAsset ( const AssetHelper assetHelper,
const aiVector3D &  vPos,
const aiVector3D &  vRot,
const aiVector3D &  vScale 
)

Renders an Asset.

This method signature provides aiVector parameters for rendering the Asset at the given position, with a given rotation and scaling.

Parameters:
vPos the position
vRot the rotation in degrees
vScale the scaling factors for each axis

void AssimpRendererD3d::AssimpRenderer::RenderAsset ( const AssetHelper assetHelper,
aiMatrix4x4  matTranspose 
)

Renders an Asset.

This method renders an Asset using the given transpose matrix.

Parameters:
matTranspose a matrix containing the scale, translation and rotation values for transposing the asset to world coordinates.

int AssimpRendererD3d::AssimpRenderer::SaveAssetToFile ( const AssetHelper asset,
aiString  filename 
)

Serializes the given AssetHelper to a file with the given filename.

Parameters:
asset the asset to store
aiString path of the file to create / replace
Returns:
0 if successful

void AssimpRendererD3d::AssimpRenderer::SetCamera ( const Camera sourceCamera  ) 

Sets the AssimpRenderer's position of the Camera.


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

Generated on Sat May 30 19:20:35 2009 for AssimpRenderer by  doxygen 1.5.9