Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
streak.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(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/*********************************************************************************
20 *** C O N F I D E N T I A L --- E A P A C I F I C ***
21 *********************************************************************************
22 * *
23 * Project Name : G *
24 * *
25 * $Archive:: ww3d2/streak.h $*
26 * *
27 * $Author:: Mark Lorenzen $*
28 * *
29 * $Modtime:: 8/6/02 4:09p $*
30 * *
31 * $Revision:: 1 $*
32 * *
33 *-------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#if defined(_MSC_VER)
38#pragma once
39#endif
40
41#ifndef STREAK_H
42#define STREAK_H
43
44#include "rendobj.h"
45#include "shader.h"
46#include "simplevec.h"
47#include "seglinerenderer.h"
48#include "streakrender.h"
49
50class TextureClass;
51
52/*
53** StreakLineClass -- a render object for rendering thick segmented lines.
54** essentially it is segmentedlineclass++
55** with added characteristics, such as varying thickness, opacity
56** color and precise texture tiling...
57** The reason this does not descend from segmentedlineclass, is to streamline
58** the upcoming merge with the LasVegas code (to keep our changes out of their code)
59*/
60
62{
63 public:
64
65 StreakLineClass(void);
68// virtual ~StreakLineClass(void);
69
70 void Reset_Line(void);
71
72 /*
73 ** StreakLineClass interface:
74 */
75
76 // These are segment points, and include the start and end point of the
77 // entire line. Therefore there must be at least two.
78 int Get_Num_Points(void);
79
80
81 // Set object-space location for a given point.
82 // NOTE: If given position beyond end of point list, do nothing.
83 void Set_Point_Location(unsigned int point_idx, const Vector3 &location);
84
85 // Get object-space location for a given point.
86 void Get_Point_Location(unsigned int point_idx, Vector3 &loc);
87
88 // Modify the line by adding and removing points
89 void Add_Point(const Vector3 & location);
90 void Delete_Point(unsigned int point_idx);
91
92 // Get/set global properties (which affect all line segments)
95
96 float Get_Width(void);
97 void Get_Color(Vector3 &color);
98 float Get_Opacity(void);
99 float Get_Noise_Amplitude(void);
100 float Get_Merge_Abort_Factor(void);
101 unsigned int Get_Subdivision_Levels(void);
103 float Get_Texture_Tile_Factor(void);
105 int Is_Merge_Intersections(void);
106 int Is_Freeze_Random(void);
107 int Is_Sorting_Disabled(void);
108 int Are_End_Caps_Enabled(void);
109
110 void Set_Texture(TextureClass *texture);
111 void Set_Shader(ShaderClass shader);
112 void Set_Width(float width);
113 void Set_Color(const Vector3 &color);
114 void Set_Opacity(float opacity);
115 void Set_Noise_Amplitude(float amplitude);
116 void Set_Merge_Abort_Factor(float factor);
117 void Set_Subdivision_Levels(unsigned int levels);
119 // WARNING! Do NOT set the tile factor to be too high (should be less than 8) or negative
120 //performance impact will result!
121 void Set_Texture_Tile_Factor(float factor);
122 void Set_UV_Offset_Rate(const Vector2 &rate);
123 void Set_Merge_Intersections(int onoff);
124 void Set_Freeze_Random(int onoff);
125 void Set_Disable_Sorting(int onoff);
126 void Set_End_Caps(int onoff);
127
129 // Render Object Interface - Cloning and Identification
131 virtual RenderObjClass * Clone(void) const;
132 virtual int Class_ID(void) const { return CLASSID_SEGLINE; }
133 virtual int Get_Num_Polys(void) const;
134
136 // Render Object Interface - Rendering
138 virtual void Render( RenderInfoClass & rinfo );
139
141 // Render Object Interface - Bounding Volumes
143 virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const;
144 virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const;
145
147 // Render Object Interface - Predictive LOD
149 virtual void Prepare_LOD(CameraClass &camera);
150 virtual void Increment_LOD(void);
151 virtual void Decrement_LOD(void);
152 virtual float Get_Cost(void) const;
153 virtual float Get_Value(void) const;
154 virtual float Get_Post_Increment_Value(void) const;
155 virtual void Set_LOD_Level(int lod);
156 virtual int Get_LOD_Level(void) const;
157 virtual int Get_LOD_Count(void) const;
158
160 // Render Object Interface - Attributes, Options, Properties, etc
162// virtual void Set_Texture_Reduction_Factor(float trf);
163
165 // Render Object Interface - Collision Detection
167 virtual bool Cast_Ray(RayCollisionTestClass & raytest);
168
169 void Set_LocsWidthsColors( unsigned int num_points,
170 Vector3 *locs,
171 float *widths = NULL,
172 Vector4 *colors = NULL,
173 unsigned int *personalities = NULL);
174
175
176 protected:
177
178 void Set_Locs(unsigned int num_points, Vector3 *locs);
179 void Set_Widths(unsigned int num_points, float *widths);
180 void Set_Colors(unsigned int num_points, Vector4 *colors);
181
182 void Render_Seg_Line(RenderInfoClass & rinfo);
184
185 private:
186
187 // Subdivision properties
188 unsigned int MaxSubdivisionLevels;
189
190
191 // per-particle seeds
192 unsigned int *Personalities;
193
194 // Normalized screen area - used for LOD purposes
195 float NormalizedScreenArea;
196
197 // Per-point location array
198 //ShareBufferClass<Vector3> *PointLocations;
199 SimpleDynVecClass<Vector3> PointLocations; // World/cameraspace point locs
200 SimpleDynVecClass<Vector4> PointColors; // RGBA
201 SimpleDynVecClass<float> PointWidths; // float line thickness
202
203
204
205
206
207 // LineRenderer, contains most of the line settings.
208 SegLineRendererClass LineRenderer;
209 StreakRendererClass StreakRenderer;//special, per-point alpha/color/size
210};
211
212
213
214
215
216
217
218
219
220#endif SEGLINE_H
#define NULL
Definition BaseType.h:92
RenderObjClass(void)
Definition rendobj.cpp:170
virtual void Increment_LOD(void)
Definition streak.cpp:564
virtual void Render(RenderInfoClass &rinfo)
Definition streak.cpp:433
void Set_Opacity(float opacity)
Definition streak.cpp:357
virtual int Get_LOD_Level(void) const
Definition streak.cpp:619
void Set_LocsWidthsColors(unsigned int num_points, Vector3 *locs, float *widths=NULL, Vector4 *colors=NULL, unsigned int *personalities=NULL)
Definition streak.cpp:163
void Set_Merge_Abort_Factor(float factor)
Definition streak.cpp:370
void Render_Streak_Line(RenderInfoClass &rinfo)
Definition streak.cpp:656
SegLineRendererClass::TextureMapMode Get_Texture_Mapping_Mode(void)
Definition streak.cpp:289
StreakLineClass & operator=(const StreakLineClass &that)
Definition streak.cpp:78
void Set_Merge_Intersections(int onoff)
Definition streak.cpp:397
virtual float Get_Cost(void) const
Definition streak.cpp:580
void Set_UV_Offset_Rate(const Vector2 &rate)
Definition streak.cpp:392
void Set_Freeze_Random(int onoff)
Definition streak.cpp:402
float Get_Width(void)
Definition streak.cpp:336
int Are_End_Caps_Enabled(void)
Definition streak.cpp:319
void Set_Color(const Vector3 &color)
Definition streak.cpp:351
float Get_Opacity(void)
Definition streak.cpp:269
void Add_Point(const Vector3 &location)
Definition streak.cpp:241
void Set_End_Caps(int onoff)
Definition streak.cpp:413
virtual int Class_ID(void) const
Definition streak.h:132
void Set_Locs(unsigned int num_points, Vector3 *locs)
Definition streak.cpp:120
virtual void Decrement_LOD(void)
Definition streak.cpp:573
float Get_Texture_Tile_Factor(void)
Definition streak.cpp:294
void Set_Disable_Sorting(int onoff)
Definition streak.cpp:408
virtual int Get_Num_Polys(void) const
Definition streak.cpp:427
void Set_Texture(TextureClass *texture)
Definition streak.cpp:324
void Set_Texture_Tile_Factor(float factor)
Definition streak.cpp:387
void Reset_Line(void)
Definition streak.cpp:105
void Set_Texture_Mapping_Mode(SegLineRendererClass::TextureMapMode mode)
Definition streak.cpp:382
unsigned int Get_Subdivision_Levels(void)
Definition streak.cpp:284
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
Definition streak.cpp:465
virtual float Get_Value(void) const
Definition streak.cpp:585
void Get_Color(Vector3 &color)
Definition streak.cpp:264
StreakLineClass(void)
Definition streak.cpp:58
int Is_Freeze_Random(void)
Definition streak.cpp:309
int Is_Merge_Intersections(void)
Definition streak.cpp:304
virtual float Get_Post_Increment_Value(void) const
Definition streak.cpp:597
TextureClass * Get_Texture(void)
Definition streak.cpp:254
virtual void Prepare_LOD(CameraClass &camera)
Definition streak.cpp:541
void Set_Width(float width)
Definition streak.cpp:341
void Set_Noise_Amplitude(float amplitude)
Definition streak.cpp:363
float Get_Merge_Abort_Factor(void)
Definition streak.cpp:279
virtual RenderObjClass * Clone(void) const
Definition streak.cpp:422
Vector2 Get_UV_Offset_Rate(void)
Definition streak.cpp:299
virtual void Set_LOD_Level(int lod)
Definition streak.cpp:611
void Set_Point_Location(unsigned int point_idx, const Vector3 &location)
Definition streak.cpp:222
int Get_Num_Points(void)
Definition streak.cpp:214
virtual int Get_LOD_Count(void) const
Definition streak.cpp:624
ShaderClass Get_Shader(void)
Definition streak.cpp:259
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition streak.cpp:476
void Set_Subdivision_Levels(unsigned int levels)
Definition streak.cpp:375
void Set_Colors(unsigned int num_points, Vector4 *colors)
Definition streak.cpp:149
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
Definition streak.cpp:694
void Set_Shader(ShaderClass shader)
Definition streak.cpp:330
void Get_Point_Location(unsigned int point_idx, Vector3 &loc)
Definition streak.cpp:232
void Delete_Point(unsigned int point_idx)
Definition streak.cpp:246
int Is_Sorting_Disabled(void)
Definition streak.cpp:314
void Set_Widths(unsigned int num_points, float *widths)
Definition streak.cpp:135
float Get_Noise_Amplitude(void)
Definition streak.cpp:274
void Render_Seg_Line(RenderInfoClass &rinfo)
Definition streak.cpp:636