BVB Source Codes

CRYENGINE Show PathMarker.h Source code

Return Download CRYENGINE: download PathMarker.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /********************************************************************
  4.    -------------------------------------------------------------------------
  5.    File name:   PathMarker.h
  6.  
  7.    Description: CPathMarker contains the history of a given moving point (i.e. an entity position)
  8.    and can return a previous position (interpolated) given the distance from the current point
  9.    computed along the path
  10.  
  11.    (MATT) Used only by CFormation {2009/06/04}
  12.  
  13.    -------------------------------------------------------------------------
  14.    History:
  15.    - 17:11:2004   14:23 : Created by Luciano Morpurgo
  16.  
  17.  *********************************************************************/
  18.  
  19. #ifndef __PathMarker_H__
  20. #define __PathMarker_H__
  21.  
  22. #if _MSC_VER > 1000
  23.         #pragma once
  24. #endif
  25.  
  26. #include <CryAISystem/IAgent.h>
  27. #include <vector>
  28.  
  29. struct CSteeringDebugInfo
  30. {
  31.         std::vector<Vec3> pts;
  32.         Vec3              segStart, segEnd;
  33. };
  34.  
  35. struct pathStep_t
  36. {
  37.         Vec3  vPoint;
  38.         float fDistance;
  39.         bool  bPassed;
  40.  
  41.         pathStep_t() :
  42.                 vPoint(ZERO),
  43.                 fDistance(0.f),
  44.                 bPassed(false)
  45.         {
  46.         }
  47. };
  48.  
  49. class CPathMarker
  50. {
  51. private:
  52.         std::vector<pathStep_t> m_cBuffer; //using vector instead of deque as a FIFO, optimizing memory allocation and speed
  53.         float                   m_fStep;
  54.         int                     m_iCurrentPoint;
  55.         int                     m_iSize;
  56.         int                     m_iUsed;
  57.         float                   m_fTotalDistanceRun;
  58. public:
  59.         CPathMarker(float fMaxDistanceNeeded, float fStep);
  60.         void Init(const Vec3& vInitPoint, const Vec3& vEndPoint);
  61.         Vec3 GetPointAtDistance(const Vec3& vNewPoint, float fDistance) const;
  62.         Vec3 GetPointAtDistanceFromNewestPoint(float fDistanceFromNewestPoint) const;   // returns a point that is at most fDistanceFromNewestPoint meters away from the head (latest) point (clamped to [head, tail] point)
  63.         Vec3 GetDirectionAtDistance(const Vec3& vTargetPoint, float fDesiredDistance) const;
  64.         Vec3 GetDirectionAtDistanceFromNewestPoint(float fDistanceFromNewestPoint) const;
  65.         Vec3 GetMoveDirectionAtDistance(Vec3& vTargetPoint, float fDesiredDistance,
  66.                                         const Vec3& vUserPos, float falloff,
  67.                                         float* alignmentWithPath,
  68.                                         CSteeringDebugInfo* debugInfo);
  69.         float        GetDistanceToPoint(Vec3& vTargetPoint, Vec3& vMyPoint);
  70.         inline float GetTotalDistanceRun() { return m_fTotalDistanceRun; }
  71.         void         Update(const Vec3& vNewPoint, bool b2D = false);
  72.         size_t       GetPointCount() const { return m_cBuffer.size(); }
  73.         void         DebugDraw();
  74.         void         Serialize(TSerialize ser);
  75.  
  76. };
  77.  
  78. #endif // __PathMarker_H__
  79.  
downloadPathMarker.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