]> icculus.org git repositories - divverent/darkplaces.git/blob - gl_backend.h
Some menu customizations for BloodBath
[divverent/darkplaces.git] / gl_backend.h
1
2 #define MAX_TEXTUREUNITS 8
3
4 extern int c_meshtris, c_meshs, c_transtris, c_transmeshs;
5
6 typedef struct
7 {
8         int transparent;
9         int depthwrite; // force depth writing enabled even if polygon is not opaque
10         int depthdisable; // disable depth read/write entirely
11         int blendfunc1;
12         int blendfunc2;
13         int numtriangles;
14         int *index;
15         int numverts;
16         float *vertex;
17         int vertexstep;
18         float *color;
19         int colorstep;
20         float cr, cg, cb, ca; // if color is NULL, these are used for all vertices
21         int tex[MAX_TEXTUREUNITS];
22         float *texcoords[MAX_TEXTUREUNITS];
23         int texcoordstep[MAX_TEXTUREUNITS];
24         float texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
25 }
26 rmeshinfo_t;
27
28 typedef struct
29 {
30         //input to R_Mesh_Draw_GetBuffer
31         int transparent;
32         int depthwrite; // force depth writing enabled even if polygon is not opaque
33         int depthdisable; // disable depth read/write entirely
34         int blendfunc1;
35         int blendfunc2;
36         int numtriangles;
37         int numverts;
38         int tex[MAX_TEXTUREUNITS];
39         float texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
40
41         // output
42         int *index;
43         float *vertex;
44         float *color;
45         float colorscale;
46         float *texcoords[MAX_TEXTUREUNITS];
47 }
48 rmeshbufferinfo_t;
49
50 // adds console variables and registers the render module (only call from GL_Init)
51 void gl_backend_init(void);
52
53 // starts mesh rendering for the frame
54 void R_Mesh_Start(void);
55
56 // ends mesh rendering for the frame
57 // (only valid after R_Mesh_Start)
58 void R_Mesh_Finish(void);
59
60 // clears depth buffer, used for masked sky rendering
61 // (only valid between R_Mesh_Start and R_Mesh_Finish)
62 void R_Mesh_ClearDepth(void);
63
64 // renders current batch of meshs
65 // (only valid between R_Mesh_Start and R_Mesh_Finish)
66 void R_Mesh_Render(void);
67
68 // queues a mesh to be rendered (invokes Render if queue is full)
69 // (only valid between R_Mesh_Start and R_Mesh_Finish)
70 void R_Mesh_Draw(const rmeshinfo_t *m);
71
72 // renders the queued transparent meshs
73 // (only valid between R_Mesh_Start and R_Mesh_Finish)
74 void R_Mesh_AddTransparent(void);
75
76 // ease-of-use frontend to R_Mesh_Draw, set up meshinfo, except for index and numtriangles and numverts, then call this
77 // (only valid between R_Mesh_Start and R_Mesh_Finish)
78 void R_Mesh_DrawPolygon(rmeshinfo_t *m, int numverts);
79
80 // same as normal, except for harsh format restrictions (vertex must be 4 float, color must be 4 float, texcoord must be 2 float, flat color not supported)
81 // (only valid between R_Mesh_Start and R_Mesh_Finish)
82 void R_Mesh_Draw_NativeOnly(const rmeshinfo_t *m);
83
84 // allocates space in geometry buffers, and fills in pointers to the buffers in passsed struct
85 // (this is used for very high speed rendering, no copying)
86 // (only valid between R_Mesh_Start and R_Mesh_Finish)
87 int R_Mesh_Draw_GetBuffer(rmeshbufferinfo_t *m);
88
89 // saves a section of the rendered frame to a .tga file
90 void SCR_ScreenShot(char *filename, int x, int y, int width, int height);
91 // used by R_Envmap_f and internally in backend, clears the frame
92 void R_ClearScreen(void);
93 // invoke refresh of frame
94 void SCR_UpdateScreen (void);