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/cloud.h | 74 ++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 24 deletions(-) (limited to 'src/graphics/engine/cloud.h') diff --git a/src/graphics/engine/cloud.h b/src/graphics/engine/cloud.h index 562f651..676dfe8 100644 --- a/src/graphics/engine/cloud.h +++ b/src/graphics/engine/cloud.h @@ -24,6 +24,9 @@ #include "math/point.h" #include "math/vector.h" +#include +#include + class CInstanceManager; @@ -34,13 +37,20 @@ namespace Gfx { class CEngine; class CTerrain; -const short MAXCLOUDLINE = 100; - struct CloudLine { - short x, y; // beginning - short len; // in length x + //! Beginning + short x, y; + //! In length x + short len; float px1, px2, pz; + + CloudLine() + { + x = y = 0; + len = 0; + px1 = px2 = pz = 0; + } }; @@ -51,43 +61,59 @@ public: ~CCloud(); bool EventProcess(const Event &event); + //! Removes all the clouds void Flush(); - bool Create(const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level); + //! Creates all areas of cloud + void Create(const std::string& fileName, Gfx::Color diffuse, Gfx::Color ambient, float level); + //! Draw the clouds void Draw(); - bool SetLevel(float level); + //! Modifies the cloud level + void SetLevel(float level); + //! Returns the current level of clouds float GetLevel(); - void SetEnable(bool bEnable); + //! Activate management of clouds + void SetEnable(bool enable); bool GetEnable(); protected: + //! Makes the clouds evolve bool EventFrame(const Event &event); - void AdjustLevel(Math::Vector &pos, Math::Vector &eye, float deep, Math::Point &uv1, Math::Point &uv2); - bool CreateLine(int x, int y, int len); + //! Adjusts the position to normal, to imitate the clouds at movement + void AdjustLevel(Math::Vector &pos, Math::Vector &eye, float deep, + Math::Point &uv1, Math::Point &uv2); + //! Updates the positions, relative to the ground + void CreateLine(int x, int y, int len); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CTerrain* m_terrain; - - char m_filename[100]; - float m_level; // overall level - Math::Point m_speed; // feedrate (wind) - Gfx::Color m_diffuse; // diffuse color - Gfx::Color m_ambient; // ambient color + CInstanceManager* m_iMan; + Gfx::CEngine* m_engine; + Gfx::CTerrain* m_terrain; + + std::string m_fileName; + //! Overall level + float m_level; + //! Feedrate (wind) + Math::Point m_speed; + //! Diffuse color + Gfx::Color m_diffuse; + //! Ambient color + Gfx::Color m_ambient; float m_time; float m_lastTest; int m_subdiv; - Math::Vector m_wind; // wind speed - int m_brick; // brick mosaic - float m_size; // size of a brick element + //! Wind speed + Math::Vector m_wind; + //! Brick mosaic + int m_brick; + //! Size of a brick element + float m_size; - int m_lineUsed; - CloudLine m_line[MAXCLOUDLINE]; + std::vector m_line; - bool m_bEnable; + bool m_enable; }; -- cgit v1.2.3-1-g7c22