2021-02-04 01:00:55 +01:00
|
|
|
/* Copyright (C) 2021 Wildfire Games.
|
2011-03-13 20:22:05 +01: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_DECALRDATA
|
|
|
|
#define INCLUDED_DECALRDATA
|
|
|
|
|
|
|
|
#include "graphics/RenderableObject.h"
|
2021-02-11 00:48:43 +01:00
|
|
|
#include "maths/Vector2D.h"
|
|
|
|
#include "maths/Vector3D.h"
|
|
|
|
#include "renderer/VertexBufferManager.h"
|
2011-03-13 20:22:05 +01:00
|
|
|
|
|
|
|
class CModelDecal;
|
2014-07-03 00:36:45 +02:00
|
|
|
class CShaderDefines;
|
2012-09-28 20:20:36 +02:00
|
|
|
class CSimulation2;
|
2014-06-25 03:11:10 +02:00
|
|
|
class ShadowMap;
|
2011-03-13 20:22:05 +01:00
|
|
|
|
|
|
|
class CDecalRData : public CRenderData
|
|
|
|
{
|
|
|
|
public:
|
2012-09-28 20:20:36 +02:00
|
|
|
CDecalRData(CModelDecal* decal, CSimulation2* simulation);
|
2011-03-13 20:22:05 +01:00
|
|
|
~CDecalRData();
|
|
|
|
|
2012-09-28 20:20:36 +02:00
|
|
|
void Update(CSimulation2* simulation);
|
2011-03-13 20:22:05 +01:00
|
|
|
|
2021-02-04 01:00:55 +01:00
|
|
|
static void RenderDecals(
|
2021-02-10 17:42:56 +01:00
|
|
|
const std::vector<CDecalRData*>& decals, const CShaderDefines& context, ShadowMap* shadow);
|
2011-03-13 20:22:05 +01:00
|
|
|
|
2011-07-13 01:48:05 +02:00
|
|
|
CModelDecal* GetDecal() { return m_Decal; }
|
|
|
|
|
2011-03-13 20:22:05 +01:00
|
|
|
private:
|
2021-02-11 00:48:43 +01:00
|
|
|
void BuildVertexData();
|
2011-03-13 20:22:05 +01:00
|
|
|
|
2021-02-11 00:48:43 +01:00
|
|
|
struct SDecalVertex
|
|
|
|
{
|
|
|
|
CVector3D m_Position;
|
|
|
|
CVector3D m_Normal;
|
|
|
|
CVector2D m_UV;
|
|
|
|
};
|
|
|
|
cassert(sizeof(SDecalVertex) == 32);
|
2011-03-13 20:22:05 +01:00
|
|
|
|
2021-02-11 00:48:43 +01:00
|
|
|
CVertexBufferManager::Handle m_VBDecals;
|
|
|
|
CVertexBufferManager::Handle m_VBDecalsIndices;
|
2011-03-13 20:22:05 +01:00
|
|
|
|
|
|
|
CModelDecal* m_Decal;
|
2012-09-28 20:20:36 +02:00
|
|
|
|
|
|
|
CSimulation2* m_Simulation;
|
2011-03-13 20:22:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDED_DECALRDATA
|