Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/renderer/WaterManager.h
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 9 Lines | |||||
* Water settings (speed, height) and texture management | * Water settings (speed, height) and texture management | ||||
*/ | */ | ||||
#ifndef INCLUDED_WATERMANAGER | #ifndef INCLUDED_WATERMANAGER | ||||
#define INCLUDED_WATERMANAGER | #define INCLUDED_WATERMANAGER | ||||
#include "graphics/Color.h" | #include "graphics/Color.h" | ||||
#include "graphics/Texture.h" | #include "graphics/Texture.h" | ||||
#include "lib/ogl.h" | |||||
#include "maths/Matrix3D.h" | #include "maths/Matrix3D.h" | ||||
#include "maths/Vector2D.h" | #include "maths/Vector2D.h" | ||||
#include "renderer/backend/gl/Texture.h" | #include "renderer/backend/gl/Texture.h" | ||||
#include "renderer/VertexBufferManager.h" | #include "renderer/VertexBufferManager.h" | ||||
#include <memory> | |||||
#include <vector> | |||||
class CFrustum; | class CFrustum; | ||||
struct WaveObject; | struct WaveObject; | ||||
/** | /** | ||||
* Class WaterManager: Maintain rendering-related water settings and textures | * Class WaterManager: Maintain rendering-related water settings and textures | ||||
* Anything that affects gameplay should go in CcmpWaterManager.cpp and passed to this (possibly as copy). | * Anything that affects gameplay should go in CcmpWaterManager.cpp and passed to this (possibly as copy). | ||||
*/ | */ | ||||
class WaterManager | class WaterManager | ||||
{ | { | ||||
public: | public: | ||||
CTexturePtr m_WaterTexture[60]; | CTexturePtr m_WaterTexture[60]; | ||||
CTexturePtr m_NormalMap[60]; | CTexturePtr m_NormalMap[60]; | ||||
float* m_WindStrength; // How strong the waves are at point X. % of waviness. | // How strong the waves are at point X. % of waviness. | ||||
float* m_DistanceHeightmap; // How far from the shore a point is. Manhattan | std::unique_ptr<float[]> m_WindStrength; | ||||
CVector3D* m_BlurredNormalMap; // Cache a slightly blurred map of the normals of the terrain. | // How far from the shore a point is. Manhattan. | ||||
std::unique_ptr<float[]> m_DistanceHeightmap; | |||||
// Waves vertex buffers | // Waves vertex buffers | ||||
std::vector< WaveObject* > m_ShoreWaves; // TODO: once we get C++11, remove pointer | // TODO: measure storing value instead of pointer. | ||||
std::vector<std::unique_ptr<WaveObject>> m_ShoreWaves; | |||||
// Waves indices buffer. Only one since All Wave Objects have the same. | // Waves indices buffer. Only one since All Wave Objects have the same. | ||||
CVertexBuffer::VBChunk* m_ShoreWaves_VBIndices; | CVertexBufferManager::Handle m_ShoreWavesVBIndices; | ||||
size_t m_MapSize; | size_t m_MapSize; | ||||
ssize_t m_TexSize; | ssize_t m_TexSize; | ||||
CTexturePtr m_WaveTex; | CTexturePtr m_WaveTex; | ||||
CTexturePtr m_FoamTex; | CTexturePtr m_FoamTex; | ||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_FancyTexture; | std::unique_ptr<Renderer::Backend::GL::CTexture> m_FancyTexture; | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator