BVB Source Codes

CRYENGINE Show ParticleJobManager.h Source code

Return Download CRYENGINE: download ParticleJobManager.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  Created:     13/03/2015 by Filipe amim
  5. //  Description:
  6. // -------------------------------------------------------------------------
  7. //
  8. ////////////////////////////////////////////////////////////////////////////
  9.  
  10. #ifndef PARTICLEKERNEL_H
  11. #define PARTICLEKERNEL_H
  12.  
  13. #pragma once
  14.  
  15. #include <CryThreading/IJobManager_JobDelegator.h>
  16. #include "ParticleContainer.h"
  17.  
  18. class CRenderObject;
  19. namespace JobManager {
  20. namespace Detail {
  21. class SGenericJobTPostUpdateParticlesJob;
  22. }
  23. }
  24.  
  25. namespace pfx2
  26. {
  27.  
  28. class CParticleComponent;
  29. class CParticleComponentRuntime;
  30. class CParticleEffect;
  31. struct SRenderContext;
  32.  
  33. class CParticleJobManager
  34. {
  35. public:
  36.         struct SComponentRef
  37.         {
  38.                 SComponentRef()
  39.                         : m_pComponentRuntime(0)
  40.                         , m_pPostSubUpdates(0)
  41.                         , m_firstChild(0)
  42.                         , m_numChildren(0) {}
  43.                 SComponentRef(CParticleComponentRuntime* pComponentRuntime)
  44.                         : m_pComponentRuntime(pComponentRuntime)
  45.                         , m_pPostSubUpdates(0)
  46.                         , m_firstChild(0)
  47.                         , m_numChildren(0) {}
  48.  
  49.                 CParticleComponentRuntime* m_pComponentRuntime;
  50.                 JobManager::SJobState      m_subUpdateState;
  51.                 JobManager::Detail::SGenericJobTPostUpdateParticlesJob* m_pPostSubUpdates;
  52.                 size_t                     m_firstChild;
  53.                 size_t                     m_numChildren;
  54.         };
  55.  
  56.         struct SDeferredRender
  57.         {
  58.                 SDeferredRender(CParticleComponentRuntime* pRuntime, const SRenderContext& renderContext)
  59.                         : m_pRuntime(pRuntime)
  60.                         , m_rParam(renderContext.m_renderParams)
  61.                         , m_passInfo(renderContext.m_passInfo)
  62.                         , m_distance(renderContext.m_distance)
  63.                         , m_lightVolumeId(renderContext.m_lightVolumeId)
  64.                         , m_fogVolumeId(renderContext.m_fogVolumeId) {}
  65.                 CParticleComponentRuntime* m_pRuntime;
  66.                 SRendParams                m_rParam;
  67.                 SRenderingPassInfo         m_passInfo;
  68.                 float                      m_distance;
  69.                 uint16                     m_lightVolumeId;
  70.                 uint16                     m_fogVolumeId;
  71.         };
  72.  
  73. public:
  74.         void AddEmitter(CParticleEmitter* pEmitter);
  75.         void AddDeferredRender(CParticleComponentRuntime* pRuntime, const SRenderContext& renderContext);
  76.         void ScheduleComputeVertices(CParticleComponentRuntime* pComponentRuntime, CRenderObject* pRenderObject, const SRenderContext& renderContext);
  77.         void KernelUpdateAll();
  78.         void SynchronizeUpdate();
  79.         void DeferredRender();
  80.  
  81.         // job entry points
  82.         void Job_AddRemoveParticles(uint componentRefIdx);
  83.         void Job_UpdateParticles(uint componentRefIdx, SUpdateRange updateRange);
  84.         void Job_PostUpdateParticles(uint componentRefIdx);
  85.         void Job_CalculateBounds(uint componentRefIdx);
  86.         // ~job entry points
  87.  
  88. private:
  89.         void AddComponentRecursive(CParticleEmitter* pEmitter, size_t parentRefIdx);
  90.  
  91.         void ScheduleUpdateParticles(uint componentRefIdx);
  92.         void ScheduleChildrenComponents(SComponentRef& componentRef);
  93.         void ScheduleCalculateBounds(uint componentRefIdx);
  94.  
  95.         void DoAddRemove(const SComponentRef& componentRef);
  96.         void DoCalculateBounds(const SComponentRef& componentRef);
  97.  
  98.         void ClearAll();
  99.  
  100.         std::vector<SComponentRef>   m_componentRefs;
  101.         std::vector<size_t>          m_firstGenComponentsRef;
  102.         std::vector<SDeferredRender> m_deferredRenders;
  103.         JobManager::SJobState        m_updateState;
  104. };
  105.  
  106. }
  107.  
  108. #endif // PARTICLEKERNEL_H
  109.  
downloadParticleJobManager.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