- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSWframebuffer.h
More file actions
Latest commit
70 lines (50 loc) · 2.71 KB
/
Copy pathSWframebuffer.h
File metadata and controls
70 lines (50 loc) · 2.71 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndefSW_FRAMEBUFFER_H
#defineSW_FRAMEBUFFER_H
#include"SWcore.h"
#include"SWpixels.h"
#include"SWzbuffer.h"
typedefstructSWframebuffer {
SWenumtype;
SWintw, h;
void*pixels;
SWzbuffer*zbuf;
} SWframebuffer;
structSWtexture;
voidswFbufInit(SWframebuffer*f, SWenumtype, SWintw, SWinth, SWintwith_depth);
voidswFbufDestroy(SWframebuffer*f);
voidswFbufClearColor_RGBA(SWframebuffer*f, SWubyte*rgba);
voidswFbufClearColorFloat(SWframebuffer*f, SWfloatr, SWfloatg, SWfloatb, SWfloata);
#defineswFbufSetPixel_FRGBA(f, x, y, col) \
if ((f)->type == SW_BGRA8888) { \
swPx_BGRA8888_SetColor_FRGBA((f)->w, (f)->h, (f)->pixels, (x), (y), (col)); \
} else if ((f)->type == SW_FRGBA) { \
swPx_FRGBA_SetColor_FRGBA((f)->w, (f)->h, (f)->pixels, (x), (y), (col)); \
}
#defineswFbufSetPixel_BGRA8888(f, x, y, col) \
if ((f)->type == SW_BGRA8888) { \
swPx_BGRA8888_SetColor_BGRA8888((f)->w, (f)->h, (f)->pixels, (x), (y), (col)); \
}
#defineswFbufGetPixel_FRGBA(f, x, y, col) \
if ((f)->type == SW_BGRA8888) { \
swPx_BGRA8888_GetColor_FRGBA((f)->w, (f)->h, (f)->pixels, (x), (y), (col)); \
} else { (col)[0] = (col)[1] = (col)[2] = (col)[3] = 0; }
#defineswFbufTestDepth(f, x, y, z) \
swZbufTestDepth((f)->zbuf, x, y, z)
#defineswFbufSetDepth(f, x, y, z) \
swZbufSetDepth((f)->zbuf, x, y, z)
#defineswFbufSetTileRange(f, x, y, zmin, zmax) \
swZbufSetTileRange((f)->zbuf, x, y, zmin, zmax)
#defineswFbufUpdateTileRange(f, x, y, zmin, zmax) \
swZbufUpdateTileRange((f)->zbuf, x, y, zmin, zmax)
#defineswFbufTestTileRange(f, x, y, zmin, zmax) \
swZbufTestTileRange((f)->zbuf, x, y, zmin, zmax)
#defineswFbufClearDepth(f, z) \
swZbufClearDepth((f)->zbuf, (z))
#defineswFbufBGRA8888_SetPixel_FRGBA(f, x, y, col) \
swPx_BGRA8888_SetColor_FRGBA((f)->w, (f)->h, (f)->pixels, (x), (y), (col))
voidswFbufBlitPixels(SWframebuffer*f, SWintx, SWinty, SWintpitch, SWenumtype, SWenummode, SWintw, SWinth, constvoid*pixels, SWfloatscale);
voidswFbufBlitTexture(SWframebuffer*f, SWintx, SWinty, conststructSWtexture*t, SWfloatscale);
/*static sw_inline SWint swFbufTestDepth(SWframebuffer *f, SWint x, SWint y, SWfloat z) {
return !(z > f->depth[y * f->w + x]);
}*/
#endif/* SW_FRAMEBUFFER_H */