Merge 'remotes/trunk'
[0ad.git] / source / renderer / InstancingModelRenderer.h
blob251729140c46e903c3047083cd34721ece3d8e29
1 /* Copyright (C) 2012 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
19 * Special ModelVertexRender that only works for non-animated models,
20 * but is very fast for instanced models.
23 #ifndef INCLUDED_INSTANCINGMODELRENDERER
24 #define INCLUDED_INSTANCINGMODELRENDERER
26 #include "renderer/ModelVertexRenderer.h"
28 struct InstancingModelRendererInternals;
30 /**
31 * Render non-animated (but potentially moving) models using a ShaderRenderModifier.
32 * This computes and binds per-vertex data; the modifier is responsible
33 * for setting any shader uniforms etc (including the instancing transform).
35 class InstancingModelRenderer : public ModelVertexRenderer
37 public:
38 InstancingModelRenderer(bool gpuSkinning, bool calculateTangents);
39 ~InstancingModelRenderer();
41 // Implementations
42 CModelRData* CreateModelData(const void* key, CModel* model);
43 void UpdateModelData(CModel* model, CModelRData* data, int updateflags);
45 void BeginPass(int streamflags);
46 void EndPass(int streamflags);
47 void PrepareModelDef(const CShaderProgramPtr& shader, int streamflags, const CModelDef& def);
48 void RenderModel(const CShaderProgramPtr& shader, int streamflags, CModel* model, CModelRData* data);
50 protected:
51 InstancingModelRendererInternals* m;
54 #endif // INCLUDED_INSTANCINGMODELRENDERER