2
0

linegrp.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Lingegroup.h *
  23. * *
  24. * $Archive:: /VSS_Sync/ww3d2/linegrp.h $*
  25. * *
  26. * Original Author:: Hector Yee *
  27. * *
  28. * $Author:: Vss_sync $*
  29. * *
  30. * $Modtime:: 10/26/01 3:12p $*
  31. * *
  32. * $Revision:: 1 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #if defined(_MSC_VER)
  38. #pragma once
  39. #endif
  40. #ifndef LINEGRP_H
  41. #define LINEGRP_H
  42. #include "shader.h"
  43. #include "vector4.h"
  44. #include "vector3.h"
  45. #include "vector2.h"
  46. class RenderInfoClass;
  47. class TextureClass;
  48. template <class T> class ShareBufferClass;
  49. /*
  50. ** LineGroupClass -- a custom object for rendering
  51. ** groups of lines (such as motion blurred particle systems).
  52. */
  53. class LineGroupClass
  54. {
  55. public:
  56. enum FlagsType {
  57. TRANSFORM, // transform points w. modelview matrix (worldspace points)
  58. };
  59. enum LineModeType {
  60. TETRAHEDRON,
  61. PRISM
  62. };
  63. LineGroupClass(void);
  64. virtual ~LineGroupClass(void);
  65. // LineGroupClass interface:
  66. void Set_Arrays(
  67. ShareBufferClass<Vector3> *startlocs,
  68. ShareBufferClass<Vector3> *endlocs,
  69. ShareBufferClass<Vector4> *diffuse = NULL,
  70. ShareBufferClass<Vector4> *taildiffuse = NULL,
  71. ShareBufferClass<unsigned int> *alt = NULL,
  72. ShareBufferClass<float> *sizes = NULL,
  73. ShareBufferClass<float> *ucoords = NULL,
  74. int active_line_count = -1
  75. );
  76. void Set_Line_Size(float size);
  77. float Get_Line_Size(void);
  78. void Set_Line_Color(const Vector3 &color);
  79. Vector3 Get_Line_Color(void);
  80. void Set_Tail_Diffuse(const Vector4 &tdiffuse);
  81. Vector4 Get_Tail_Diffuse(void);
  82. void Set_Line_Alpha(float alpha);
  83. float Get_Line_Alpha(void);
  84. void Set_Line_UCoord(float ucoord);
  85. float Get_Line_UCoord(void);
  86. void Set_Flag(FlagsType flag, bool on);
  87. int Get_Flag(FlagsType flag);
  88. void Set_Texture(TextureClass* texture);
  89. TextureClass * Get_Texture(void);
  90. TextureClass * Peek_Texture(void);
  91. void Set_Shader(const ShaderClass &shader);
  92. ShaderClass Get_Shader(void);
  93. void Set_Line_Mode(LineModeType linemode);
  94. LineModeType Get_Line_Mode(void);
  95. int Get_Polygon_Count(void);
  96. void Render(RenderInfoClass &rinfo);
  97. protected:
  98. ShareBufferClass<Vector3> * StartLineLoc; // World/cameraspace point locs
  99. ShareBufferClass<Vector3> * EndLineLoc; // World/cameraspace point locs
  100. ShareBufferClass<Vector4> * LineDiffuse; // (NULL if not used) RGBA values
  101. ShareBufferClass<Vector4> * TailDiffuse; // (NULL if not used) RGBA values
  102. ShareBufferClass<unsigned int> * ALT; // (NULL if not used) active line table
  103. ShareBufferClass<float> * LineSize; // (NULL if not used) size override table
  104. ShareBufferClass<float> * LineUCoord; // (NULL if not used) U coordinates
  105. int LineCount; // Active (if ALT) or total point count
  106. TextureClass* Texture;
  107. ShaderClass Shader; // (default created in CTor)
  108. // Internal state:
  109. unsigned int Flags; // operation control flags
  110. float DefaultLineSize; // Line size (size array overrides if present)
  111. Vector3 DefaultLineColor; // Line color (color array overrides if present)
  112. float DefaultLineAlpha; // Line alpha (alpha array overrides if present)
  113. float DefaultLineUCoord; // Line texture Ucoord (ucoord array overrides if present)
  114. Vector4 DefaultTailDiffuse; // Tail diffuse RGBA
  115. LineModeType LineMode;
  116. };
  117. #endif