ProFX2Handle Class Reference

#include <ProFX2.h>

List of all members.

Public Types

typedef void(CALLBACK * ProgressCallbackFunc )(int progress, int progressMax)

Public Member Functions

PROFX2_EXPORT ProFX2Handle (const ProFX2Parameters &parameters)
PROFX2_EXPORT ~ProFX2Handle ()
PROFX2_EXPORT bool load (std::istream &textureSetStream)
PROFX2_EXPORT bool render (int frame=0)
PROFX2_EXPORT ProFX2Texture grabResult (unsigned int index=0)
PROFX2_EXPORT void resetResults ()
PROFX2_EXPORT unsigned int numberOfOutputs () const
PROFX2_EXPORT bool isValid () const
PROFX2_EXPORT const char * getErrorDesc () const
PROFX2_EXPORT ProFX2ErrorCodes getErrorCode () const
PROFX2_EXPORT void changeTarget (const ProFX2Texture &texture, unsigned int index=0)
PROFX2_EXPORT void changeSource (const ProFX2Texture &texture, bool ownership, unsigned int index=0)
PROFX2_EXPORT bool isTimeSensitive (unsigned int index=0)
PROFX2_EXPORT int getOutputIndexFromName (const std::string &tag)
PROFX2_EXPORT const std::string & getOutputNameFromIndex (unsigned int index=0)
PROFX2_EXPORT void switchOutput (unsigned int index, SwitchState switchOut)
PROFX2_EXPORT ProFX2Size getOutputSize (unsigned int index=0)
PROFX2_EXPORT void setProgressCallback (ProgressCallbackFunc callbackPtr)
PROFX2_EXPORT void releaseRessources ()

Static Public Member Functions

static PROFX2_EXPORT bool isCompatibleHardware ()


Detailed Description

The main PROFX2 API Handle. Renders PROFX2 texture sets.


Member Typedef Documentation

typedef void(CALLBACK * ProFX2Handle::ProgressCallbackFunc)(int progress, int progressMax)
 

Type of the progress callback function The first parameter 'progress' varies between 0 and 'progressMax'-1


Constructor & Destructor Documentation

PROFX2_EXPORT ProFX2Handle::ProFX2Handle const ProFX2Parameters parameters  ) 
 

PROFX2 Handle constructor.

Parameters:
parameters Reference to ProFX2Parameters.
Precondition:
d3dDevice must be valid.
Postcondition:
If 'isValid' returns TRUE, this handle is ready to use, otherwise 'getErrorDesc' and 'getErrorCode' return the current error.

PROFX2_EXPORT ProFX2Handle::~ProFX2Handle  ) 
 

PROFX2 Handle destructor Releases created buffers (except the output textures that were grabbed using 'grabResult').


Member Function Documentation

PROFX2_EXPORT void ProFX2Handle::changeSource const ProFX2Texture texture,
bool  ownership,
unsigned int  index = 0
 

Specify / change an input texture used during rendering of the texture set.

Parameters:
texture Texture to use as an input source.
ownership If this boolean is set, the handle receive the ownership of the texture, and has responsability to destroy it when unused.
index Index of the input texture to specify.
Note:
By default, the input is empty (solid black).

PROFX2_EXPORT void ProFX2Handle::changeTarget const ProFX2Texture texture,
unsigned int  index = 0
 

Specify an existing texture to use for storing the result corresponding to number 'index'.

Parameters:
texture Texture to use as an output target (Must be created with the D3DUSAGE_RENDERTARGET usage flag set).
index Index of the output texture to specify.
Precondition:
The texture must be created with the D3DUSAGE_RENDERTARGET usage flag set.
Note:
Using this function is not mandatory. If you don't specify a texture, one will be created during rendering.

PROFX2_EXPORT ProFX2ErrorCodes ProFX2Handle::getErrorCode  )  const
 

Accessor on current error code.

Returns:
Return the error code.

PROFX2_EXPORT const char* ProFX2Handle::getErrorDesc  )  const
 

Accessor on current error description.

Returns:
Returns a string that describe the current error, or 'OK' otherwise.

PROFX2_EXPORT int ProFX2Handle::getOutputIndexFromName const std::string &  tag  ) 
 

Return the index of the output corresponding to the name 'tag'

Parameters:
tag Name of the output texture (e.g. '6diffuse').
Returns:
The index of the output, or -1 if 'tag' is not found.
Precondition:
A PROFX2 texture set must have been previously loaded.
Note:
Each 'tag' of an output corresponds to one name (group+channel) entered in the MapZone editor. Use 'profx2console -l ...' to list the outputs of a ProFX2 texture set.

PROFX2_EXPORT const std::string& ProFX2Handle::getOutputNameFromIndex unsigned int  index = 0  ) 
 

