2022-02-18 18:33:12 +01:00
|
|
|
/* Copyright (C) 2022 Wildfire Games.
|
2023-07-27 22:54:46 +02:00
|
|
|
* This file is part of 0 A.D.
|
2009-04-18 19:00:33 +02:00
|
|
|
*
|
2023-07-27 22:54:46 +02:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2009-04-18 19:00:33 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2023-07-27 22:54:46 +02:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2009-04-18 19:00:33 +02:00
|
|
|
* 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
|
2023-07-27 22:54:46 +02:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2009-04-18 19:00:33 +02:00
|
|
|
*/
|
|
|
|
|
2009-04-18 19:51:05 +02:00
|
|
|
/*
|
|
|
|
* Special ModelVertexRender that only works for non-animated models,
|
|
|
|
* but is very fast for instanced models.
|
2005-10-30 02:22:22 +02:00
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_INSTANCINGMODELRENDERER
|
|
|
|
#define INCLUDED_INSTANCINGMODELRENDERER
|
2005-10-30 02:22:22 +02:00
|
|
|
|
2005-11-06 00:15:23 +01:00
|
|
|
#include "renderer/ModelVertexRenderer.h"
|
2005-10-30 02:22:22 +02:00
|
|
|
|
|
|
|
struct InstancingModelRendererInternals;
|
|
|
|
|
|
|
|
/**
|
2011-04-07 00:02:05 +02:00
|
|
|
* Render non-animated (but potentially moving) 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 (including the instancing transform).
|
2005-10-30 02:22:22 +02:00
|
|
|
*/
|
2005-11-06 00:15:23 +01:00
|
|
|
class InstancingModelRenderer : public ModelVertexRenderer
|
2005-10-30 02:22:22 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-08-06 21:10:47 +02:00
|
|
|
InstancingModelRenderer(bool gpuSkinning, bool calculateTangents);
|
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
|
2022-05-02 22:57:22 +02:00
|
|
|
CModelRData* CreateModelData(const void* key, CModel* model) override;
|
|
|
|
void UpdateModelData(CModel* model, CModelRData* data, int updateflags) override;
|
2006-03-26 01:54:20 +01:00
|
|
|
|
2022-10-30 01:20:04 +02:00
|
|
|
void UploadModelData(
|
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
|
|
|
CModel* model, CModelRData* data) override;
|
2022-02-18 18:33:12 +01:00
|
|
|
void PrepareModelDef(
|
2022-05-09 00:02:46 +02:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2022-05-02 22:57:22 +02:00
|
|
|
const CModelDef& def) override;
|
2022-05-09 00:02:46 +02:00
|
|
|
void RenderModel(Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2022-05-02 22:57:22 +02:00
|
|
|
Renderer::Backend::IShaderProgram* shader, CModel* model, CModelRData* data) override;
|
2006-03-26 01:54:20 +01:00
|
|
|
|
2011-03-26 21:17:21 +01:00
|
|
|
protected:
|
2005-10-30 02:22:22 +02:00
|
|
|
InstancingModelRendererInternals* m;
|
|
|
|
};
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#endif // INCLUDED_INSTANCINGMODELRENDERER
|