From 878eec8eea26deedf3b1346df71bff391424c325 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Wed, 8 Aug 2012 21:32:44 +0200 Subject: CTerrain implementation Added rewritten CTerrain implementation Compiles OK, but functions are missing from other classes Also needs testing --- src/graphics/engine/water.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/graphics/engine/water.h') diff --git a/src/graphics/engine/water.h b/src/graphics/engine/water.h index 67be9dc..6d3736e 100644 --- a/src/graphics/engine/water.h +++ b/src/graphics/engine/water.h @@ -72,7 +72,7 @@ public: CWater(CInstanceManager* iMan, Gfx::CEngine* engine); ~CWater(); - void SetGLDevice(Gfx::CDevice device); + void SetDevice(Gfx::CDevice* device); bool EventProcess(const Event &event); void Flush(); bool Create(WaterType type1, WaterType type2, const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level, float glint, Math::Vector eddy); @@ -80,11 +80,11 @@ public: void DrawSurf(); bool SetLevel(float level); - float RetLevel(); - float RetLevel(CObject* object); + float GetLevel(); + float GetLevel(CObject* object); void SetLava(bool bLava); - bool RetLava(); + bool GetLava(); void AdjustEye(Math::Vector &eye); @@ -92,7 +92,7 @@ protected: bool EventFrame(const Event &event); void LavaFrame(float rTime); void AdjustLevel(Math::Vector &pos, Math::Vector &norm, Math::Point &uv1, Math::Point &uv2); - bool RetWater(int x, int y); + bool GetWater(int x, int y); bool CreateLine(int x, int y, int len); void VaporFlush(); @@ -101,8 +101,8 @@ protected: protected: CInstanceManager* m_iMan; - CEngine* m_engine; - CDevice* m_pDevice; + CEngine* m_engine; + CDevice* m_device; CTerrain* m_terrain; CParticle* m_particule; CSound* m_sound; -- cgit v1.2.3-1-g7c22 From c1936514c054d6d7c85843bf2c3e0b97653ef651 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Wed, 8 Aug 2012 23:51:19 +0200 Subject: CWater and CCloud basic implementation Added rewritten implementation for CWater and CCloud Won't link yet because of missing functions --- src/graphics/engine/water.h | 137 ++++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 49 deletions(-) (limited to 'src/graphics/engine/water.h') diff --git a/src/graphics/engine/water.h b/src/graphics/engine/water.h index 6d3736e..245baf7 100644 --- a/src/graphics/engine/water.h +++ b/src/graphics/engine/water.h @@ -19,50 +19,64 @@ #pragma once -#include "graphics/engine/engine.h" -#include "graphics/engine/particle.h" #include "common/event.h" +#include "graphics/engine/particle.h" class CInstanceManager; -class CSound; +class CSoundInterface; namespace Gfx { +class CEngine; class CTerrain; - -const short MAXWATERLINE = 500; - struct WaterLine { - short x, y; // beginning - short len; // length by x + //! Beginning + short x, y; + //! Length by x + short len; float px1, px2, pz; -}; - -const short MAXWATVAPOR = 10; + WaterLine() + { + x = y = 0; + len = 0; + px1 = px2 = pz = 0.0f; + } +}; struct WaterVapor { - bool bUsed; - ParticleType type; - Math::Vector pos; - float delay; - float time; - float last; + bool used; + Gfx::ParticleType type; + Math::Vector pos; + float delay; + float time; + float last; + + WaterVapor() + { + used = false; + type = Gfx::PARTIWATER; + delay = time = last = 0.0f; + } }; - enum WaterType { - WATER_NULL = 0, // no water - WATER_TT = 1, // transparent texture - WATER_TO = 2, // opaque texture - WATER_CT = 3, // transparent color - WATER_CO = 4, // opaque color + //! No water + WATER_NULL = 0, + //! Transparent texture + WATER_TT = 1, + //! Opaque texture + WATER_TO = 2, + //! Transparent color + WATER_CT = 3, + //! Opaque color + WATER_CO = 4, }; @@ -74,61 +88,86 @@ public: void SetDevice(Gfx::CDevice* device); bool EventProcess(const Event &event); + //! Removes all the water void Flush(); - bool Create(WaterType type1, WaterType type2, const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level, float glint, Math::Vector eddy); + //! Creates all expanses of water + void Create(WaterType type1, WaterType type2, const std::string& fileName, + Gfx::Color diffuse, Gfx::Color ambient, float level, float glint, Math::Vector eddy); + //! Draw the back surface of the water void DrawBack(); + //! Draws the flat surface of the water void DrawSurf(); - bool SetLevel(float level); + //! Changes the level of the water + void SetLevel(float level); + //! Returns the current level of water float GetLevel(); + //! Returns the current level of water for a given object float GetLevel(CObject* object); - void SetLava(bool bLava); + //@{ + //! Management of the mode of lava/water + void SetLava(bool lava); bool GetLava(); + //@} + //! Adjusts the eye of the camera, not to be in the water void AdjustEye(Math::Vector &eye); protected: + //! Makes water evolve bool EventFrame(const Event &event); + //! Makes evolve the steam jets on the lava void LavaFrame(float rTime); + //! Adjusts the position to normal, to imitate reflections on an expanse of water at rest void AdjustLevel(Math::Vector &pos, Math::Vector &norm, Math::Point &uv1, Math::Point &uv2); + //! Indicates if there is water in a given position bool GetWater(int x, int y); - bool CreateLine(int x, int y, int len); + //! Updates the positions, relative to the ground + void CreateLine(int x, int y, int len); + //! Removes all the steam jets void VaporFlush(); + //! Creates a new steam bool VaporCreate(ParticleType type, Math::Vector pos, float delay); + //! Makes evolve a steam jet void VaporFrame(int i, float rTime); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CDevice* m_device; - CTerrain* m_terrain; - CParticle* m_particule; - CSound* m_sound; + CInstanceManager* m_iMan; + Gfx::CEngine* m_engine; + Gfx::CDevice* m_device; + Gfx::CTerrain* m_terrain; + Gfx::CParticle* m_particule; + CSoundInterface* m_sound; WaterType m_type[2]; - char m_filename[100]; - float m_level; // overall level - float m_glint; // amplitude of reflections - Math::Vector m_eddy; // amplitude of swirls - Gfx::Color m_diffuse; // diffuse color - Gfx::Color m_ambient; // ambient color + std::string m_fileName; + //! Overall level + float m_level; + //! Amplitude of reflections + float m_glint; + //! Amplitude of swirls + Math::Vector m_eddy; + //! Diffuse color + Gfx::Color m_diffuse; + //! Ambient color + Gfx::Color m_ambient; float m_time; float m_lastLava; - int m_subdiv; - - int m_brick; // number of brick*mosaics - float m_size; // size of a item in an brick + int m_subdiv; - int m_lineUsed; - WaterLine m_line[MAXWATERLINE]; + //! Number of brick*mosaics + int m_brick; + //! Size of a item in an brick + float m_size; - WaterVapor m_vapor[MAXWATVAPOR]; + std::vector m_line; + std::vector m_vapor; - bool m_bDraw; - bool m_bLava; - long m_color; + bool m_draw; + bool m_lava; + long m_color; }; }; // namespace Gfx -- cgit v1.2.3-1-g7c22 From 1996507fd3d4d9de90de99845b71a6bf3fbe62da Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 11 Aug 2012 18:39:16 +0200 Subject: Documentation update - updated Doxyfile - added/changed file, dir and namespace descriptions - fixed some errors in doxygen tags --- src/graphics/engine/water.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/graphics/engine/water.h') diff --git a/src/graphics/engine/water.h b/src/graphics/engine/water.h index 245baf7..b051889 100644 --- a/src/graphics/engine/water.h +++ b/src/graphics/engine/water.h @@ -15,7 +15,10 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// water.h +/** + * \file graphics/engine/water.h + * \brief Water rendering - Gfx::CWater class + */ #pragma once -- cgit v1.2.3-1-g7c22