0ad/source/renderer/PlayerRenderer.h
prefect e2bbd9a654 #Models receive shadows now, including self-shadows.
This is a huge patch, including:
* add a LitRenderModifier abstract base class for RenderModifiers with
  shadow+light
* add LitRenderModifiers for all types of models
* add STREAM_TEXGENTOUV1 to request generation of shadow map texcoords
  for models
* create facilities to pass the texture matrix from the
  RenderModifier (fragment stage) to the ModelRenderer (vertex stage)
* split ambient and diffuse terms of lighting until further down in the
  pipeline; this is necessary since shadowed regions receive only
ambient light
* small improvement in how RenderPathVertexShader scales to a greater
  number of vertex shaders

This was SVN commit r3690.
2006-03-26 00:54:20 +00:00

94 lines
2.6 KiB
C++

/**
* =========================================================================
* File : PlayerRenderer
* Project : Pyrogenesis
* Description : RenderModifier for player color rendering, to be used
* : with e.g. FixedFunctionModelRenderer
*
* @author John M. Mena <JohnMMena@hotmail.com>
* @author Nicolai Hähnle <nicolai@wildfiregames.com>
* =========================================================================
*/
#ifndef __PLAYERRENDERER_H
#define __PLAYERRENDERER_H
#include "RenderModifiers.h"
/**
* Class FastPlayerColorRender: Render models fully textured and lit
* plus player color in a single pass using multi-texturing (at least 3 TMUs
* required).
*/
class FastPlayerColorRender : public RenderModifier
{
public:
FastPlayerColorRender();
~FastPlayerColorRender();
// Implementation
u32 BeginPass(uint pass);
bool EndPass(uint pass);
void PrepareTexture(uint pass, CTexture* texture);
void PrepareModel(uint pass, CModel* model);
/**
* IsAvailable: Determines whether this RenderModifier can be used
* given the OpenGL implementation specific limits.
*
* @note Do not attempt to construct a FastPlayerColorRender object
* when IsAvailable returns false.
*
* @return true if the OpenGL implementation can support this
* RenderModifier.
*/
static bool IsAvailable();
};
/**
* Class SlowPlayerColorRender: Render models fully textured and lit
* plus player color using multi-pass.
*
* It has the same visual result as FastPlayerColorRender (except for
* potential precision issues due to the multi-passing).
*/
class SlowPlayerColorRender : public RenderModifier
{
public:
SlowPlayerColorRender();
~SlowPlayerColorRender();
// Implementation
u32 BeginPass(uint pass);
bool EndPass(uint pass);
void PrepareTexture(uint pass, CTexture* texture);
void PrepareModel(uint pass, CModel* model);
};
/**
* Class LitPlayerColorRender: Render models fully textured and lit including shadows
* and player color.
*
* @note Only use a LitPlayerColorRenderer instance when depth texture based shadows
* are supported by the OpenGL implementation (as verified by CRenderer::m_Caps::m_DepthTextureShadows).
*/
class LitPlayerColorRender : public LitRenderModifier
{
public:
LitPlayerColorRender();
~LitPlayerColorRender();
// Implementation
u32 BeginPass(uint pass);
bool EndPass(uint pass);
const CMatrix3D* GetTexGenMatrix(uint pass);
void PrepareTexture(uint pass, CTexture* texture);
void PrepareModel(uint pass, CModel* model);
};
#endif