BVB Source Codes

CRYENGINE Show VehicleUtils.h Source code

Return Download CRYENGINE: download VehicleUtils.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: Implements several utility functions for vehicles
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.  
  12. *************************************************************************/
  13. #ifndef __VEHICLEUTILS_H__
  14. #define __VEHICLEUTILS_H__
  15.  
  16. #if _MSC_VER > 1000
  17.         #pragma once
  18. #endif
  19.  
  20. #include "IVehicleSystem.h"
  21. #include "VehicleCVars.h"
  22.  
  23. class CVehiclePartAnimated;
  24.  
  25. // this enables (soft) NAN-checking
  26. #ifdef _DEBUG
  27.         #define VEHICLE_VALIDATE_MATH
  28. #endif
  29.  
  30. // validation functions
  31. #ifndef VEHICLE_VALIDATE_MATH
  32.         #define VALIDATE_VEC(a)  a
  33.         #define VALIDATE_MAT(a)  a
  34.         #define VALIDATE_AABB(a) a
  35. #else
  36.         #define VALIDATE_VEC(a)  VehicleUtils::ValidateVec(a)
  37.         #define VALIDATE_MAT(a)  VehicleUtils::ValidateMat(a)
  38.         #define VALIDATE_AABB(a) VehicleUtils::ValidateAABB(a)
  39. #endif
  40.  
  41. namespace VehicleUtils
  42. {
  43. inline const Vec3& ValidateVec(const Vec3& vec)
  44. {
  45.         CRY_ASSERT(!_isnan(vec.x + vec.y + vec.z));
  46.         return vec;
  47. }
  48.  
  49. inline const AABB& ValidateAABB(const AABB& aabb)
  50. {
  51.         ValidateVec(aabb.min);
  52.         ValidateVec(aabb.max);
  53.  
  54.         return aabb;
  55. }
  56.  
  57. inline const Matrix34& ValidateMat(const Matrix34& mat)
  58. {
  59.         for (int i = 0; i < 4; ++i)
  60.                 ValidateVec(mat.GetColumn(i));
  61.  
  62.         if (!mat.IsOrthonormal())
  63.         {
  64.                 CryLog("[VehicleUtils]: !IsOrthonormal");
  65.         }
  66.         return mat;
  67. }
  68.  
  69. inline void LogVector(const Vec3& v)
  70. {
  71.         CryLog("%.2f %.2f %.2f", v.x, v.y, v.z);
  72. }
  73.  
  74. inline void LogMatrix(const char* label, const Matrix34& tm)
  75. {
  76. #if ENABLE_VEHICLE_DEBUG
  77.         if (VehicleCVars().v_debugdraw < eVDB_Parts)
  78.                 return;
  79.  
  80.         CryLog("<%s>", label);
  81.         LogVector(tm.GetColumn(0));
  82.         LogVector(tm.GetColumn(1));
  83.         LogVector(tm.GetColumn(2));
  84.         LogVector(tm.GetColumn(3));
  85.         CryLog("----------------");
  86. #endif
  87. }
  88.  
  89. void DumpDamageBehaviorEvent(const SVehicleDamageBehaviorEventParams& params);
  90. void DrawTM(const Matrix34& tm, const char* name = "VehicleUtils", bool clear = false);
  91.  
  92. void DumpSlots(IVehicle* pVehicle);
  93.  
  94. }
  95.  
  96. #endif //__VEHICLEUTILS_H__
  97.  
downloadVehicleUtils.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