BVB Source Codes

CRYENGINE Show ParticleSystem.h Source code

Return Download CRYENGINE: download ParticleSystem.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  Created:     06/04/2014 by Filipe amim
  5. //  Description:
  6. // -------------------------------------------------------------------------
  7. //
  8. ////////////////////////////////////////////////////////////////////////////
  9.  
  10. #ifndef PARTICLESYSTEM_H
  11. #define PARTICLESYSTEM_H
  12.  
  13. #pragma once
  14.  
  15. #include <CryExtension/ClassWeaver.h>
  16. #include "ParticleCommon.h"
  17. #include "ParticleDebug.h"
  18. #include "ParticleJobManager.h"
  19. #include "ParticleProfiler.h"
  20. #include "ParticleEmitter.h"
  21.  
  22. namespace pfx2
  23. {
  24. class CParticleSystem : public Cry3DEngineBase, public IParticleSystem
  25. {
  26.         CRYINTERFACE_SIMPLE(IParticleSystem)
  27.         CRYGENERATE_SINGLETONCLASS(CParticleSystem, "CryEngine_ParticleSystem", 0xCD8D738D54B446F7, 0x82BA23BA999CF2AC)
  28.  
  29.         CParticleSystem();
  30.         virtual ~CParticleSystem() {}
  31.  
  32. private:
  33.         typedef std::vector<_smart_ptr<CParticleEmitter>>                                                                     TParticleEmitters;
  34.         typedef std::unordered_map<string, _smart_ptr<CParticleEffect>, stl::hash_stricmp<string>, stl::hash_stricmp<string>> TEffectNameMap;
  35.  
  36. public:
  37.         // IParticleSystem
  38.         PParticleEffect         CreateEffect() override;
  39.         PParticleEffect         ConvertEffect(const ::IParticleEffect* pOldEffect, bool bReplace) override;
  40.         void                    RenameEffect(PParticleEffect pEffect, cstr name) override;
  41.         PParticleEffect         FindEffect(cstr name) override;
  42.         PParticleEmitter        CreateEmitter(PParticleEffect pEffect) override;
  43.         uint                    GetNumFeatureParams() const override;
  44.         SParticleFeatureParams& GetFeatureParam(uint featureIdx) const override;
  45.  
  46.         void                    OnFrameStart() override;
  47.         void                    Update() override;
  48.         void                    Reset() override;
  49.  
  50.         void                    Serialize(TSerialize ser) override;
  51.  
  52.         void                    GetCounts(SParticleCounts& counts) override;
  53.         void                    GetMemoryUsage(ICrySizer* pSizer) const override;
  54.         // ~IParticleSystem
  55.  
  56.         PParticleEffect      LoadEffect(cstr effectName);
  57.         SParticleCounts&     GetCounts()                      { return m_counts; }
  58.         TParticleHeap&       GetMemHeap(uint32 threadId = ~0) { return m_memHeap[threadId + 1]; }
  59.         CParticleJobManager& GetJobManager()                  { return m_jobManager; }
  60.         CParticleProfiler&   GetProfiler()                    { return m_profiler; }
  61.         void                 SyncronizeUpdateKernels();
  62.         void                 DeferredRender();
  63.  
  64.         void                 ClearRenderResources();
  65.  
  66.         static float         GetMaxAngularDensity(const CCamera& camera)
  67.         {
  68.                 return camera.GetAngularResolution() / max(GetCVars()->e_ParticlesMinDrawPixels, 0.125f) * 2.0f;
  69.         }
  70.         QuatT                GetCameraMotion() const { return m_cameraMotion; }
  71.  
  72. private:
  73.         void              UpdateGpuRuntimesForEmitter(CParticleEmitter* pEmitter);
  74.         void              TrimEmitters();
  75.         CParticleEffect*  CastEffect(const PParticleEffect& pEffect) const;
  76.         CParticleEmitter* CastEmitter(const PParticleEmitter& pEmitter) const;
  77.  
  78.         // PFX1 to PFX2
  79.         string ConvertPfx1Name(cstr oldEffectName);
  80.         // ~PFX1 to PFX2
  81.  
  82.         SParticleCounts            m_counts;
  83.  
  84.         CParticleJobManager        m_jobManager;
  85.         CParticleProfiler          m_profiler;
  86.         TEffectNameMap             m_effects;
  87.         TParticleEmitters          m_emitters;
  88.         std::vector<TParticleHeap> m_memHeap;
  89.         QuatT                      m_lastCameraPose = ZERO;
  90.         QuatT                      m_cameraMotion = ZERO;
  91.         uint                       m_nextEmitterId;
  92. };
  93.  
  94. std::vector<SParticleFeatureParams>& GetFeatureParams();
  95.  
  96. CParticleSystem*                     GetPSystem();
  97.  
  98. uint                                 GetVersion(Serialization::IArchive& ar);
  99.  
  100. }
  101.  
  102. #endif // PARTICLESYSTEM_H
  103.  
downloadParticleSystem.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