Return the output 'tag' name corresponding to the index

Parameters:
index Index of the output texture (0 based).
Returns:
The output name
Precondition:
A PROFX2 texture set must have been previously loaded, and the index must be valid (< to 'numberOfOutputs').

PROFX2_EXPORT ProFX2Size ProFX2Handle::getOutputSize unsigned int  index = 0  ) 
 

Get the size of a specific output

Parameters:
index Index of the output texture (0 based).
Returns:
The size
Precondition:
A PROFX2 texture set must have been previously loaded, and the index must be valid (< to 'numberOfOutputs').

PROFX2_EXPORT ProFX2Texture ProFX2Handle::grabResult unsigned int  index = 0  ) 
 

Grab render texture result.

Parameters:
index Index of the result texture to retrieve (0 based). Default output has an index of 0.
Returns:
Returns the resulting texture, or a null texture if failed (invalid index, render failed).
Warning:
After this call, the ownership of the texture is transfered to the caller. Don't forget to destroy it when you don't need it anymore.
Precondition:
The index must be valid (< to 'numberOfOutputs'), and rendering must succeed.
Note:
This function is only necessary for retrieving resulting textures generated during rendering, not for resulting textures specified by 'changeTarget'.

static PROFX2_EXPORT bool ProFX2Handle::isCompatibleHardware  )  [static]
 

Static function that tests if the current hardware support GPU-powered ProFX2 texture generation. If no compatible hardware is found, computations are automaticaly ran on the CPU: it can be MUCH slower!

Note:
On some platforms (XBox360...), this function returns always true.
Returns:
Returns true if the current hardware support ProFX2 texture generation via GPU.

PROFX2_EXPORT bool ProFX2Handle::isTimeSensitive unsigned int  index = 0  ) 
 

Ask for output texture time sensitivity

Parameters:
index Index of the required output texture (0 based).
Returns:
Returns TRUE if the output is time sensitive.
Precondition:
A PROFX2 texture set must be previously loaded, and the index must be valid (< to 'numberOfOutputs').

PROFX2_EXPORT bool ProFX2Handle::isValid  )  const
 

Return TRUE if current handle is valid.

Returns:
Current handle validity.

PROFX2_EXPORT bool ProFX2Handle::load std::istream &  textureSetStream  ) 
 

PROFX2 Texture set loading from stream (ASCII Format).

Parameters:
textureSetStream Input stream that contains the PROFX2 texture set.
Returns:
Returns TRUE if the loading / parsing process succeeds.
Postcondition:
If loading succeeds, this handle is ready to render, otherwise 'getErrorDesc' and 'getErrorCode' contain the current error.

PROFX2_EXPORT unsigned int ProFX2Handle::numberOfOutputs  )  const
 

Return the number of outputs defined by the current texture set.

Precondition:
A PROFX2 texture set must be previously loaded.
Returns:
Returns the number of outputs, or 0 if the current texture set is invalid.

PROFX2_EXPORT void ProFX2Handle::releaseRessources  ) 
 

Free memory and D3D objects This function can be used for deleting intermediate objects before releasing the handle. Please note that it is not mandatory to call this function. Ressources are released at handle destruction time.

PROFX2_EXPORT bool ProFX2Handle::render int  frame = 0  ) 
 

Render current texture set.

Parameters:
frame Frame to render.
Returns:
Returns TRUE if the rendering process succeeds.
Precondition:
A PROFX2 texture set must be previously loaded.
Postcondition:
If failed, 'getErrorDesc' and 'getErrorCode' contains the current error.

PROFX2_EXPORT void ProFX2Handle::resetResults  ) 
 

Reset ALL render texture result. During this call, texture without ownership (No grabbed) are deleted.

PROFX2_EXPORT void ProFX2Handle::setProgressCallback ProgressCallbackFunc  callbackPtr  ) 
 

Progress callback function definition

Parameters:
callbackPtr Pointer to the user callback function. This callback is called between each atomic computation: D3D states / Render target can be modified by the callback. It is necessary to restore the D3D states that were initialized before the initial call to ProFX2. For a 10s worth of texture rendering, it can be called ~1000 times without a noticeable perfomance hit.

PROFX2_EXPORT void ProFX2Handle::switchOutput unsigned int  index,
SwitchState  switchOut
 

Enable/Disable a specific output

Parameters:
index Index of the output texture to Enable/Disable (0 based).
switchOut Action to perform
Precondition:
A PROFX2 texture set must have been previously loaded, and the index must be valid (< to 'numberOfOutputs').


The documentation for this class was generated from the following file:
Generated on Mon Apr 24 13:41:59 2006 for ProFX2 by  doxygen 1.4.6-NO