BVB Source Codes

CRYENGINE Show AnimationBase.h Source code

Return Download CRYENGINE: download AnimationBase.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 <CryAnimation/ICryAnimation.h>
  6. #include "cvars.h"
  7. #include "AnimationManager.h"
  8.  
  9. // Angular utilities
  10. #define DEG2COS(a)   (crymath::cos((a) * (gf_PI / 180.0f)))
  11. #define COS2DEG(a)   (crymath::acos(a) * (180.0f / gf_PI))
  12. #define HCOS2RAD(a)  (crymath::acos(a) * 2.0f)
  13. #define DEG2HCOS(a)  (crymath::cos((a * 0.5f) * (gf_PI / 180.0f)))
  14. #define DEG2HSIN(a)  (crymath::sin((a * 0.5f) * (gf_PI / 180.0f)))
  15. #define HCOS2DEG(a)  (crymath::acos(a) * 2.0f * (180.0f / gf_PI))
  16.  
  17. #define APX_NUM_OF_CGA_ANIMATIONS (200) //to avoid unnecessary resizing of a dynamic array
  18. #define MAX_FEET_AMOUNT           (4)   //this is used for feetlock
  19.  
  20. #define MAX_EXEC_QUEUE            (0x8u)   //max anims in exec-queue
  21. #define NUM_CAF_FILES             (0x4000) //to avoid resizing in production mode
  22. #define NUM_AIM_FILES             (0x0400) //to avoid resizing in production mode
  23.  
  24. #define STORE_ANIMATION_NAMES
  25.  
  26. ILINE void g_LogToFile(const char* szFormat, ...) PRINTF_PARAMS(1, 2);
  27.  
  28. class CharacterManager;
  29.  
  30. struct ISystem;
  31. struct IConsole;
  32. struct ITimer;
  33. struct ILog;
  34. struct ICryPak;
  35. struct IStreamEngine;
  36.  
  37. struct IRenderer;
  38. struct IPhysicalWorld;
  39. struct I3DEngine;
  40. class CCamera;
  41. struct SParametricSamplerInternal;
  42.  
  43. //////////////////////////////////////////////////////////////////////////
  44. // There's only one ISystem in the process, just like there is one CharacterManager.
  45. // So this ISystem is kept in the global pointer and is initialized upon creation
  46. // of the CharacterManager and is valid until its destruction.
  47. // Upon destruction, it's NULLed. In any case, there must be no object needing it
  48. // after that since the animation system is only active when the Manager object is alive
  49. //////////////////////////////////////////////////////////////////////////
  50.  
  51. //global interfaces
  52. extern ISystem* g_pISystem;
  53. extern IConsole* g_pIConsole;
  54. extern ITimer* g_pITimer;
  55. extern ILog* g_pILog;
  56. extern ICryPak* g_pIPak;
  57. extern IStreamEngine* g_pIStreamEngine;
  58.  
  59. extern IRenderer* g_pIRenderer;
  60.  
  61. #define g_pAuxGeom gEnv->pRenderer->GetIRenderAuxGeom()
  62.  
  63. extern IPhysicalWorld* g_pIPhysicalWorld;
  64. extern I3DEngine* g_pI3DEngine;
  65.  
  66. extern bool g_bProfilerOn;
  67. extern f32 g_fCurrTime;
  68. extern f32 g_AverageFrameTime;
  69. extern CAnimation g_DefaultAnim;
  70. extern CharacterManager* g_pCharacterManager;
  71. extern QuatT g_IdentityQuatT;
  72. extern AABB g_IdentityAABB;
  73. extern int32 g_nRenderThreadUpdateID;
  74. extern DynArray<string> g_DataMismatch;
  75. extern SParametricSamplerInternal* g_parametricPool;
  76. extern bool* g_usedParametrics;
  77. extern int32 g_totalParametrics;
  78. extern uint32 g_DefaultTransitionInterpolationType;
  79.  
  80. #define g_AnimationManager g_pCharacterManager->GetAnimationManager()
  81.  
  82. // initializes the global values - just remembers the pointer to the system that will
  83. // be kept valid until deinitialization of the class (that happens upon destruction of the
  84. // CharacterManager instance). Also initializes the console variables
  85. ILINE void g_InitInterfaces()
  86. {
  87.         assert(g_pISystem);
  88.         g_pIConsole = gEnv->pConsole;
  89.         g_pITimer = gEnv->pTimer;
  90.         g_pILog = g_pISystem->GetILog();
  91.         g_pIPak = gEnv->pCryPak;
  92.         g_pIStreamEngine = g_pISystem->GetStreamEngine();
  93.  
  94.         //We initialize these pointers once here and then every frame in CharacterManager::Update()
  95.         g_pIRenderer = g_pISystem->GetIRenderer();
  96.         g_pIPhysicalWorld = g_pISystem->GetIPhysicalWorld();
  97.         g_pI3DEngine = g_pISystem->GetI3DEngine();
  98.  
  99.         Console::GetInst().Init();
  100. }
  101.  
  102. // de-initializes the Class - actually just NULLs the system pointer and deletes the variables
  103. ILINE void g_DeleteInterfaces()
  104. {
  105.         g_pISystem = NULL;
  106.         g_pITimer = NULL;
  107.         g_pILog = NULL;
  108.         g_pIConsole = NULL;
  109.         g_pIPak = NULL;
  110.         g_pIStreamEngine = NULL;
  111.         ;
  112.  
  113.         g_pIRenderer = NULL;
  114.         g_pIPhysicalWorld = NULL;
  115.         g_pI3DEngine = NULL;
  116. }
  117.  
  118. // Common single structure for time\memory statistics
  119. struct AnimStatisticsInfo
  120. {
  121.         int64 m_iDBASizes;
  122.         int64 m_iCAFSizes;
  123.         int64 m_iInstancesSizes;
  124.         int64 m_iModelsSizes;
  125.  
  126.         AnimStatisticsInfo() : m_iDBASizes(0), m_iCAFSizes(0), m_iInstancesSizes(0), m_iModelsSizes(0) {}
  127.  
  128.         void Clear()            { m_iDBASizes = 0; m_iCAFSizes = 0; m_iInstancesSizes = 0; m_iModelsSizes = 0;  }
  129.         // int - for convenient output to log
  130.         int  GetInstancesSize() { return (int)(m_iInstancesSizes - GetModelsSize() - m_iDBASizes - m_iCAFSizes); }
  131.         int  GetModelsSize()    { return (int)(m_iModelsSizes - m_iDBASizes - m_iCAFSizes); }
  132. };
  133. extern AnimStatisticsInfo g_AnimStatisticsInfo;
  134.  
  135. #define ENABLE_GET_MEMORY_USAGE 1
  136.  
  137. #ifndef AUTO_PROFILE_SECTION
  138.         #pragma message ("Warning: ITimer not included")
  139. #else
  140.         #undef AUTO_PROFILE_SECTION
  141. #endif
  142.  
  143. #define AUTO_PROFILE_SECTION(g_fTimer) CITimerAutoProfiler<double> __section_auto_profiler(g_pITimer, g_fTimer)
  144.  
  145. #define DEFINE_PROFILER_FUNCTION()     FUNCTION_PROFILER(g_pISystem, PROFILE_ANIMATION)
  146. #define DEFINE_PROFILER_SECTION(NAME)  FRAME_PROFILER(NAME, g_pISystem, PROFILE_ANIMATION)
  147.  
downloadAnimationBase.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