Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
vxllayer.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/* $Header: /Commando/Code/Tools/max2w3d/vxllayer.h 3 10/28/97 6:08p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/vxllayer.h $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 10/26/97 1:35p $*
31 * *
32 * $Revision:: 3 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38
39#ifndef VXLLAYER_H
40#define VXLLAYER_H
41
42#include <Max.h>
43
44
45#ifndef BITTYPE_H
46#include "bittype.h"
47#endif
48
49#ifndef NODELIST_H
50#include "nodelist.h"
51#endif
52
53const sint8 VOXEL_VISIBLE = 0; // voxels that are "outside" the object
54const sint8 VOXEL_SOLID = 1; // voxels that are part of the object
55const sint8 VOXEL_UNKNOWN = -1; // either inside or outside, don't know yet
56const int max_bitmap_width = 256;
57const int max_bitmap_height = 256;
58
59
61{
62public:
63
65
67 (
68 INodeListClass & objectlist,
69 TimeValue time,
70 Matrix3 parenttm,
71 Point3 offset,
72 Point3 scale,
73 float slicez,
74 float sliceh,
75 int bmwidth,
76 int bmheight
77 );
78
80
81 BOOL Is_Visible( int x, int y )
82 {
83 if (x < 0 || x >= bitmap_width || y < 0 || y >= bitmap_height) {
84 return TRUE;
85 }
86
87 if (Solid[x][y] == 0) {
88 return TRUE;
89 } else {
90 return FALSE;
91 }
92 }
93
94 BOOL Is_Solid( int x, int y )
95 {
96 if (x < 0 || x >= bitmap_width || y < 0 || y >= bitmap_height) {
97 return FALSE;
98 }
99
100 if (Solid[x][y] == VOXEL_SOLID) {
101 return TRUE;
102 } else {
103 return FALSE;
104 }
105 }
106
107 unsigned int Get_Width(void) { return bitmap_width; }
108 unsigned int Get_Height(void) { return bitmap_height; }
109
110protected:
111
112 void Set_Visible ( int x, int y )
113 {
114 if (x >= 0 && x < bitmap_width && y >= 0 && y < bitmap_height && Solid[x][y] != VOXEL_SOLID )
115 {
116 Solid[x][y] = VOXEL_VISIBLE;
117 }
118 }
119
120 void Add_Solid(int x,int y)
121 {
122 // check if the point is outside the bitmap:
123 if (x >= 0 && x < bitmap_width && y >= 0 && y < bitmap_height) {
124 Solid[x][y] = VOXEL_SOLID;
125 }
126 }
127
128 // draw a line of voxels into the bitmap
129 void Draw_Line(double x0,double y0,double x1,double y1);
130
131 // draw the intersection between the triangle and the voxel plane
132 void Intersect_Triangle(Point3 a,Point3 b,Point3 c,float z);
133
134 // scan convert the polygon fragment in this voxel slab
135 void Scan_Triangle(Point3 a,Point3 b,Point3 c);
136
138
139 float SliceZ;
140 float SliceH;
141 float SliceZ0;
142 float SliceZ1;
143
146};
147
148
149#endif /*VXLLAYER_H*/
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
Color scale(const Color &a, const Color &b)
Definition GameMtl.cpp:722
signed char sint8
Definition bittype.h:49
#define BOOL
Definition Wnd_File.h:57
void Intersect_Triangle(Point3 a, Point3 b, Point3 c, float z)
Definition vxllayer.cpp:229
void Add_Solid(int x, int y)
Definition vxllayer.h:120
BOOL Is_Solid(int x, int y)
Definition vxllayer.h:94
unsigned int Get_Height(void)
Definition vxllayer.h:108
void Scan_Triangle(Point3 a, Point3 b, Point3 c)
Definition vxllayer.cpp:396
BOOL Is_Visible(int x, int y)
Definition vxllayer.h:81
void Set_Visible(int x, int y)
Definition vxllayer.h:112
sint8 Solid[max_bitmap_width][max_bitmap_height]
Definition vxllayer.h:137
void Draw_Line(double x0, double y0, double x1, double y1)
Definition vxllayer.cpp:308
unsigned int Get_Width(void)
Definition vxllayer.h:107
const int max_bitmap_height
Definition vxllayer.h:57
const int max_bitmap_width
Definition vxllayer.h:56
const sint8 VOXEL_UNKNOWN
Definition vxllayer.h:55
const sint8 VOXEL_VISIBLE
Definition vxllayer.h:53
const sint8 VOXEL_SOLID
Definition vxllayer.h:54