2005-10-30 02:22:22 +02:00
|
|
|
/**
|
|
|
|
* =========================================================================
|
|
|
|
* File : InstancingModelRenderer.h
|
|
|
|
* Project : Pyrogenesis
|
2005-11-06 00:15:23 +01:00
|
|
|
* Description : Special ModelVertexRender that only works for non-animated
|
|
|
|
* : models, but is very fast for instanced models.
|
2005-10-30 02:22:22 +02:00
|
|
|
*
|
2006-07-26 16:04:52 +02:00
|
|
|
* @author Nicolai Haehnle <nicolai@wildfiregames.com>
|
2005-10-30 02:22:22 +02:00
|
|
|
* =========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSTANCINGMODELRENDERER_H
|
|
|
|
#define INSTANCINGMODELRENDERER_H
|
|
|
|
|
2005-11-06 00:15:23 +01:00
|
|
|
#include "renderer/ModelVertexRenderer.h"
|
2005-10-30 02:22:22 +02:00
|
|
|
|
|
|
|
struct InstancingModelRendererInternals;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class InstancingModelRenderer: Render non-animated (but potentially
|
2005-11-06 00:15:23 +01:00
|
|
|
* moving models) using vertex shaders and minimal state changes.
|
2006-03-26 01:54:20 +01:00
|
|
|
*
|
2005-10-30 02:22:22 +02:00
|
|
|
* @note You should verify hardware capabilities using IsAvailable
|
|
|
|
* before creating this model renderer.
|
|
|
|
*/
|
2005-11-06 00:15:23 +01:00
|
|
|
class InstancingModelRenderer : public ModelVertexRenderer
|
2005-10-30 02:22:22 +02:00
|
|
|
{
|
|
|
|
public:
|
2006-03-26 01:54:20 +01:00
|
|
|
/**
|
|
|
|
* InstancingModelRenderer: Constructor.
|
|
|
|
*
|
|
|
|
* @param colorIsDiffuseOnly if true, the primary color sent to the fragment stage
|
|
|
|
* contains only the diffuse term, and not the ambient
|
|
|
|
*/
|
|
|
|
InstancingModelRenderer(bool colorIsDiffuseOnly);
|
2005-10-30 02:22:22 +02:00
|
|
|
~InstancingModelRenderer();
|
2006-03-26 01:54:20 +01:00
|
|
|
|
2005-11-06 00:15:23 +01:00
|
|
|
// Implementations
|
|
|
|
void* CreateModelData(CModel* model);
|
|
|
|
void UpdateModelData(CModel* model, void* data, u32 updateflags);
|
|
|
|
void DestroyModelData(CModel* model, void* data);
|
2006-03-26 01:54:20 +01:00
|
|
|
|
|
|
|
void BeginPass(uint streamflags, const CMatrix3D* texturematrix);
|
2005-11-06 00:15:23 +01:00
|
|
|
void EndPass(uint streamflags);
|
|
|
|
void PrepareModelDef(uint streamflags, CModelDefPtr def);
|
|
|
|
void RenderModel(uint streamflags, CModel* model, void* data);
|
2006-03-26 01:54:20 +01:00
|
|
|
|
2005-10-30 02:22:22 +02:00
|
|
|
/**
|
|
|
|
* IsAvailable: Determines whether this model renderer can be used
|
|
|
|
* given the OpenGL implementation specific limits.
|
2006-03-26 01:54:20 +01:00
|
|
|
*
|
2005-10-30 02:22:22 +02:00
|
|
|
* @note Do not attempt to construct a InstancingModelRenderer object
|
|
|
|
* when IsAvailable returns false.
|
2006-03-26 01:54:20 +01:00
|
|
|
*
|
2005-10-30 02:22:22 +02:00
|
|
|
* @return true if the OpenGL implementation can support this
|
|
|
|
* model renderer.
|
|
|
|
*/
|
|
|
|
static bool IsAvailable();
|
|
|
|
|
|
|
|
private:
|
|
|
|
InstancingModelRendererInternals* m;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // INSTANCINGMODELRENDERER_H
|