BVB Source Codes

CRYENGINE Show FeatureCollision.h Source code

Return Download CRYENGINE: download FeatureCollision.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  Created:     22/10/2015 by Benjamin Block
  5. //  Description:
  6. // -------------------------------------------------------------------------
  7. //
  8. ////////////////////////////////////////////////////////////////////////////
  9.  
  10. #pragma once
  11.  
  12. #include "StdAfx.h"
  13. #include "ParticleSystem/ParticleFeature.h"
  14.  
  15. CRY_PFX2_DBG
  16.  
  17. namespace pfx2
  18. {
  19.  
  20. enum class EContactPointsFlags
  21. {
  22.         Active   = BIT(0),
  23.         Collided = BIT(1),
  24.         Sliding  = BIT(2),
  25.         Ignore   = BIT(3),
  26. };
  27.  
  28. struct SContactPoint
  29. {
  30.         SContactPoint()
  31.                 : m_point(ZERO)
  32.                 , m_normal(ZERO)
  33.                 , m_flags(0)
  34.                 , m_totalCollisions(0) {}
  35.  
  36.         Vec3 m_point;
  37.         Vec3 m_normal;
  38.         uint m_totalCollisions;
  39.         uint m_flags;   // EContactPointsFlags
  40. };
  41.  
  42. extern EParticleDataType EPDT_ContactPoint;
  43.  
  44. SERIALIZATION_ENUM_DECLARE(ECollisionLimitMode, ,
  45.         Unlimited,
  46.         Ignore,
  47.         Stop,
  48.         Kill
  49.         )
  50.  
  51. //////////////////////////////////////////////////////////////////////////
  52. // CFeatureCollision
  53.  
  54. class CFeatureCollision : public CParticleFeature
  55. {
  56. public:
  57.         CRY_PFX2_DECLARE_FEATURE
  58.  
  59. public:
  60.         CFeatureCollision();
  61.  
  62.         virtual void AddToComponent(CParticleComponent* pComponent, SComponentParams* pParams) override;
  63.         virtual void Serialize(Serialization::IArchive& ar) override;
  64.         virtual void Update(const SUpdateContext& context) override;
  65.  
  66.         bool  IsActive() const           { return m_terrain || m_staticObjects || m_staticObjects; }
  67.         float GetElasticity() const      { return m_elasticity; }
  68.         int   GetRayTraceFilter() const;
  69.  
  70. private:
  71.         template<typename TCollisionLimit>
  72.         void UpdateCollisionLimit(const SUpdateContext& context);
  73.  
  74.         UUnitFloat          m_elasticity;
  75.         ECollisionLimitMode m_collisionsLimitMode;
  76.         UBytePos            m_maxCollisions;
  77.         bool                m_terrain;
  78.         bool                m_staticObjects;
  79.         bool                m_dynamicObjects;
  80. };
  81.  
  82. //////////////////////////////////////////////////////////////////////////
  83. // CFeatureGPUCollision
  84.  
  85. class CFeatureGPUCollision : public CParticleFeature
  86. {
  87. public:
  88.         CRY_PFX2_DECLARE_FEATURE
  89.  
  90.         CFeatureGPUCollision()
  91.                 : CParticleFeature(gpu_pfx2::eGpuFeatureType_Collision)
  92.                 , m_offset(0.5f)
  93.                 , m_radius(0.5f)
  94.                 , m_restitution(0.5f)
  95.         {}
  96.  
  97.         virtual void AddToComponent(CParticleComponent* pComponent, SComponentParams* pParams) override;
  98.         virtual void Serialize(Serialization::IArchive& ar) override;
  99. private:
  100.         float m_offset;
  101.         float m_radius;
  102.         float m_restitution;
  103. };
  104.  
  105. }
  106.  
downloadFeatureCollision.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