BVB Source Codes

CRYENGINE Show AIDebugRenderer.h Source code

Return Download CRYENGINE: download AIDebugRenderer.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:   AIDebugRenderer.h
  6.    $Id$
  7.    Description: Helper functions to draw some interesting debug shapes.
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 2006-9-19   : Created (AIDebugDrawHelpers.h) by Mikko Mononen
  12.    - 2009-2-11   : Moved to CryAction by Evgeny Adamenkov
  13.  
  14.  *********************************************************************/
  15.  
  16. #ifndef _AI_DEBUG_RENDERER_H_
  17. #define _AI_DEBUG_RENDERER_H_
  18.  
  19. #if _MSC_VER > 1000
  20.         #pragma once
  21. #endif
  22.  
  23. #include <CryAISystem/IAIDebugRenderer.h>
  24.  
  25. #include <CryNetwork/ISerialize.h>
  26. #include <CryNetwork/NetHelpers.h>
  27.  
  28. #include <stack>
  29.  
  30. class CAIDebugRenderer : public IAIDebugRenderer
  31. {
  32. public:
  33.         CAIDebugRenderer(IRenderer* pRenderer);
  34.  
  35.         virtual float GetCameraFOV() { return m_pRenderer->GetCamera().GetFov(); }
  36.  
  37.         virtual Vec3  GetCameraPos();
  38.         virtual float GetDebugDrawZ(const Vec3& vPoint, bool bUseTerrainOrWater);
  39.  
  40.         virtual int   GetWidth()  { return m_pRenderer->GetWidth(); }
  41.         virtual int   GetHeight() { return m_pRenderer->GetHeight(); }
  42.  
  43.         virtual void  DrawAABB(const AABB& aabb, bool bSolid, const ColorB& color, const EBoundingBoxDrawStyle& bbDrawStyle);
  44.         virtual void  DrawAABB(const AABB& aabb, const Matrix34& matWorld, bool bSolid, const ColorB& color, const EBoundingBoxDrawStyle& bbDrawStyle);
  45.         virtual void  DrawArrow(const Vec3& vPos, const Vec3& vLength, float fWidth, const ColorB& color);
  46.         virtual void  DrawCapsuleOutline(const Vec3& vPos0, const Vec3& vPos1, float fRadius, const ColorB& color);
  47.         virtual void  DrawCircleOutline(const Vec3& vPos, float fRadius, const ColorB& color);
  48.         virtual void  DrawCircles(const Vec3& vPos,
  49.                                   float fMinRadius, float fMaxRadius, int numRings,
  50.                                   const ColorF& vInsideColor, const ColorF& vOutsideColor);
  51.         virtual void      DrawCone(const Vec3& vPos, const Vec3& vDir, float fRadius, float fHeight, const ColorB& color, bool fDrawShaded = true);
  52.         virtual void      DrawCylinder(const Vec3& vPos, const Vec3& vDir, float fRadius, float fHeight, const ColorB& color, bool bDrawShaded = true);
  53.         virtual void      DrawEllipseOutline(const Vec3& vPos, float fRadiusX, float fRadiusY, float fOrientation, const ColorB& color);
  54.         virtual void      Draw2dLabel(int nCol, int nRow, const char* szText, const ColorB& color);
  55.         virtual void      Draw2dLabel(float fX, float fY, float fFontSize, const ColorB& color, bool bCenter, const char* text, ...) PRINTF_PARAMS(7, 8);
  56.         virtual void      Draw2dLabelEx(float fX, float fY, float fFontSize, const ColorB& color, bool bFixedSize, bool bMonospace, bool bCenter, bool bFramed, const char* text, ...) PRINTF_PARAMS(10, 11);
  57.         virtual void      Draw3dLabel(Vec3 vPos, float fFontSize, const char* text, ...) PRINTF_PARAMS(4, 5);
  58.         virtual void      Draw3dLabelEx(Vec3 vPos, float fFontSize, const ColorB& color, bool bFixedSize, bool bCenter, bool bDepthTest, bool bFramed, const char* text, ...) PRINTF_PARAMS(9, 10);
  59.         virtual void      DrawLabel(Vec3 pos, SDrawTextInfo& ti, const char* text);
  60.         virtual void      Draw2dImage(float fX, float fY, float fWidth, float fHeight, int nTextureID, float fS0 = 0, float fT0 = 0, float fS1 = 1, float fT1 = 1, float fAngle = 0, float fR = 1, float fG = 1, float fB = 1, float fA = 1, float fZ = 1);
  61.         virtual void      DrawLine(const Vec3& v0, const ColorB& colorV0, const Vec3& v1, const ColorB& colorV1, float fThickness = 1.0f);
  62.         virtual void      DrawOBB(const OBB& obb, const Vec3& vPos, bool bSolid, const ColorB& color, const EBoundingBoxDrawStyle bbDrawStyle);
  63.         virtual void      DrawOBB(const OBB& obb, const Matrix34& matWorld, bool bSolid, const ColorB& color, const EBoundingBoxDrawStyle bbDrawStyle);
  64.         virtual void      DrawPolyline(const Vec3* va, uint32 nPoints, bool bClosed, const ColorB& color, float fThickness = 1.0f);
  65.         virtual void      DrawPolyline(const Vec3* va, uint32 nPoints, bool bClosed, const ColorB* colorArray, float fThickness = 1.0f);
  66.         virtual void      DrawRangeArc(const Vec3& vPos, const Vec3& vDir, float fAngle, float fRadius, float fWidth,
  67.                                        const ColorB& colorFill, const ColorB& colorOutline, bool bDrawOutline);
  68.         virtual void      DrawRangeBox(const Vec3& vPos, const Vec3& vDir, float fSizeX, float fSizeY, float fWidth,
  69.                                        const ColorB& colorFill, const ColorB& colorOutline, bool bDrawOutline);
  70.         virtual void      DrawRangeCircle(const Vec3& vPos, float fRadius, float fWidth,
  71.                                           const ColorB& colorFill, const ColorB& colorOutline, bool bDrawOutline);
  72.         virtual void      DrawRangePolygon(const Vec3 polygon[], int nVertices, float fWidth,
  73.                                            const ColorB& colorFill, const ColorB& colorOutline, bool bDrawOutline);
  74.         virtual void      DrawSphere(const Vec3& vPos, float fRadius, const ColorB& color, bool bDrawShaded = true);
  75.         virtual void      DrawTriangle(const Vec3& v0, const ColorB& colorV0, const Vec3& v1, const ColorB& colorV1, const Vec3& v2, const ColorB& colorV2);
  76.         virtual void      DrawTriangles(const Vec3* va, unsigned int numPoints, const ColorB& color);
  77.         virtual void      DrawWireFOVCone(const Vec3& vPos, const Vec3& vDir, float fRadius, float fFOV, const ColorB& color);
  78.         virtual void      DrawWireSphere(const Vec3& vPos, float fRadius, const ColorB& color);
  79.  
  80.         virtual ITexture* LoadTexture(const char* sNameOfTexture, uint32 nFlags);
  81.  
  82.         // [9/16/2010 evgeny] ProjectToScreen is not guaranteed to work if used outside Renderer
  83.         virtual bool         ProjectToScreen(float fInX, float fInY, float fInZ, float* fOutX, float* fOutY, float* fOutZ);
  84.  
  85.         virtual void         TextToScreen(float fX, float fY, const char* format, ...) PRINTF_PARAMS(4, 5);
  86.         virtual void         TextToScreenColor(int nX, int nY, float fRed, float fGreen, float fBlue, float fAlpha, const char* format, ...) PRINTF_PARAMS(8, 9);
  87.  
  88.         virtual void         Init2DMode();
  89.         virtual void         Init3DMode();
  90.  
  91.         virtual void         SetAlphaBlended(bool bOn);
  92.         virtual void         SetBackFaceCulling(bool bOn);
  93.         virtual void         SetDepthTest(bool bOn);
  94.         virtual void         SetDepthWrite(bool bOn);
  95.         virtual void         SetDrawInFront(bool bOn);
  96.  
  97.         virtual void         SetMaterialColor(float fRed, float fGreen, float fBlue, float fAlpha);
  98.  
  99.         virtual unsigned int PopState();
  100.         virtual unsigned int PushState();
  101.  
  102. private:
  103.         IRenderer*                      m_pRenderer;
  104.         IRenderAuxGeom*                 m_pRenderAuxGeom;
  105.  
  106.         std::stack<SAuxGeomRenderFlags> m_FlagsStack;
  107. };
  108.  
  109. class CAINetworkDebugRenderer : public CAIDebugRenderer, public CNetMessageSinkHelper<CAINetworkDebugRenderer, INetMessageSink>
  110. {
  111. public:
  112.         CAINetworkDebugRenderer(IRenderer* pRenderer) : CAIDebugRenderer(pRenderer) {}
  113.  
  114.         void DefineProtocol(IProtocolBuilder* pBuilder)
  115.         {
  116.                 pBuilder->AddMessageSink(this, GetProtocolDef(), GetProtocolDef());
  117.         }
  118. };
  119.  
  120. #endif  // #ifndef _AI_DEBUG_RENDERER_H_
  121.  
downloadAIDebugRenderer.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