Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
matrixmapper.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 : WWPhys *
24 * *
25 * $Archive:: /Commando/Code/ww3d2/matrixmapper.h $*
26 * *
27 * Original Author:: Greg Hjelstrom *
28 * *
29 * $Author:: Kenny Mitchell *
30 * *
31 * $Modtime:: 06/26/02 4:04p $*
32 * *
33 * $Revision:: 8 $*
34 * *
35 * 06/26/02 KM Matrix name change to avoid MAX conflicts *
36 *---------------------------------------------------------------------------------------------*
37 * Functions: *
38 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
39
40
41#ifndef MATRIXMAPPER_H
42#define MATRIXMAPPER_H
43
44#include "always.h"
45#include "bittype.h"
46#include "matrix4.h"
47#include "mapper.h"
48
49// Modified to use DX 8 texture matrices
50// Hector Yee 1/29/01
51
64{
66public:
67
68 enum {
70 };
71
78
79 MatrixMapperClass(int stage);
80
81 /*
82 ** Interface
83 */
84 void Set_Flag(uint32 flag,bool onoff);
85 bool Get_Flag(uint32 flag) const;
86
87 void Set_Type(MappingType type);
89
90 void Set_Texture_Transform(const Matrix3D & view_to_texture,float texsize);
91 void Set_Texture_Transform(const Matrix4x4 & view_to_texture,float texsize);
92 const Matrix4x4 & Get_Texture_Transform(void) const;
93
94 void Set_Gradient_U_Coord(float coord) { GradientUCoord = coord; }
95 float Get_Gradient_U_Coord(void) { return GradientUCoord; }
96
97 void Compute_Texture_Coordinate(const Vector3 & point,Vector3 * set_stq);
98
99 TextureMapperClass* Clone(void) const { WWASSERT(0); return NULL; }
100
101 virtual void Apply(int uv_array_index);
102 virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix);
103
104protected:
105
106 void Update_View_To_Pixel_Transform(float texsize);
107
114};
115
116/*
117** CompositeMatrixMapperClass - this is a matrix mapper which contains a pointer to another mapper
118** inside it. When applied, it gets the texture matrix from the internal mapper and composites
119** it with it's own matrix, then applies that. It sets the texture source to camera space
120** position. The idea is to use some transformation of the camera space position (like a planar
121** projection) as the 'input coordinates' to some other mapper like a linear offset mapper
122** which usually uses actual texture coordinates as input. If the internal mapper is NULL, it
123** simply applies it's own matrix.
124*/
126{
127public:
128
129 CompositeMatrixMapperClass(TextureMapperClass *internal_mapper, unsigned int stage);
131 virtual ~CompositeMatrixMapperClass(void);
132
133 virtual TextureMapperClass *Clone(void) const { return NEW_REF( CompositeMatrixMapperClass, (*this)); }
134
135 virtual void Apply(int uv_array_index);
136 virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix);
137
138protected:
139
141};
142
144{
145 if (onoff) {
146 Flags |= flag;
147 } else {
148 Flags &= ~flag;
149 }
150}
151
153{
154 return (Flags & flag) == flag;
155}
156
158{
159 Type = type;
160}
161
166
168{
169 return ViewToTexture;
170}
171
172#endif
#define NULL
Definition BaseType.h:92
#define WWASSERT
#define W3DMPO_GLUE(ARGCLASS)
Definition always.h:120
unsigned long uint32
Definition bittype.h:46
TextureMapperClass * InternalMapper
virtual ~CompositeMatrixMapperClass(void)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
CompositeMatrixMapperClass(TextureMapperClass *internal_mapper, unsigned int stage)
virtual TextureMapperClass * Clone(void) const
const Matrix4x4 & Get_Texture_Transform(void) const
MatrixMapperClass(int stage)
Matrix4x4 ViewToPixel
virtual void Apply(int uv_array_index)
void Set_Gradient_U_Coord(float coord)
Matrix4x4 ViewToTexture
Vector3 ViewSpaceProjectionNormal
void Set_Flag(uint32 flag, bool onoff)
MappingType Get_Type(void)
void Update_View_To_Pixel_Transform(float texsize)
float Get_Gradient_U_Coord(void)
void Compute_Texture_Coordinate(const Vector3 &point, Vector3 *set_stq)
TextureMapperClass * Clone(void) const
void Set_Texture_Transform(const Matrix3D &view_to_texture, float texsize)
void Set_Type(MappingType type)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
bool Get_Flag(uint32 flag) const
TextureMapperClass(unsigned int stage=0)
Definition mapper.cpp:60
#define NEW_REF(C, P)
Definition refcount.h:62
unsigned char flag
Definition vchannel.cpp:273