BVB Source Codes

CRYENGINE Show ParticleRender.h Source code

Return Download CRYENGINE: download ParticleRender.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  Created:     26/11/2014 by Filipe amim
  5. //  Description:
  6. // -------------------------------------------------------------------------
  7. //
  8. ////////////////////////////////////////////////////////////////////////////
  9.  
  10. #ifndef PARTICLERENDER_H
  11. #define PARTICLERENDER_H
  12.  
  13. #pragma once
  14.  
  15. #include "ParticleSystem/ParticleFeature.h"
  16.  
  17. namespace pfx2
  18. {
  19.  
  20. const uint vertexBufferSize = 16 * 1024;
  21. const uint vertexChunckSize = 4 * 1024;
  22.  
  23. template<class T, uint bufferSize, uint chunckSize>
  24. class CWriteCombinedBuffer
  25. {
  26. public:
  27.         CWriteCombinedBuffer(FixedDynArray<T>& destMem);
  28.         ~CWriteCombinedBuffer();
  29.         FixedDynArray<T>& Array();
  30.         T*                CheckAvailable(int elems);
  31.  
  32. private:
  33.         uint UnflushedBytes() const;
  34.         void FlushData(uint flushBytes);
  35.         void WrapBuffer();
  36.  
  37.         FixedDynArray<T>* m_pDestMem;                                             // Destination array in VMEM.
  38.         byte*             m_pDestMemBegin;                                        // Cached pointer to start of VMEM.
  39.         uint              m_flushedBytes;                                         // How much written from src buffer.
  40.         uint              m_writtenDestBytes;                                     // Total written to dest buffer.
  41.         FixedDynArray<T>  m_srcArray;                                             // Array for writing, references following buffer:
  42.         byte*             m_pSrcMemBegin;                                         // Aligned pointer into SrcBuffer;
  43.         byte              m_srcBuffer[bufferSize + CRY_PFX2_PARTICLES_ALIGNMENT]; // Raw buffer for writing.
  44. };
  45.  
  46. class CParticleRenderBase : public CParticleFeature, public Cry3DEngineBase
  47. {
  48. public:
  49.         CParticleRenderBase(gpu_pfx2::EGpuFeatureType type = gpu_pfx2::eGpuFeatureType_None);
  50.  
  51.         virtual EFeatureType GetFeatureType() override;
  52.         virtual void         AddToComponent(CParticleComponent* pComponent, SComponentParams* pParams) override;
  53.         virtual void         PrepareRenderObjects(CParticleEmitter* pEmitter, CParticleComponent* pComponent) override;
  54.         virtual void         ResetRenderObjects(CParticleEmitter* pEmitter, CParticleComponent* pComponent) override;
  55.         virtual void         Render(CParticleEmitter* pEmitter, ICommonParticleComponentRuntime* pComponentRuntime, CParticleComponent* pComponent, const SRenderContext& renderContext) override;
  56.  
  57. protected:
  58.         virtual bool     SupportsWaterCulling() const { return false; }
  59.         void             PrepareRenderObject(CParticleEmitter* pEmitter, CParticleComponent* pComponent, uint renderObjectId, uint threadId, uint64 objFlags);
  60.         void             ResetRenderObject(CParticleEmitter* pEmitter, CParticleComponent* pComponent, uint renderObjectId, uint threadId);
  61.         void             AddRenderObject(CParticleEmitter* pEmitter, ICommonParticleComponentRuntime* pComponentRuntime, CParticleComponent* pComponent, const SRenderContext& renderContext, uint renderObjectId, uint threadId, uint64 objFlags);
  62.         ILINE C3DEngine* Get3DEngine() const          { return static_cast<C3DEngine*>(gEnv->p3DEngine); }
  63.  
  64. private:
  65.         uint m_renderObjectBeforeWaterId;
  66.         uint m_renderObjectAfterWaterId;
  67.         bool m_waterCulling;
  68. };
  69.  
  70. }
  71.  
  72. #include "ParticleRenderImpl.h"
  73.  
  74. #endif // PARTICLERENDER_H
  75.  
downloadParticleRender.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