2026-05-10 14:57:20 -07:00
|
|
|
/* Copyright (C) 2026 Wildfire Games.
|
2023-12-02 16:30:12 -08:00
|
|
|
* This file is part of 0 A.D.
|
2011-03-13 12:22:05 -07:00
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2011-03-13 12:22:05 -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,
|
2011-03-13 12:22:05 -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/>.
|
2011-03-13 12:22:05 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INCLUDED_DECALRDATA
|
|
|
|
|
#define INCLUDED_DECALRDATA
|
|
|
|
|
|
2026-05-10 14:57:20 -07:00
|
|
|
#include "graphics/Material.h"
|
2011-03-13 12:22:05 -07:00
|
|
|
#include "graphics/RenderableObject.h"
|
2025-07-06 11:15:27 -07:00
|
|
|
#include "lib/code_annotation.h"
|
2021-02-10 15:48:43 -08:00
|
|
|
#include "maths/Vector2D.h"
|
|
|
|
|
#include "maths/Vector3D.h"
|
|
|
|
|
#include "renderer/VertexBufferManager.h"
|
2022-01-19 09:28:47 -08:00
|
|
|
#include <vector>
|
|
|
|
|
|
2011-03-13 12:22:05 -07:00
|
|
|
class CModelDecal;
|
2014-07-02 15:36:45 -07:00
|
|
|
class CShaderDefines;
|
2012-09-28 11:20:36 -07:00
|
|
|
class CSimulation2;
|
2014-06-24 18:11:10 -07:00
|
|
|
class ShadowMap;
|
2025-07-06 11:15:27 -07:00
|
|
|
namespace Renderer::Backend { class IDeviceCommandContext; }
|
|
|
|
|
namespace Renderer::Backend { class IVertexInputLayout; }
|
2011-03-13 12:22:05 -07:00
|
|
|
|
|
|
|
|
class CDecalRData : public CRenderData
|
|
|
|
|
{
|
|
|
|
|
public:
|
2012-09-28 11:20:36 -07:00
|
|
|
CDecalRData(CModelDecal* decal, CSimulation2* simulation);
|
2011-03-13 12:22:05 -07:00
|
|
|
~CDecalRData();
|
|
|
|
|
|
2023-01-05 16:39:25 -08:00
|
|
|
static Renderer::Backend::IVertexInputLayout* GetVertexInputLayout();
|
|
|
|
|
|
2012-09-28 11:20:36 -07:00
|
|
|
void Update(CSimulation2* simulation);
|
2011-03-13 12:22:05 -07:00
|
|
|
|
2021-02-03 16:00:55 -08:00
|
|
|
static void RenderDecals(
|
2022-05-08 15:02:46 -07:00
|
|
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
2023-01-05 16:39:25 -08:00
|
|
|
Renderer::Backend::IVertexInputLayout* vertexInputLayout,
|
2026-05-10 14:57:20 -07:00
|
|
|
const std::vector<CDecalRData*>& decals, const CShaderDefines& context,
|
|
|
|
|
ShadowMap* shadow, const CMaterial::Pass materialPass);
|
2011-03-13 12:22:05 -07:00
|
|
|
|
2011-07-12 16:48:05 -07:00
|
|
|
CModelDecal* GetDecal() { return m_Decal; }
|
|
|
|
|
|
2011-03-13 12:22:05 -07:00
|
|
|
private:
|
2021-02-10 15:48:43 -08:00
|
|
|
void BuildVertexData();
|
2011-03-13 12:22:05 -07:00
|
|
|
|
2021-02-10 15:48:43 -08:00
|
|
|
struct SDecalVertex
|
|
|
|
|
{
|
|
|
|
|
CVector3D m_Position;
|
|
|
|
|
CVector3D m_Normal;
|
|
|
|
|
CVector2D m_UV;
|
|
|
|
|
};
|
|
|
|
|
cassert(sizeof(SDecalVertex) == 32);
|
2011-03-13 12:22:05 -07:00
|
|
|
|
2021-02-10 15:48:43 -08:00
|
|
|
CVertexBufferManager::Handle m_VBDecals;
|
|
|
|
|
CVertexBufferManager::Handle m_VBDecalsIndices;
|
2011-03-13 12:22:05 -07:00
|
|
|
|
|
|
|
|
CModelDecal* m_Decal;
|
2012-09-28 11:20:36 -07:00
|
|
|
|
|
|
|
|
CSimulation2* m_Simulation;
|
2011-03-13 12:22:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // INCLUDED_DECALRDATA
|