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
|
#ifndef CHEESE3D_H
#define CHEESE3D_H
// Cheese3D is the cuddlesOS 3d graphics API
#include "def.h"
typedef struct {
float pos[3];
float tex[2];
} vertex;
typedef struct {
u32 w, h;
u32 *data;
} texture;
typedef struct {
void *target;
u32 width;
u32 height;
u32 pitch;
u32 bgcolor;
float *depth_buffer;
void *color_buffer;
} cheese3d_ctx;
#define VERT(x, y, z, s, t) { { x, y, z }, { s, t } } // this exists to work with the QUAD macro
#define QUAD(a, b, c, d) a, b, c, a, c, d
cheese3d_ctx cheese3d_create(void *target, u32 width, u32 height, u32 pitch, u32 bgcolor);
cheese3d_ctx cheese3d_create_default(u32 bgcolor);
void cheese3d_destroy(cheese3d_ctx ctx);
void cheese3d_clear(cheese3d_ctx ctx, bool color, bool depth);
void cheese3d_render(cheese3d_ctx ctx, usize num, vertex *vertices, texture *textures, float transform[4][4]);
void cheese3d_display(cheese3d_ctx ctx);
#endif
|