BVB Source Codes

CRYENGINE Show FeatureRenderGpuSprites.cpp Source code

Return Download CRYENGINE: download FeatureRenderGpuSprites.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4. #include "FeatureRenderGpuSprites.h"
  5. #include "ParticleSystem/ParticleEmitter.h"
  6.  
  7. CRY_PFX2_DBG
  8.  
  9. namespace pfx2
  10. {
  11.  
  12. #if !CRY_PLATFORM_ORBIS
  13.         #define CRY_PFX2_POINT_SPRITES
  14. #endif
  15.  
  16. CFeatureRenderGpuSprites::CFeatureRenderGpuSprites()
  17.         : CParticleRenderBase(gpu_pfx2::eGpuFeatureType_RenderGpu)
  18.         , m_maxParticles(131072)
  19.         , m_maxNewBorns(8192)
  20.         , m_sortMode(EGpuSpritesSortMode::None)
  21.         , m_facingMode(EGpuSpritesFacingMode::Screen)
  22.         , m_axisScale(1.0f)
  23.         , m_sortBias(0.0f)
  24. {
  25. }
  26.  
  27. void CFeatureRenderGpuSprites::AddToComponent(CParticleComponent* pComponent, SComponentParams* pParams)
  28. {
  29.         CParticleRenderBase::AddToComponent(pComponent, pParams);
  30.         pParams->m_renderObjectFlags |= FOB_POINT_SPRITE;
  31.         pParams->m_renderObjectSortBias = m_sortBias;
  32. }
  33.  
  34. void CFeatureRenderGpuSprites::Serialize(Serialization::IArchive& ar)
  35. {
  36.         CParticleFeature::Serialize(ar);
  37.         ar(m_maxParticles, "MaxParticles", "Max Particles");
  38.         ar(m_maxNewBorns, "MaxNewBorns", "Max New Particles");
  39.         ar(m_sortMode, "SortMode", "Sort Mode");
  40.         ar(m_facingMode, "FacingMode", "Facing Mode");
  41.  
  42.         if (m_facingMode == EGpuSpritesFacingMode::Velocity)
  43.                 ar(m_axisScale, "AxisScale", "Axis Scale");
  44.  
  45.         ar(m_sortBias, "SortBias", "Sort Bias");
  46. }
  47.  
  48. void CFeatureRenderGpuSprites::ResolveDependency(CParticleComponent* pComponent)
  49. {
  50.         SRuntimeInitializationParameters params;
  51.         params.usesGpuImplementation = true;
  52.         params.maxParticles = m_maxParticles;
  53.         params.maxNewBorns = m_maxNewBorns;
  54.         params.sortMode = static_cast<EGpuSortMode>(m_sortMode);
  55.         params.facingMode = static_cast<EGpuFacingMode>(m_facingMode);
  56.         params.axisScale = m_axisScale;
  57.         auto& compParams = pComponent->GetComponentParams();
  58.         params.isSecondGen = compParams.IsSecondGen();
  59.         params.parentId = compParams.m_parentId;
  60.         params.version = pComponent->GetEffect()->GetEditVersion();
  61.  
  62.         pComponent->SetRuntimeInitializationParameters(params);
  63. }
  64.  
  65. CRY_PFX2_IMPLEMENT_FEATURE(CParticleFeature, CFeatureRenderGpuSprites, "GPU Particles", "Sprites", colorGPU);
  66. CRY_PFX2_LEGACY_FEATURE(CParticleFeature, CFeatureRenderGpuSprites, "RenderGPU Sprites");
  67.  
  68. }
  69.  
downloadFeatureRenderGpuSprites.cpp 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