Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
segline.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 --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : G *
24 * *
25 * $Archive:: /Commando/Code/ww3d2/segline.h $*
26 * *
27 * $Author:: Greg_h $*
28 * *
29 * $Modtime:: 6/13/01 4:09p $*
30 * *
31 * $Revision:: 12 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#if defined(_MSC_VER)
38#pragma once
39#endif
40
41#ifndef SEGLINE_H
42#define SEGLINE_H
43
44#include "rendobj.h"
45#include "shader.h"
46#include "simplevec.h"
47#include "seglinerenderer.h"
48
49
50class TextureClass;
51
52/*
53** SegmentedLineClass -- a render object for rendering thick segmented lines.
54*/
56{
57 public:
58
62 virtual ~SegmentedLineClass(void);
63
64 void Reset_Line(void);
65
66 /*
67 ** SegmentedLineClass interface:
68 */
69
70 // These are segment points, and include the start and end point of the
71 // entire line. Therefore there must be at least two.
72 void Set_Points(unsigned int num_points, Vector3 *locs);
73 int Get_Num_Points(void);
74
75 // Set object-space location for a given point.
76 // NOTE: If given position beyond end of point list, do nothing.
77 void Set_Point_Location(unsigned int point_idx, const Vector3 &location);
78
79 // Get object-space location for a given point.
80 void Get_Point_Location(unsigned int point_idx, Vector3 &loc);
81
82 // Modify the line by adding and removing points
83 void Add_Point(const Vector3 & location);
84 void Delete_Point(unsigned int point_idx);
85
86 // Get/set global properties (which affect all line segments)
89
90 float Get_Width(void);
91 void Get_Color(Vector3 &color);
92 float Get_Opacity(void);
93 float Get_Noise_Amplitude(void);
94 float Get_Merge_Abort_Factor(void);
95 unsigned int Get_Subdivision_Levels(void);
97 float Get_Texture_Tile_Factor(void);
99 int Is_Merge_Intersections(void);
100 int Is_Freeze_Random(void);
101 int Is_Sorting_Disabled(void);
102 int Are_End_Caps_Enabled(void);
103
104 void Set_Texture(TextureClass *texture);
105 void Set_Shader(ShaderClass shader);
106 void Set_Width(float width);
107 void Set_Color(const Vector3 &color);
108 void Set_Opacity(float opacity);
109 void Set_Noise_Amplitude(float amplitude);
110 void Set_Merge_Abort_Factor(float factor);
111 void Set_Subdivision_Levels(unsigned int levels);
113 // WARNING! Do NOT set the tile factor to be too high (should be less than 8) or negative
114 //performance impact will result!
115 void Set_Texture_Tile_Factor(float factor);
116 void Set_UV_Offset_Rate(const Vector2 &rate);
117 void Set_Merge_Intersections(int onoff);
118 void Set_Freeze_Random(int onoff);
119 void Set_Disable_Sorting(int onoff);
120 void Set_End_Caps(int onoff);
121
123 // Render Object Interface - Cloning and Identification
125 virtual RenderObjClass * Clone(void) const;
126 virtual int Class_ID(void) const { return CLASSID_SEGLINE; }
127 virtual int Get_Num_Polys(void) const;
128
130 // Render Object Interface - Rendering
132 virtual void Render(RenderInfoClass & rinfo);
133
135 // Render Object Interface - Bounding Volumes
137 virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const;
138 virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const;
139
141 // Render Object Interface - Predictive LOD
143 virtual void Prepare_LOD(CameraClass &camera);
144 virtual void Increment_LOD(void);
145 virtual void Decrement_LOD(void);
146 virtual float Get_Cost(void) const;
147 virtual float Get_Value(void) const;
148 virtual float Get_Post_Increment_Value(void) const;
149 virtual void Set_LOD_Level(int lod);
150 virtual int Get_LOD_Level(void) const;
151 virtual int Get_LOD_Count(void) const;
152
154 // Render Object Interface - Attributes, Options, Properties, etc
156// virtual void Set_Texture_Reduction_Factor(float trf);
157
159 // Render Object Interface - Collision Detection
161 virtual bool Cast_Ray(RayCollisionTestClass & raytest);
162
163 protected:
164
165 void Render_Seg_Line(RenderInfoClass & rinfo);
166
167 private:
168
169 // Subdivision properties
170 unsigned int MaxSubdivisionLevels;
171
172 // Normalized screen area - used for LOD purposes
173 float NormalizedScreenArea;
174
175 // Per-point location array
176 SimpleDynVecClass<Vector3> PointLocations;
177
178 // LineRenderer, contains most of the line settings.
179 SegLineRendererClass LineRenderer;
180};
181
182#endif SEGLINE_H
RenderObjClass(void)
Definition rendobj.cpp:170
virtual float Get_Post_Increment_Value(void) const
Definition segline.cpp:483
Vector2 Get_UV_Offset_Rate(void)
Definition segline.cpp:200
int Are_End_Caps_Enabled(void)
Definition segline.cpp:220
void Set_Shader(ShaderClass shader)
Definition segline.cpp:230
virtual int Get_LOD_Level(void) const
Definition segline.cpp:505
unsigned int Get_Subdivision_Levels(void)
Definition segline.cpp:185
TextureClass * Get_Texture(void)
Definition segline.cpp:155
void Set_Freeze_Random(int onoff)
Definition segline.cpp:298
virtual void Render(RenderInfoClass &rinfo)
Definition segline.cpp:329
void Delete_Point(unsigned int point_idx)
Definition segline.cpp:147
virtual float Get_Value(void) const
Definition segline.cpp:471
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
Definition segline.cpp:351
virtual void Prepare_LOD(CameraClass &camera)
Definition segline.cpp:427
void Set_UV_Offset_Rate(const Vector2 &rate)
Definition segline.cpp:288
void Set_Color(const Vector3 &color)
Definition segline.cpp:249
void Set_Texture(TextureClass *texture)
Definition segline.cpp:225
float Get_Opacity(void)
Definition segline.cpp:170
void Set_Noise_Amplitude(float amplitude)
Definition segline.cpp:259
int Get_Num_Points(void)
Definition segline.cpp:116
void Reset_Line(void)
Definition segline.cpp:91
int Is_Freeze_Random(void)
Definition segline.cpp:210
virtual void Increment_LOD(void)
Definition segline.cpp:450
virtual RenderObjClass * Clone(void) const
Definition segline.cpp:318
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
Definition segline.cpp:540
void Set_Texture_Mapping_Mode(SegLineRendererClass::TextureMapMode mode)
Definition segline.cpp:278
void Set_Disable_Sorting(int onoff)
Definition segline.cpp:304
virtual void Set_LOD_Level(int lod)
Definition segline.cpp:497
float Get_Noise_Amplitude(void)
Definition segline.cpp:175
SegLineRendererClass::TextureMapMode Get_Texture_Mapping_Mode(void)
Definition segline.cpp:190
virtual int Class_ID(void) const
Definition segline.h:126
void Get_Color(Vector3 &color)
Definition segline.cpp:165
virtual ~SegmentedLineClass(void)
Definition segline.cpp:87
void Set_Texture_Tile_Factor(float factor)
Definition segline.cpp:283
SegmentedLineClass(void)
Definition segline.cpp:58
void Set_Point_Location(unsigned int point_idx, const Vector3 &location)
Definition segline.cpp:123
void Set_Points(unsigned int num_points, Vector3 *locs)
Definition segline.cpp:99
void Get_Point_Location(unsigned int point_idx, Vector3 &loc)
Definition segline.cpp:133
SegmentedLineClass & operator=(const SegmentedLineClass &that)
Definition segline.cpp:72
void Set_Merge_Abort_Factor(float factor)
Definition segline.cpp:266
void Set_Subdivision_Levels(unsigned int levels)
Definition segline.cpp:271
void Render_Seg_Line(RenderInfoClass &rinfo)
Definition segline.cpp:522
virtual int Get_LOD_Count(void) const
Definition segline.cpp:510
void Add_Point(const Vector3 &location)
Definition segline.cpp:142
float Get_Texture_Tile_Factor(void)
Definition segline.cpp:195
ShaderClass Get_Shader(void)
Definition segline.cpp:160
void Set_End_Caps(int onoff)
Definition segline.cpp:309
void Set_Merge_Intersections(int onoff)
Definition segline.cpp:293
virtual float Get_Cost(void) const
Definition segline.cpp:466
float Get_Merge_Abort_Factor(void)
Definition segline.cpp:180
void Set_Opacity(float opacity)
Definition segline.cpp:254
void Set_Width(float width)
Definition segline.cpp:240
int Is_Sorting_Disabled(void)
Definition segline.cpp:215
virtual int Get_Num_Polys(void) const
Definition segline.cpp:323
virtual void Decrement_LOD(void)
Definition segline.cpp:459
int Is_Merge_Intersections(void)
Definition segline.cpp:205
float Get_Width(void)
Definition segline.cpp:235
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition segline.cpp:362