2026-08-04 14:06:10 -07:00
|
|
|
/* Copyright (C) 2026 Wildfire Games.
|
2023-12-02 16:30:12 -08:00
|
|
|
* This file is part of 0 A.D.
|
2009-04-18 10:00:33 -07:00
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2009-04-18 10:00:33 -07: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-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2009-04-18 10:00:33 -07: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-12-02 16:30:12 -08:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2009-04-18 10:00:33 -07:00
|
|
|
*/
|
|
|
|
|
|
2024-10-07 12:10:35 -07:00
|
|
|
#ifndef INCLUDED_RENDERER_CPUSKINNEDMODELRENDERER
|
|
|
|
|
#define INCLUDED_RENDERER_CPUSKINNEDMODELRENDERER
|
2005-10-24 18:43:07 -07:00
|
|
|
|
2005-11-05 15:15:23 -08:00
|
|
|
#include "renderer/ModelVertexRenderer.h"
|
2005-10-24 18:43:07 -07:00
|
|
|
|
2024-10-07 12:10:35 -07:00
|
|
|
#include <memory>
|
2025-08-13 08:20:49 -07:00
|
|
|
#include <span>
|
2024-10-07 12:10:35 -07:00
|
|
|
|
2025-07-06 11:15:27 -07:00
|
|
|
class CModel;
|
|
|
|
|
class CModelRData;
|
|
|
|
|
namespace Renderer::Backend { class IDeviceCommandContext; }
|
|
|
|
|
|
2005-10-24 18:43:07 -07:00
|
|
|
/**
|
2011-04-06 15:02:05 -07:00
|
|
|
* Render animated models using a ShaderRenderModifier.
|
2024-10-07 12:10:35 -07:00
|
|
|
* It calculates vertex data for models on the CPU side.
|
2012-04-03 11:44:46 -07:00
|
|
|
* This computes and binds per-vertex data; the modifier is responsible
|
2011-04-06 15:02:05 -07:00
|
|
|
* for setting any shader uniforms etc.
|
2005-10-24 18:43:07 -07:00
|
|
|
*/
|
2026-08-04 14:06:10 -07:00
|
|
|
class CPUSkinnedModelVertexRenderer final : public ModelVertexRenderer
|
2005-10-24 18:43:07 -07:00
|
|
|
{
|
|
|
|
|
public:
|
2024-10-07 12:10:35 -07:00
|
|
|
CPUSkinnedModelVertexRenderer();
|
|
|
|
|
~CPUSkinnedModelVertexRenderer();
|
2006-03-25 16:54:20 -08:00
|
|
|
|
2022-02-18 09:33:12 -08:00
|
|
|
CModelRData* CreateModelData(const void* key, CModel* model) override;
|
2024-11-06 06:41:19 -08:00
|
|
|
void UpdateModelsData(
|
|
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2025-08-13 08:20:49 -07:00
|
|
|
std::span<CModel*> models) override;
|
2022-02-18 09:33:12 -08:00
|
|
|
|
2024-11-06 06:41:19 -08:00
|
|
|
void UploadModelsData(
|
2022-10-29 16:20:04 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2025-08-13 08:20:49 -07:00
|
|
|
std::span<CModel*> models) override;
|
2024-11-06 06:41:19 -08:00
|
|
|
|
2022-02-18 09:33:12 -08:00
|
|
|
void PrepareModelDef(
|
2022-05-08 15:02:46 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2022-05-02 13:57:22 -07:00
|
|
|
const CModelDef& def) override;
|
2022-02-18 09:33:12 -08:00
|
|
|
void RenderModel(
|
2022-05-08 15:02:46 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2022-05-02 13:57:22 -07:00
|
|
|
Renderer::Backend::IShaderProgram* shader, CModel* model, CModelRData* data) override;
|
2005-11-05 15:15:23 -08:00
|
|
|
|
2011-03-26 13:17:21 -07:00
|
|
|
protected:
|
2024-11-06 06:41:19 -08:00
|
|
|
void UpdateModelData(
|
|
|
|
|
CModel* model, CModelRData* data, int updateflags);
|
|
|
|
|
|
|
|
|
|
void UploadModelData(
|
|
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
|
|
|
|
CModel* model, CModelRData* data);
|
|
|
|
|
|
2024-10-07 12:10:35 -07:00
|
|
|
struct Internals;
|
|
|
|
|
std::unique_ptr<Internals> m;
|
2011-03-26 13:17:21 -07:00
|
|
|
};
|
|
|
|
|
|
2005-10-24 18:43:07 -07:00
|
|
|
|
2024-10-07 12:10:35 -07:00
|
|
|
#endif // INCLUDED_RENDERER_CPUSKINNEDMODELRENDERER
|