-
Notifications
You must be signed in to change notification settings - Fork 1
/
renbuffer.h
114 lines (88 loc) · 2.18 KB
/
renbuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/******************************************************
g-Matrix3D Neo Engine
Copyright (c)2003 Kim Seong Wan (kaswan, Â𻧱ͽÅ)
E-mail: kaswan@hitel.net
http://www.g-matrix.pe.kr
*******************************************************/
#ifndef RENBUFFER_H
#define RENBUFFER_H
#include "vertex.h"
#include "graphics.h"
//#define MAXVERTEX 5000
struct RenderInfo{
int NumVertex;
int NumIndex;
int NumActiveVertex;
int NumClippedVertex;
int NumRenderIndex;
int NumDrawed;
int NumMesh;
void Clear(void)
{
NumVertex = 0;
NumIndex = 0;
NumActiveVertex = 0;
NumClippedVertex = 0;
NumRenderIndex = 0;
NumDrawed = 0;
NumMesh = 0;
}
void Display(int x, int y)
{
PutNumber(x, y, "Vert", NumVertex);
PutNumber(x, y + 20, "Face", NumIndex / 3);
PutNumber(x, y + 40, "RenderVert", NumActiveVertex);
PutNumber(x, y + 60, "RenderFace", NumRenderIndex / 3);
PutNumber(x, y + 80, "ClippedVert", NumClippedVertex);
PutNumber(x, y + 100, "DrawedFace", NumDrawed);
PutNumber(x, y + 120, "Mesh", NumMesh);
}
};
class CRenBuffer{
public:
int NumVertex;
Vertex *VertexList;
ViewVertex *ViewVertexList;
TLVertex *TLVertexList;
int NumActiveVertex;
int *ActiveVertexIndexList;
int NumTri;
int NumIndex;
int NumRenderIndex;
int *IndexList;
int *RenderIndexList;
int *MTLIDList;
int MTLID;
int DrawedCounter;
CRenBuffer(int MAXVERTEX = 50000)
{
NumVertex = 0;
VertexList = NULL;
ViewVertexList = new ViewVertex[MAXVERTEX];
TLVertexList = new TLVertex[MAXVERTEX];
NumActiveVertex = 0;
ActiveVertexIndexList = new int[MAXVERTEX];
NumTri = 0;
NumIndex = 0;
RenderIndexList = new int[MAXVERTEX * 6];
MTLIDList = new int[MAXVERTEX * 6];
DrawedCounter = 0;
}
~CRenBuffer()
{
NumVertex = 0;
VertexList = NULL;
delete [] ViewVertexList;
delete [] TLVertexList;
NumActiveVertex = 0;
delete [] ActiveVertexIndexList;
NumTri = 0;
NumIndex = 0;
delete [] RenderIndexList;
delete [] MTLIDList;
}
void VertexLighting(int vindex);
void VertexLightingBack(int vindex);
void RenderMesh(void);
};
#endif