BVB Source Codes

CRYENGINE Show Controller.h Source code

Return Download CRYENGINE: download Controller.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. #define ANIMATION_30Hz (30.0f) //> Animation framerate is currently hard-coded to 30fps.
  6. #define TICKS_CONVERT  (160)   //> A helper macro for converting 3ds Max 'ticks' (1/4800[s]) present in certain legacy assets to the hard-coded 30fps framerate (160 * 1/4800s == 1/30[s]).
  7.  
  8. enum EJointState
  9. {
  10.         eJS_Position    = (1 << 0),
  11.         eJS_Orientation = (1 << 1),
  12.         eJS_Scale       = (1 << 2),
  13. };
  14.  
  15. typedef uint8 JointState;
  16.  
  17. //////////////////////////////////////////////////////////////////////////////////////////
  18. // interface IController
  19. // Describes the position and orientation of an object, changing in time.
  20. // Responsible for loading itself from a binary file, calculations
  21. //////////////////////////////////////////////////////////////////////////////////////////
  22. class IController : public _i_reference_target_t
  23. {
  24.  
  25. public:
  26.         // each controller has an ID, by which it is identifiable
  27.         uint32 m_nControllerId;
  28.  
  29.         uint32 GetID() const { return m_nControllerId; }
  30.  
  31.         // returns the orientation,position and scaling of the controller at the given time
  32.         virtual JointState GetOPS(f32 key, Quat& quat, Vec3& pos, Diag33& scale) const = 0;
  33.         // returns the orientation and position of the controller at the given time
  34.         virtual JointState GetOP(f32 key, Quat& quat, Vec3& pos) const = 0;
  35.  
  36.         // returns the orientation of the controller at the given time
  37.         virtual JointState GetO(f32 key, Quat& quat) const = 0;
  38.         // returns position of the controller at the given time
  39.         virtual JointState GetP(f32 key, Vec3& pos) const = 0;
  40.         // returns scale of the controller at the given time
  41.         virtual JointState GetS(f32 key, Diag33& scl) const = 0;
  42.  
  43.         virtual int32      GetO_numKey() const { return -1; } //only implemented for the PQ controller
  44.         virtual int32      GetP_numKey() const { return -1; } //only implemented for the PQ controller
  45.  
  46.         virtual size_t     GetRotationKeysNum() const = 0;
  47.         virtual size_t     GetPositionKeysNum() const = 0;
  48.         virtual size_t     GetScaleKeysNum() const = 0;
  49.  
  50.         virtual size_t     SizeOfController() const = 0;
  51.         virtual size_t     ApproximateSizeOfThis() const = 0;
  52. };
  53.  
  54. TYPEDEF_AUTOPTR(IController);
  55.  
  56. // adjusts the rotation of these PQs: if necessary, flips them or one of them (effectively NOT changing the whole rotation,but
  57. // changing the rotation angle to Pi-X and flipping the rotation axis simultaneously)
  58. // this is needed for blending between animations represented by quaternions rotated by ~PI in quaternion space
  59. // (and thus ~2*PI in real space)
  60. extern void AdjustLogRotations(Vec3& vRotLog1, Vec3& vRotLog2);
  61.  
  62. //////////////////////////////////////////////////////////////////////////
  63. // This class is a non-trivial predicate used for sorting an
  64. // ARRAY OF smart POINTERS  to IController's. That's why I need a separate
  65. // predicate class for that. Also, to avoid multiplying predicate classes,
  66. // there are a couple of functions that are also used to find a IController
  67. // in a sorted by ID array of IController* pointers, passing only ID to the
  68. // lower_bound function instead of creating and passing a dummy IController*
  69. class AnimCtrlSortPred
  70. {
  71. public:
  72.         bool operator()(const IController_AutoPtr& a, const IController_AutoPtr& b) { assert(a != (IController*)NULL && b != (IController*)NULL); return a->GetID() < b->GetID(); }
  73. };
  74.  
  75. class AnimCtrlSortPredInt
  76. {
  77. public:
  78.         bool operator()(const IController* a, uint32 nID) { assert(a != (IController*)NULL); return a->GetID() < nID; }
  79.         bool operator()(uint32 nID, const IController* b) { assert(b != (IController*)NULL); return nID < b->GetID(); }
  80. };
  81.  
downloadController.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