-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrender_3D.h
More file actions
47 lines (38 loc) · 1.14 KB
/
render_3D.h
File metadata and controls
47 lines (38 loc) · 1.14 KB
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
/*
* Title: 3D Modelling Functions
* Author: Dean Belfield
* Created: 20/08/2025
* Last Updated: 30/11/2025
*
* Modinfo:
* 30/11/2025: Added buffer parameter to drawObject
*/
#ifndef __RENDER_3D_H__
#define __RENDER_3D_H__
#include "structs.h"
#define MAX_POINTS 64 // Maximum points per shape
#define MAX_OBJECTS 16 // Maximum number of objects in the world
#define POINT8(x,y,z) { x, y, z }
extern Point16_3D cam_pos;
extern Angle_3D cam_theta;
// Struct containing a single 3D objects model data
//
typedef struct SModel_3D {
uint8_t numVertices;
uint8_t numFaces;
Point8_3D (*vertices)[];
Vertice_3D (*faces)[];
} Model_3D;
// Struct containing a single 3D objects position data
//
typedef struct SObject_3D {
uint8_t flags;
void (*move)(int i);
Model_3D * model;
Point16_3D pos;
Angle_3D theta;
} Object_3D;
extern void rotateModel(Point16 * buffer, Point16_3D p, Angle_3D a, Model_3D * m) __z88dk_callee;
extern void renderModel(Point16 * buffer, Model_3D * m, uint8_t mode) __z88dk_callee;
extern void drawObject(Point16 * buffer, Object_3D * o, uint8_t renderMode) __z88dk_callee;
#endif //__RENDER_3D_H__