BVB Source Codes

CRYENGINE Show ParticleMath.h Source code

Return Download CRYENGINE: download ParticleMath.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #pragma once
  4.  
  5. #include "ParticleCommon.h"
  6.  
  7. namespace pfx2
  8. {
  9.  
  10. using namespace crymath;
  11. // 4x vector types of standard types
  12. #ifdef CRY_PFX2_USE_SSE
  13. typedef f32v4  floatv;
  14. typedef u32v4  uint32v;
  15. typedef i32v4  int32v;
  16. typedef uint32 uint8v;
  17. typedef u32v4  UColv;
  18. #else
  19. typedef float  floatv;
  20. typedef uint32 uint32v;
  21. typedef int32  int32v;
  22. typedef uint8  uint8v;
  23. typedef UCol   UColv;
  24. #endif
  25.  
  26. // 4x vector types of custom types
  27. typedef uint32v           TParticleIdv;
  28. typedef uint32v           TEmitterIdv;
  29. typedef Vec2_tpl<floatv>  Vec2v;
  30. typedef Vec3_tpl<floatv>  Vec3v;
  31. typedef Vec4_tpl<floatv>  Vec4v;
  32. typedef Quat_tpl<floatv>  Quatv;
  33. typedef Plane_tpl<floatv> Planev;
  34.  
  35. #ifdef CRY_PFX2_USE_SSE
  36. struct ColorFv
  37. {
  38.         ColorFv() {}
  39.         ColorFv(floatv _r, floatv _g, floatv _b)
  40.                 : r(_r), g(_g), b(_b) {}
  41.         floatv r, g, b;
  42. };
  43. #else
  44. typedef ColorF ColorFv;
  45. #endif
  46.  
  47. ///////////////////////////////////////////////////////////////////////////
  48. // Vector/scalar conversions
  49.  
  50. floatv  ToFloatv(float v);
  51. uint32v ToUint32v(uint32 v);
  52. floatv  ToFloatv(int32v v);
  53. floatv  ToFloatv(uint32v v);
  54. uint32v ToUint32v(floatv v);
  55. Vec3v   ToVec3v(Vec3 v);
  56. Vec4v   ToVec4v(Vec4 v);
  57. Planev  ToPlanev(Plane v);
  58.  
  59. uint8  FloatToUFrac8Saturate(float v);
  60.  
  61. ///////////////////////////////////////////////////////////////////////////
  62. // General operator and function equivalents
  63. template<typename T, typename U> T ILINE Add(const T& a, const U& b)              { return a + b; }
  64. template<typename T, typename U> T ILINE Sub(const T& a, const U& b)              { return a - b; }
  65. template<typename T, typename U> T ILINE Mul(const T& a, const U& b)              { return a * b; }
  66.  
  67. template<typename T, typename U> T ILINE MAdd(const T& a, const U& b, const T& c) { return a * b + c; }
  68.  
  69. ///////////////////////////////////////////////////////////////////////////
  70. // Vectorized functions
  71.  
  72. float  HMin(floatv v0);
  73. float  HMax(floatv v0);
  74.  
  75. // Vector functions
  76.  
  77. Vec3v Add(const Vec3v& a, const floatv b);
  78. Vec3v Sub(const Vec3v& a, const floatv b);
  79.  
  80. Vec3  HMin(const Vec3v& v0);
  81. Vec3  HMax(const Vec3v& v0);
  82.  
  83. // Efficient vector MAdd
  84.  
  85. template<typename T> Vec3_tpl<T> MAdd(const Vec3_tpl<T>& a, const Vec3_tpl<T>& b, const Vec3_tpl<T>& c);
  86. template<typename T> Vec3_tpl<T> MAdd(const Vec3_tpl<T>& a, T b, const Vec3_tpl<T>& c);
  87.  
  88. // Quaternion functions
  89.  
  90. Quatv AddAngularVelocity(Quatv initial, Vec3v angularVel, floatv deltaTime);
  91.  
  92. // Color
  93.  
  94. ColorF  ToColorF(UCol color);
  95. ColorFv ToColorFv(UColv color);
  96. ColorFv ToColorFv(ColorF color);
  97. UCol    ColorFToUCol(const ColorF& color);
  98. UColv   ColorFvToUColv(const ColorFv& color);
  99. UColv   ToUColv(UCol color);
  100.  
  101. #ifdef CRY_PFX2_USE_SSE
  102. ColorFv operator+(const ColorFv& a, const ColorFv& b);
  103. ColorFv operator*(const ColorFv& a, const ColorFv& b);
  104. ColorFv operator*(const ColorFv& a, floatv b);
  105. #endif
  106.  
  107. // Special
  108. float  DeltaTime(float  normAge, float  frameTime);
  109. floatv DeltaTime(floatv normAge, floatv frameTime);
  110.  
  111. // non vectorized
  112.  
  113. void RotateAxes(Vec3* v0, Vec3* v1, const float angle);
  114. Vec3 PolarCoordToVec3(float azimuth, float altitude);
  115.  
  116. }
  117.  
  118. #include "ParticleMathImpl.h"
  119.  
downloadParticleMath.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