Counter Strike : Global Offensive Source Code
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.

164 lines
5.7 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #if !defined( BEAMDRAW_H )
  8. #define BEAMDRAW_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "materialsystem/imaterial.h"
  13. #include "materialsystem/imesh.h"
  14. #include "mathlib/vector.h"
  15. #include "tier2/beamsegdraw.h"
  16. #include "c_pixel_visibility.h"
  17. #define NOISE_DIVISIONS 128
  18. //-----------------------------------------------------------------------------
  19. // Forward declarations
  20. //-----------------------------------------------------------------------------
  21. struct model_t;
  22. struct BeamTrail_t;
  23. //-----------------------------------------------------------------------------
  24. // Purpose: Beams fill out this data structure
  25. // This is also used for rendering
  26. //-----------------------------------------------------------------------------
  27. class Beam_t : public CDefaultClientRenderable
  28. {
  29. public:
  30. Beam_t();
  31. // Methods of IClientRenderable
  32. virtual const Vector& GetRenderOrigin( void );
  33. virtual const QAngle& GetRenderAngles( void );
  34. virtual const matrix3x4_t &RenderableToWorldTransform();
  35. virtual void GetRenderBounds( Vector& mins, Vector& maxs );
  36. virtual bool ShouldDraw( void );
  37. virtual int DrawModel( int flags, const RenderableInstance_t &instance );
  38. // Resets the beam state
  39. void Reset();
  40. // Method to computing the bounding box
  41. void ComputeBounds();
  42. // Bounding box...
  43. Vector m_Mins;
  44. Vector m_Maxs;
  45. pixelvis_handle_t *m_queryHandleHalo;
  46. float m_haloProxySize;
  47. // Data is below..
  48. // Next beam in list
  49. Beam_t* next;
  50. // Type of beam
  51. int type;
  52. int flags;
  53. // Control points for the beam
  54. int numAttachments;
  55. Vector attachment[MAX_BEAM_ENTS];
  56. Vector delta;
  57. // 0 .. 1 over lifetime of beam
  58. float t;
  59. float freq;
  60. // Time when beam should die
  61. float die;
  62. float width;
  63. float endWidth;
  64. float fadeLength;
  65. float amplitude;
  66. float life;
  67. // Color
  68. float r, g, b;
  69. float brightness;
  70. // Speed
  71. float speed;
  72. // Animation
  73. float frameRate;
  74. float frame;
  75. int segments;
  76. // Attachment entities for the beam
  77. EHANDLE entity[MAX_BEAM_ENTS];
  78. int attachmentIndex[MAX_BEAM_ENTS];
  79. // Model info
  80. int modelIndex;
  81. int haloIndex;
  82. float haloScale;
  83. int frameCount;
  84. float rgNoise[NOISE_DIVISIONS+1];
  85. // Popcorn trail for beam follows to use
  86. BeamTrail_t* trail;
  87. // for TE_BEAMRINGPOINT
  88. float start_radius;
  89. float end_radius;
  90. // for FBEAM_ONLYNOISEONCE
  91. bool m_bCalculatedNoise;
  92. float m_flHDRColorScale;
  93. };
  94. int ScreenTransform( const Vector& point, Vector& screen );
  95. void DrawSegs( int noise_divisions, float *prgNoise, const model_t* spritemodel,
  96. float frame, int rendermode, const Vector& source, const Vector& delta,
  97. float startWidth, float endWidth, float scale, float freq, float speed, int segments,
  98. int flags, float* color, float fadeLength, float flHDRColorScale = 1.0f );
  99. void DrawTeslaSegs( int noise_divisions, float *prgNoise, const model_t* spritemodel,
  100. float frame, int rendermode, const Vector& source, const Vector& delta,
  101. float startWidth, float endWidth, float scale, float freq, float speed, int segments,
  102. int flags, float* color, float fadeLength, float flHDRColorScale = 1.0f );
  103. void DrawSplineSegs( int noise_divisions, float *prgNoise,
  104. const model_t* beammodel, const model_t* halomodel, float flHaloScale,
  105. float frame, int rendermode, int numAttachments, Vector* attachment,
  106. float startWidth, float endWidth, float scale, float freq, float speed, int segments,
  107. int flags, float* color, float fadeLength, float flHDRColorScale = 1.0f );
  108. void DrawHalo(IMaterial* pMaterial, const Vector& source, float scale, float const* color, float flHDRColorScale = 1.0f );
  109. void BeamDrawHalo( const model_t* spritemodel, float frame, int rendermode, const Vector& source,
  110. float scale, float* color, float flHDRColorScale = 1.0f );
  111. void DrawDisk( int noise_divisions, float *prgNoise, const model_t* spritemodel,
  112. float frame, int rendermode, const Vector& source, const Vector& delta,
  113. float width, float scale, float freq, float speed,
  114. int segments, float* color, float flHDRColorScale = 1.0f );
  115. void DrawCylinder( int noise_divisions, float *prgNoise, const model_t* spritemodel,
  116. float frame, int rendermode, const Vector& source,
  117. const Vector& delta, float width, float scale, float freq,
  118. float speed, int segments, float* color, float flHDRColorScale = 1.0f );
  119. void DrawRing( int noise_divisions, float *prgNoise, void (*pfnNoise)( float *noise, int divs, float scale ),
  120. const model_t* spritemodel, float frame, int rendermode,
  121. const Vector& source, const Vector& delta, float width, float amplitude,
  122. float freq, float speed, int segments, float* color, float flHDRColorScale = 1.0f );
  123. void DrawBeamFollow( const model_t* spritemodel, BeamTrail_t* pHead, int frame, int rendermode, Vector& delta,
  124. Vector& screen, Vector& screenLast, float die, const Vector& source,
  125. int flags, float width, float amplitude, float freq, float* color, float flHDRColorScale = 1.0f );
  126. void DrawBeamQuadratic( const Vector &start, const Vector &control, const Vector &end, float width, const Vector &color, float scrollOffset, float flHDRColorScale = 1.0f );
  127. class CEngineSprite *Draw_SetSpriteTexture( const model_t *pSpriteModel, int frame, int rendermode );
  128. //-----------------------------------------------------------------------------
  129. // Assumes the material has already been bound
  130. //-----------------------------------------------------------------------------
  131. void DrawSprite( const Vector &vecOrigin, float flWidth, float flHeight, color32 color );
  132. #endif // BEAMDRAW_H