Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
line3d.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/line3d.h $*
26 * *
27 * $Author:: Hector_y $*
28 * *
29 * $Modtime:: 2/16/01 3:52p $*
30 * *
31 * $Revision:: 2 $*
32 * *
33 *-------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#if defined(_MSC_VER)
38#pragma once
39#endif
40
41#ifndef LINE3D_H
42#define LINE3D_H
43
44#include "always.h"
45#include "rendobj.h"
46#include "vector3.h"
47#include "vector4.h"
48#include "shader.h"
49
51class RenderInfoClass;
52
53/*
54** Line3DClass -- Render3DObject for rendering 3D line segments.
55** These are conceptually cylinders with a given width - some approximation
56** of this will be rendered. (The current approximation assumes that
57** Line3DCLass objects are unlit, therefore only the sihouette needs to be
58** approximated).
59*/
60class Line3DClass : public W3DMPO, public RenderObjClass
61{
63
64 public:
65
66 Line3DClass (const Vector3 & start, const Vector3 & end, float width,
67 float r, float g, float b, float opacity = 1.0f);
68 Line3DClass(const Line3DClass & src);
69 Line3DClass & operator = (const Line3DClass & that);
70 virtual ~Line3DClass(void);
71 virtual RenderObjClass * Clone(void) const;
72
73 // class id of this render object
74 virtual int Class_ID(void) const { return CLASSID_LINE3D; }
75
76 virtual void Render(RenderInfoClass & rfinfo);
77
78 // scale the 3D line symmetrically about its center.
79 virtual void Scale(float scale);
80 virtual void Scale(float scalex, float scaley, float scalez);
81
82 // returns the number of polygons in the render object
83 virtual int Get_Num_Polys(void) const;
84
85 // Get the object space bounding volumes
86 virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const;
87 virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const;
88
89 // The following functions are unique to Line3DClass:
90
91 // Reset the line start and end points
92 void Reset(const Vector3 & new_start, const Vector3 & new_end);
93
94 // Reset line start and end points, and the line width
95 void Reset(const Vector3 & new_start, const Vector3 & new_end, float new_width);
96
97 // Reset the line color
98 void Re_Color(float r, float g, float b);
99
100 // Reset the line opacity
101 void Set_Opacity(float opacity);
102
103 // For non-opaque lines, allow them to render last.
104 void Set_Sort_Level(int level) { SortLevel = level; }
105 int Get_Sort_Level(void) const { return SortLevel; }
106
107 protected:
108
109 // This is kept to facilitate changing the line endpoints.
110 float Length;
111
112 // This is kept to facilitate changing the line width.
113 float Width;
114
115 // shader
117 // vertices
119 // color
122};
123
124#endif
Color scale(const Color &a, const Color &b)
Definition GameMtl.cpp:722
#define W3DMPO_GLUE(ARGCLASS)
Definition always.h:120
virtual RenderObjClass * Clone(void) const
Definition line3d.cpp:235
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition line3d.cpp:379
virtual int Get_Num_Polys(void) const
Definition line3d.cpp:515
virtual void Scale(float scale)
Definition line3d.cpp:326
Vector3 vert[8]
Definition line3d.h:118
char SortLevel
Definition line3d.h:121
void Reset(const Vector3 &new_start, const Vector3 &new_end)
Definition line3d.cpp:399
void Set_Opacity(float opacity)
Definition line3d.cpp:499
virtual void Render(RenderInfoClass &rfinfo)
Definition line3d.cpp:254
void Re_Color(float r, float g, float b)
Definition line3d.cpp:481
virtual ~Line3DClass(void)
Definition line3d.cpp:218
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
Definition line3d.cpp:371
Vector4 Color
Definition line3d.h:120
void Set_Sort_Level(int level)
Definition line3d.h:104
float Length
Definition line3d.h:110
float Width
Definition line3d.h:113
Line3DClass(const Vector3 &start, const Vector3 &end, float width, float r, float g, float b, float opacity=1.0f)
Definition line3d.cpp:96
ShaderClass Shader
Definition line3d.h:116
Line3DClass & operator=(const Line3DClass &that)
Definition line3d.cpp:184
virtual int Class_ID(void) const
Definition line3d.h:74
int Get_Sort_Level(void) const
Definition line3d.h:105
RenderObjClass(void)
Definition rendobj.cpp:170