-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.h
94 lines (88 loc) · 2.96 KB
/
queue.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
#ifndef _LIBDRAW_QUEUE_H
#define _LIBDRAW_QUEUE_H
#include "draw.h"
extern float projection[4][4], view[4][4], transform[4][4];
extern bool invert;
enum StepType {
STEP_SET_COLOR,
STEP_SET_ORIGIN,
STEP_RECT,
STEP_POLYGON,
STEP_SPRITE,
STEP_FONT,
STEP_TEXT,
STEP_WRAPPED_TEXT,
STEP_CUBE,
STEP_BOARD,
STEP_SLANT,
STEP_PRISM,
STEP_CONE,
STEP_HEDRON,
STEP_ORTHO,
STEP_FRUSTUM,
STEP_PAN,
STEP_TILT,
STEP_LOOK,
STEP_ROTATE,
STEP_SCALE,
STEP_TRANSLATE,
STEP_RENDER,
STEP_BEGIN,
STEP_FOG,
STEP_END,
STEP_SET_LIGHT,
STEP_OPACITY,
STEP_UNIFORMI,
STEP_UNIFORMF,
STEP_UNIFORMV2,
STEP_UNIFORMV3,
STEP_UNIFORMV4,
STEP_UNIFORMTEX
};
struct Step {
StepType type;
union {
struct { Color color; } set_color;
struct { Origin origin; } set_origin;
struct { float x, y, w, h; } rect;
struct { float x, y, r; int n; } polygon;
struct { float x, y, w, h; Image img; } sprite;
struct { Image img; } font;
struct { float x, y; const char* str; } text;
struct { float x, y; const char* str; float width; } wraptext;
struct { float x, y, z, w, h, l; Texture tex; } cube;
struct { float x, y, z, w, h, l; Edge edge; Texture tex; } slant;
struct { float x, y, z, w, h, l; int n; Axis axis; Texture tex; } prism;
struct { float x, y, z, w, h, l; int n; Direction dir; Texture tex; } cone;
struct { float x, y, z, w, h, l; int m, n; Texture tex; } hedron;
struct { float x, y, z, w, h; Image img; } board;
struct { float w, h; } ortho;
struct { float w, h, fov; } frustum;
struct { float x, y, z; } pan;
struct { float degrees; Axis axis; } tilt;
struct { float x, y, z, yaw, pitch; } look;
struct { float angle; Axis axis; } rotate;
struct { float x, y, z; } scale;
struct { float x, y, z; } translate;
struct { Model model; Image img; } render;
struct { Color color; float range; } fog;
struct { Opacity opacity; } opacity;
struct { Shader shader; const char* name; int i; } uniformi;
struct { Shader shader; const char* name; float f; } uniformf;
struct { Shader shader; const char* name; float x, y; } uniformv2;
struct { Shader shader; const char* name; float x, y, z; } uniformv3;
struct { Shader shader; const char* name; float x, y, z, w; } uniformv4;
struct { Shader shader; const char* name; int id; Image i; } uniformtex;
struct { float x, y, z; } set_light;
} data;
};
void identity(float matrix[4][4]);
void enqueue(const Step& step);
void flush(Model model);
void stretched_sprite(float x, float y, float w, float h, Image img);
void ensure2d();
void ensure3d();
void init_queue();
Model getrendermodel();
void apply_default_uniforms();
#endif