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.

170 lines
5.7 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $NoKeywords: $
  7. //===========================================================================//
  8. #if !defined( IVIEWRENDER_BEAMS_H )
  9. #define IVIEWRENDER_BEAMS_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "mathlib/vector.h"
  14. // common to server, too
  15. #include "beam_flags.h"
  16. #include "tempentity.h"
  17. extern void SetBeamCreationAllowed( bool state );
  18. extern bool BeamCreationAllowed( void );
  19. //-----------------------------------------------------------------------------
  20. // beam flags
  21. //-----------------------------------------------------------------------------
  22. class C_Beam;
  23. class Beam_t;
  24. //-----------------------------------------------------------------------------
  25. // Purpose: Popcorn trail for Beam Follow rendering...
  26. //-----------------------------------------------------------------------------
  27. struct BeamTrail_t
  28. {
  29. // NOTE: Don't add user defined fields except after these four fields.
  30. BeamTrail_t* next;
  31. float die;
  32. Vector org;
  33. Vector vel;
  34. };
  35. //-----------------------------------------------------------------------------
  36. // Data type for beams.
  37. //-----------------------------------------------------------------------------
  38. struct BeamInfo_t
  39. {
  40. int m_nType;
  41. // Entities
  42. C_BaseEntity* m_pStartEnt;
  43. int m_nStartAttachment;
  44. C_BaseEntity* m_pEndEnt;
  45. int m_nEndAttachment;
  46. // Points
  47. Vector m_vecStart;
  48. Vector m_vecEnd;
  49. int m_nModelIndex;
  50. const char *m_pszModelName;
  51. int m_nHaloIndex;
  52. const char *m_pszHaloName;
  53. float m_flHaloScale;
  54. float m_flLife;
  55. float m_flWidth;
  56. float m_flEndWidth;
  57. float m_flFadeLength;
  58. float m_flAmplitude;
  59. float m_flBrightness;
  60. float m_flSpeed;
  61. int m_nStartFrame;
  62. float m_flFrameRate;
  63. float m_flRed;
  64. float m_flGreen;
  65. float m_flBlue;
  66. bool m_bRenderable;
  67. int m_nSegments;
  68. int m_nFlags;
  69. // Rings
  70. Vector m_vecCenter;
  71. float m_flStartRadius;
  72. float m_flEndRadius;
  73. BeamInfo_t()
  74. {
  75. m_nType = TE_BEAMPOINTS;
  76. m_nSegments = -1;
  77. m_pszModelName = NULL;
  78. m_pszHaloName = NULL;
  79. m_nModelIndex = -1;
  80. m_nHaloIndex = -1;
  81. m_bRenderable = true;
  82. m_nFlags = 0;
  83. }
  84. };
  85. //-----------------------------------------------------------------------------
  86. // Purpose: Declare client .dll beam entity interface
  87. //-----------------------------------------------------------------------------
  88. abstract_class IViewRenderBeams
  89. {
  90. public:
  91. virtual void InitBeams( void ) = 0;
  92. virtual void ShutdownBeams( void ) = 0;
  93. virtual void ClearBeams( void ) = 0;
  94. // Updates the state of the temp ent beams
  95. virtual void UpdateTempEntBeams() = 0;
  96. virtual void DrawBeam( C_Beam* pbeam, const RenderableInstance_t &instance, ITraceFilter *pEntityBeamTraceFilter = NULL ) = 0;
  97. virtual void DrawBeam( Beam_t *pbeam ) = 0;
  98. virtual void KillDeadBeams( CBaseEntity *pEnt ) = 0;
  99. // New interfaces!
  100. virtual Beam_t *CreateBeamEnts( BeamInfo_t &beamInfo ) = 0;
  101. virtual Beam_t *CreateBeamEntPoint( BeamInfo_t &beamInfo ) = 0;
  102. virtual Beam_t *CreateBeamPoints( BeamInfo_t &beamInfo ) = 0;
  103. virtual Beam_t *CreateBeamRing( BeamInfo_t &beamInfo ) = 0;
  104. virtual Beam_t *CreateBeamRingPoint( BeamInfo_t &beamInfo ) = 0;
  105. virtual Beam_t *CreateBeamCirclePoints( BeamInfo_t &beamInfo ) = 0;
  106. virtual Beam_t *CreateBeamFollow( BeamInfo_t &beamInfo ) = 0;
  107. virtual void FreeBeam( Beam_t *pBeam ) = 0;
  108. virtual void UpdateBeamInfo( Beam_t *pBeam, BeamInfo_t &beamInfo ) = 0;
  109. // These will go away!
  110. virtual void CreateBeamEnts( int startEnt, int endEnt, int modelIndex, int haloIndex, float haloScale,
  111. float life, float width, float m_nEndWidth, float m_nFadeLength, float amplitude,
  112. float brightness, float speed, int startFrame,
  113. float framerate, float r, float g, float b, int type = -1 ) = 0;
  114. virtual void CreateBeamEntPoint( int nStartEntity, const Vector *pStart, int nEndEntity, const Vector* pEnd,
  115. int modelIndex, int haloIndex, float haloScale,
  116. float life, float width, float m_nEndWidth, float m_nFadeLength, float amplitude,
  117. float brightness, float speed, int startFrame,
  118. float framerate, float r, float g, float b ) = 0;
  119. virtual void CreateBeamPoints( Vector& start, Vector& end, int modelIndex, int haloIndex, float haloScale,
  120. float life, float width, float m_nEndWidth, float m_nFadeLength, float amplitude,
  121. float brightness, float speed, int startFrame,
  122. float framerate, float r, float g, float b ) = 0;
  123. virtual void CreateBeamRing( int startEnt, int endEnt, int modelIndex, int haloIndex, float haloScale,
  124. float life, float width, float m_nEndWidth, float m_nFadeLength, float amplitude,
  125. float brightness, float speed, int startFrame,
  126. float framerate, float r, float g, float b, int flags = 0 ) = 0;
  127. virtual void CreateBeamRingPoint( const Vector& center, float start_radius, float end_radius, int modelIndex, int haloIndex, float haloScale,
  128. float life, float width, float m_nEndWidth, float m_nFadeLength, float amplitude,
  129. float brightness, float speed, int startFrame,
  130. float framerate, float r, float g, float b, int flags = 0 ) = 0;
  131. virtual void CreateBeamCirclePoints( int type, Vector& start, Vector& end,
  132. int modelIndex, int haloIndex, float haloScale, float life, float width,
  133. float m_nEndWidth, float m_nFadeLength, float amplitude, float brightness, float speed,
  134. int startFrame, float framerate, float r, float g, float b ) = 0;
  135. virtual void CreateBeamFollow( int startEnt, int modelIndex, int haloIndex, float haloScale,
  136. float life, float width, float m_nEndWidth, float m_nFadeLength, float r, float g, float b,
  137. float brightness ) = 0;
  138. };
  139. extern IViewRenderBeams *beams;
  140. #endif // VIEWRENDER_BEAMS_H