BVB Source Codes

CRYENGINE Show CloudsManager.h Source code

Return Download CRYENGINE: download CloudsManager.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   CloudsManager.h
  5. //  Version:     v1.00
  6. //  Created:     15/2/2005 by Timur.
  7. //  Compilers:   Visual Studio.NET 2003
  8. //  Description:
  9. // -------------------------------------------------------------------------
  10. //  History:
  11. //
  12. ////////////////////////////////////////////////////////////////////////////
  13.  
  14. #ifndef __CloudsManager_h__
  15. #define __CloudsManager_h__
  16. #pragma once
  17.  
  18. class CCloudRenderNode;
  19.  
  20. typedef std::vector<SCloudParticle*> CloudParticles;
  21.  
  22. struct SCloudQuadTree
  23. {
  24.         CloudParticles  m_particles;
  25.         AABB            m_bounds;
  26.         SCloudQuadTree* m_pQuads[4];
  27.         int             m_level;
  28.         SCloudQuadTree(int level = 0)
  29.         {
  30.                 m_pQuads[0] = 0;
  31.                 m_pQuads[1] = 0;
  32.                 m_pQuads[2] = 0;
  33.                 m_pQuads[3] = 0;
  34.                 m_level = level;
  35.         }
  36.         ~SCloudQuadTree()
  37.         {
  38.                 delete m_pQuads[0];
  39.                 delete m_pQuads[1];
  40.                 delete m_pQuads[2];
  41.                 delete m_pQuads[3];
  42.                 m_pQuads[0] = m_pQuads[1] = m_pQuads[2] = m_pQuads[3] = 0;
  43.         }
  44.         void Init(const AABB& bounds, const CloudParticles& particles, int maxlevel = 2);
  45.         bool CheckIntersection(const Vec3& p1, const Vec3& p2);
  46. };
  47.  
  48. //////////////////////////////////////////////////////////////////////////
  49. // SCloudDescription contains cached representation of the cloud description file.
  50. //////////////////////////////////////////////////////////////////////////
  51. struct SCloudDescription : public _reference_target_t, public Cry3DEngineBase
  52. {
  53.         string                      filename;
  54.         int                         m_textureRows;
  55.         int                         m_textureCols;
  56.         int                         m_numSprites;
  57.  
  58.         AABB                        m_bounds;
  59.         Vec3                        m_offset;
  60.  
  61.         _smart_ptr<IMaterial>       m_pMaterial;
  62.         std::vector<SCloudParticle> m_particles;
  63.         SCloudQuadTree*             m_pCloudTree;
  64.  
  65.         SCloudDescription()
  66.         {
  67.                 m_textureRows = 0;
  68.                 m_textureCols = 0;
  69.                 m_numSprites = 0;
  70.                 m_pCloudTree = 0;
  71.         };
  72.         ~SCloudDescription();
  73. };
  74.  
  75. //////////////////////////////////////////////////////////////////////////
  76. // CloudsManager is used to manage cloud descriptions loaded from the files.
  77. // When cloud file is once loaded it caches its content and next time the same
  78. // cloud file is request, Clients will get the cached content.
  79. //////////////////////////////////////////////////////////////////////////
  80. class CCloudsManager : public Cry3DEngineBase
  81. {
  82. public:
  83.         CCloudsManager() {};
  84.         ~CCloudsManager() {};
  85.  
  86.         // Loads cloud file and returns cloud description.
  87.         // If cloud was already loaded cached instance is returned.
  88.         // Reference count of the cloud description is incremented,Client must call Release on returned pointer to free cloud description.
  89.         SCloudDescription* LoadCloud(const char* sFilename);
  90.  
  91.         // Used to parse xml node and create a cloud description from it.
  92.         void ParseCloudFromXml(XmlNodeRef node, SCloudDescription* pCloud);
  93.  
  94.         void AddCloudRenderNode(CCloudRenderNode* pNode);
  95.         void RemoveCloudRenderNode(CCloudRenderNode* pNode);
  96.         bool CheckIntersectClouds(const Vec3& p1, const Vec3& p2);
  97.         void MoveClouds();
  98.  
  99. private:
  100.         friend struct SCloudDescription;
  101.         void Register(SCloudDescription* desc);
  102.         void Unregister(SCloudDescription* desc);
  103.  
  104. private:
  105.         typedef std::map<string, SCloudDescription*, stl::less_stricmp<string>> CloudsMaps;
  106.  
  107.         CloudsMaps                     m_cloudsMap;
  108.         std::vector<CCloudRenderNode*> m_cloudNodes;
  109. };
  110.  
  111. #endif // __CloudsManager_h__
  112.  
downloadCloudsManager.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top