BVB Source Codes

CRYENGINE Show AnimationBase.cpp Source code

Return Download CRYENGINE: download AnimationBase.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 "AnimationBase.h"
  5.  
  6. #include <CryAnimation/ICryAnimation.h>
  7. #include <CryAnimation/IFacialAnimation.h>
  8. #include "CharacterManager.h"
  9. #include "AnimEventLoader.h"
  10. #include "SkeletonAnim.h"
  11. #include "AttachmentSkin.h"
  12.  
  13. #include <CryCore/Platform/platform_impl.inl> // Must be included once in the module.
  14. #include <CrySystem/IEngineModule.h>
  15.  
  16. //////////////////////////////////////////////////////////////////////////
  17. struct CSystemEventListner_Animation : public ISystemEventListener
  18. {
  19. public:
  20.         virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam)
  21.         {
  22.                 switch (event)
  23.                 {
  24.                 case ESYSTEM_EVENT_LEVEL_UNLOAD:
  25.                         break;
  26.                 case ESYSTEM_EVENT_LEVEL_POST_UNLOAD:
  27.                         {
  28.                                 if (Memory::CPoolFrameLocal* pMemoryPool = CharacterInstanceProcessing::GetMemoryPool())
  29.                                 {
  30.                                         pMemoryPool->ReleaseBuckets();
  31.                                 }
  32.  
  33.                                 if (!gEnv->IsEditor())
  34.                                 {
  35.                                         delete g_pCharacterManager;
  36.                                         g_pCharacterManager = NULL;
  37.                                         gEnv->pCharacterManager = NULL;
  38.                                 }
  39.  
  40.                                 break;
  41.                         }
  42.                 case ESYSTEM_EVENT_3D_POST_RENDERING_START:
  43.                         {
  44.                                 if (!g_pCharacterManager)
  45.                                 {
  46.                                         g_pCharacterManager = new CharacterManager;
  47.                                         gEnv->pCharacterManager = g_pCharacterManager;
  48.                                 }
  49.                                 AnimEventLoader::SetPreLoadParticleEffects(false);
  50.                                 break;
  51.                         }
  52.                 case ESYSTEM_EVENT_3D_POST_RENDERING_END:
  53.                         {
  54.                                 if (Memory::CPoolFrameLocal* pMemoryPool = CharacterInstanceProcessing::GetMemoryPool())
  55.                                 {
  56.                                         pMemoryPool->ReleaseBuckets();
  57.                                 }
  58.  
  59.                                 SAFE_DELETE(g_pCharacterManager);
  60.                                 gEnv->pCharacterManager = NULL;
  61.                                 AnimEventLoader::SetPreLoadParticleEffects(true);
  62.                                 break;
  63.                         }
  64.                 case ESYSTEM_EVENT_LEVEL_LOAD_START:
  65.                         {
  66.                                 if (!g_pCharacterManager)
  67.                                 {
  68.                                         g_pCharacterManager = new CharacterManager;
  69.                                         gEnv->pCharacterManager = g_pCharacterManager;
  70.                                         gEnv->pCharacterManager->PostInit();
  71.                                 }
  72.                                 break;
  73.                         }
  74.                 }
  75.         }
  76. };
  77. static CSystemEventListner_Animation g_system_event_listener_anim;
  78.  
  79. //////////////////////////////////////////////////////////////////////////
  80. class CEngineModule_CryAnimation : public IEngineModule
  81. {
  82.         CRYINTERFACE_SIMPLE(IEngineModule)
  83.         CRYGENERATE_SINGLETONCLASS(CEngineModule_CryAnimation, "EngineModule_CryAnimation", 0x9c73d2cd142c4256, 0xa8f0706d80cd7ad2)
  84.  
  85.         virtual ~CEngineModule_CryAnimation() {}
  86.  
  87.         //////////////////////////////////////////////////////////////////////////
  88.         virtual const char* GetName() override { return "CryAnimation"; };
  89.         virtual const char* GetCategory() override { return "CryEngine"; };
  90.  
  91.         //////////////////////////////////////////////////////////////////////////
  92.         virtual bool Initialize(SSystemGlobalEnvironment& env, const SSystemInitParams& initParams) override
  93.         {
  94.                 ISystem* pSystem = env.pSystem;
  95.  
  96.                 if (!CharacterInstanceProcessing::InitializeMemoryPool())
  97.                         return false;
  98.  
  99.                 g_pISystem = pSystem;
  100.                 g_InitInterfaces();
  101.  
  102.                 if (!g_controllerHeap.IsInitialised())
  103.                         g_controllerHeap.Init(Console::GetInst().ca_MemoryDefragPoolSize);
  104.  
  105.                 pSystem->GetISystemEventDispatcher()->RegisterListener(&g_system_event_listener_anim);
  106.  
  107.                 g_pCharacterManager = NULL;
  108.                 env.pCharacterManager = NULL;
  109.                 if (gEnv->IsEditor())
  110.                 {
  111.                         g_pCharacterManager = new CharacterManager;
  112.                         gEnv->pCharacterManager = g_pCharacterManager;
  113.                 }
  114.  
  115.                 return true;
  116.         }
  117. };
  118.  
  119. CRYREGISTER_SINGLETON_CLASS(CEngineModule_CryAnimation)
  120.  
  121. // cached interfaces - valid during the whole session, when the character manager is alive; then get erased
  122. ISystem* g_pISystem = NULL;
  123. ITimer* g_pITimer = NULL;                     //module implemented in CrySystem
  124. ILog* g_pILog = NULL;                         //module implemented in CrySystem
  125. IConsole* g_pIConsole = NULL;                 //module implemented in CrySystem
  126. ICryPak* g_pIPak = NULL;                      //module implemented in CrySystem
  127. IStreamEngine* g_pIStreamEngine = NULL;       //module implemented in CrySystem
  128.  
  129. IRenderer* g_pIRenderer = NULL;
  130. IPhysicalWorld* g_pIPhysicalWorld = NULL;
  131. I3DEngine* g_pI3DEngine = NULL;               //Need just for loading of chunks. Should be part of CrySystem
  132.  
  133. f32 g_AverageFrameTime = 0;
  134. CAnimation g_DefaultAnim;
  135. CharacterManager* g_pCharacterManager;
  136. QuatT g_IdentityQuatT = QuatT(IDENTITY);
  137. int32 g_nRenderThreadUpdateID = 0;
  138. DynArray<string> g_DataMismatch;
  139. SParametricSamplerInternal* g_parametricPool = NULL;
  140. bool* g_usedParametrics = NULL;
  141. int32 g_totalParametrics = 0;
  142. uint32 g_DefaultTransitionInterpolationType = (uint32)CA_Interpolation_Type::QuadraticInOut;
  143. AABB g_IdentityAABB = AABB(ZERO, ZERO);
  144.  
  145. CControllerDefragHeap g_controllerHeap;
  146.  
  147. ILINE void g_LogToFile(const char* szFormat, ...)
  148. {
  149.         char szBuffer[2 * 1024];
  150.         va_list args;
  151.         va_start(args, szFormat);
  152.         cry_vsprintf(szBuffer, szFormat, args);
  153.         va_end(args);
  154.         g_pILog->LogToFile("%s", szBuffer);
  155. }
  156.  
  157. f32 g_fCurrTime = 0;
  158. bool g_bProfilerOn = false;
  159.  
  160. AnimStatisticsInfo g_AnimStatisticsInfo;
  161.  
  162. // TypeInfo implementations for CryAnimation
  163. #ifndef _LIB
  164.         #include <CryCore/Common_TypeInfo.h>
  165.         #include <Cry3DEngine/CGF/CGFContent_info.h>
  166. #endif
  167.  
downloadAnimationBase.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