Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A set of utilities to render standard shapes
  4. //
  5. //===========================================================================//
  6. #ifndef RENDERUTILS_H
  7. #define RENDERUTILS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier2/tier2.h"
  12. #include "Color.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. class Vector;
  17. class QAngle;
  18. class IMaterial;
  19. struct matrix3x4_t;
  20. // Renders a wireframe sphere
  21. void RenderWireframeSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi, Color c, bool bZBuffer );
  22. // Renders a sphere
  23. void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi, Color c, bool bZBuffer );
  24. void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi, Color c, IMaterial *pMaterial );
  25. // Renders a wireframe box relative to an origin
  26. void RenderWireframeBox( const Vector &vOrigin, const QAngle& angles, const Vector &vMins, const Vector &vMaxs, Color c, bool bZBuffer );
  27. // Renders a swept wireframe box
  28. void RenderWireframeSweptBox( const Vector &vStart, const Vector &vEnd, const QAngle &angles, const Vector &vMins, const Vector &vMaxs, Color c, bool bZBuffer );
  29. // Renders a solid box
  30. void RenderBox( const Vector& origin, const QAngle& angles, const Vector& mins, const Vector& maxs, Color c, bool bZBuffer, bool bInsideOut = false );
  31. void RenderBox( const Vector& origin, const QAngle& angles, const Vector& mins, const Vector& maxs, Color c, IMaterial *pMaterial, bool bInsideOut = false );
  32. // Renders axes, red->x, green->y, blue->z (axis aligned)
  33. void RenderAxes( const Vector &vOrigin, float flScale, bool bZBuffer );
  34. void RenderAxes( const matrix3x4_t &transform, float flScale, bool bZBuffer );
  35. // Render a line
  36. void RenderLine( const Vector& v1, const Vector& v2, Color c, bool bZBuffer );
  37. // Draws a triangle
  38. void RenderTriangle( const Vector& p1, const Vector& p2, const Vector& p3, Color c, bool bZBuffer );
  39. void RenderTriangle( const Vector& p1, const Vector& p2, const Vector& p3, Color c, IMaterial *pMaterial );
  40. // Draws a axis-aligned quad
  41. void RenderQuad( IMaterial *pMaterial, float x, float y, float w, float h, float z, float s0, float t0, float s1, float t1, const Color& clr );
  42. // Renders a screen space quad
  43. void DrawScreenSpaceRectangle( IMaterial *pMaterial,
  44. int nDestX, int nDestY, int nWidth, int nHeight, // Rect to draw into in screen space
  45. float flSrcTextureX0, float flSrcTextureY0, // which texel you want to appear at destx/y
  46. float flSrcTextureX1, float flSrcTextureY1, // which texel you want to appear at destx+width-1, desty+height-1
  47. int nSrcTextureWidth, int nSrcTextureHeight, // needed for fixup
  48. void *pClientRenderable = NULL, // Used to pass to the bind proxies
  49. int nXDice = 1,
  50. int nYDice = 1,
  51. float fDepth = 0.0 ); // what Z value to put in the verts
  52. #endif // RENDERUTILS_H