Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-2-2013-Decompilation
Path: blob/main/RSDKv4/Scene3D.hpp
817 views
1
#ifndef DRAWING3D_H
2
#define DRAWING3D_H
3
4
#define VERTEXBUFFER_SIZE (0x1000)
5
#define FACEBUFFER_SIZE (0x400)
6
7
enum FaceFlags {
8
FACE_FLAG_TEXTURED_3D = 0,
9
FACE_FLAG_TEXTURED_2D = 1,
10
FACE_FLAG_COLORED_3D = 2,
11
FACE_FLAG_COLORED_2D = 3,
12
FACE_FLAG_FADED = 4,
13
FACE_FLAG_TEXTURED_C = 5,
14
FACE_FLAG_TEXTURED_C_BLEND = 6,
15
FACE_FLAG_3DSPRITE = 7
16
};
17
18
enum MatrixTypes {
19
MAT_WORLD = 0,
20
MAT_VIEW = 1,
21
MAT_TEMP = 2,
22
};
23
24
struct Matrix {
25
int values[4][4];
26
};
27
28
struct Vertex {
29
int x;
30
int y;
31
int z;
32
int u;
33
int v;
34
};
35
36
struct Face {
37
int a;
38
int b;
39
int c;
40
int d;
41
uint color;
42
int flag;
43
};
44
45
struct DrawListEntry3D {
46
int faceID;
47
int depth;
48
};
49
50
extern int vertexCount;
51
extern int faceCount;
52
53
extern Matrix matFinal;
54
extern Matrix matWorld;
55
extern Matrix matView;
56
extern Matrix matTemp;
57
58
extern Face faceBuffer[FACEBUFFER_SIZE];
59
extern Vertex vertexBuffer[VERTEXBUFFER_SIZE];
60
extern Vertex vertexBufferT[VERTEXBUFFER_SIZE];
61
62
extern DrawListEntry3D drawList3D[FACEBUFFER_SIZE];
63
64
extern int projectionX;
65
extern int projectionY;
66
extern int fogColor;
67
extern int fogStrength;
68
69
extern int faceLineStart[SCREEN_YSIZE];
70
extern int faceLineEnd[SCREEN_YSIZE];
71
extern int faceLineStartU[SCREEN_YSIZE];
72
extern int faceLineEndU[SCREEN_YSIZE];
73
extern int faceLineStartV[SCREEN_YSIZE];
74
extern int faceLineEndV[SCREEN_YSIZE];
75
76
void SetIdentityMatrix(Matrix *matrix);
77
void MatrixMultiply(Matrix *matrixA, Matrix *matrixB);
78
void MatrixTranslateXYZ(Matrix *Matrix, int x, int y, int z);
79
void MatrixScaleXYZ(Matrix *matrix, int scaleX, int scaleY, int scaleZ);
80
void MatrixRotateX(Matrix *matrix, int rotationX);
81
void MatrixRotateY(Matrix *matrix, int rotationY);
82
void MatrixRotateZ(Matrix *matrix, int rotationZ);
83
void MatrixRotateXYZ(Matrix *matrix, short rotationX, short rotationY, short rotationZ);
84
#if !RETRO_REV00
85
void MatrixInverse(Matrix *matrix);
86
#endif
87
void TransformVertexBuffer();
88
void TransformVertices(Matrix *matrix, int startIndex, int endIndex);
89
void Sort3DDrawList();
90
void Draw3DScene(int spriteSheetID);
91
92
void ProcessScanEdge(Vertex *vertA, Vertex *vertB);
93
void ProcessScanEdgeUV(Vertex *vertA, Vertex *vertB);
94
95
#endif // !DRAWING3D_H
96
97