2012-04-03 20:44:46 +02:00
|
|
|
/* Copyright (C) 2012 Wildfire Games.
|
2009-04-18 19:00:33 +02:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-04-18 19:51:05 +02:00
|
|
|
/*
|
|
|
|
* ModelVertexRenderer that transforms models on the CPU but performs
|
|
|
|
* lighting in a vertex shader.
|
2005-10-25 03:43:07 +02:00
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_HWLIGHTINGMODELRENDERER
|
|
|
|
#define INCLUDED_HWLIGHTINGMODELRENDERER
|
2005-10-25 03:43:07 +02:00
|
|
|
|
2005-11-06 00:15:23 +01:00
|
|
|
#include "renderer/ModelVertexRenderer.h"
|
2005-10-25 03:43:07 +02:00
|
|
|
|
2011-04-07 00:02:05 +02:00
|
|
|
struct ShaderModelRendererInternals;
|
2005-10-25 03:43:07 +02:00
|
|
|
|
|
|
|
/**
|
2011-04-07 00:02:05 +02:00
|
|
|
* Render animated models using a ShaderRenderModifier.
|
2012-04-03 20:44:46 +02:00
|
|
|
* This computes and binds per-vertex data; the modifier is responsible
|
2011-04-07 00:02:05 +02:00
|
|
|
* for setting any shader uniforms etc.
|
2005-10-25 03:43:07 +02:00
|
|
|
*/
|
2012-04-03 20:44:46 +02:00
|
|
|
class ShaderModelVertexRenderer : public ModelVertexRenderer
|
2005-10-25 03:43:07 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-04-03 20:44:46 +02:00
|
|
|
ShaderModelVertexRenderer(bool cpuLighting);
|
|
|
|
~ShaderModelVertexRenderer();
|
2006-03-26 01:54:20 +01:00
|
|
|
|
2005-11-06 00:15:23 +01:00
|
|
|
// Implementations
|
2012-04-03 20:44:46 +02:00
|
|
|
CModelRData* CreateModelData(const void* key, CModel* model);
|
|
|
|
void UpdateModelData(CModel* model, CModelRData* data, int updateflags);
|
2006-03-26 01:54:20 +01:00
|
|
|
|
2011-04-07 00:09:58 +02:00
|
|
|
void BeginPass(int streamflags);
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
void EndPass(int streamflags);
|
2012-04-03 20:44:46 +02:00
|
|
|
void PrepareModelDef(const CShaderProgramPtr& shader, int streamflags, const CModelDef& def);
|
|
|
|
void RenderModel(const CShaderProgramPtr& shader, int streamflags, CModel* model, CModelRData* data);
|
2005-11-06 00:15:23 +01:00
|
|
|
|
2011-03-26 21:17:21 +01:00
|
|
|
protected:
|
2011-04-07 00:02:05 +02:00
|
|
|
ShaderModelRendererInternals* m;
|
2011-03-26 21:17:21 +01:00
|
|
|
};
|
|
|
|
|
2005-10-25 03:43:07 +02:00
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#endif // INCLUDED_HWLIGHTINGMODELRENDERER
|