]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - gl_backend.h
fix various fog bugs, and also fix missing colormap layer bugs (specifically if the...
[xonotic/darkplaces.git] / gl_backend.h
1
2 #ifndef GL_BACKEND_H
3 #define GL_BACKEND_H
4
5 #define MAX_TEXTUREUNITS 8
6
7 extern int c_meshtris, c_meshs, c_transtris, c_transmeshs;
8
9 typedef struct
10 {
11         //input to R_Mesh_Draw_GetBuffer
12         int depthwrite; // force depth writing enabled even if polygon is not opaque
13         int depthdisable; // disable depth read/write entirely
14         int blendfunc1;
15         int blendfunc2;
16         int numtriangles;
17         int numverts;
18         int tex[MAX_TEXTUREUNITS];
19         int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
20         // model to world transform matrix
21         matrix4x4_t matrix;
22
23         // output
24         int *index;
25         float *vertex;
26         float *color;
27         float colorscale;
28         float *texcoords[MAX_TEXTUREUNITS];
29 }
30 rmeshbufferinfo_t;
31
32 // adds console variables and registers the render module (only call from GL_Init)
33 void gl_backend_init(void);
34
35 // starts mesh rendering for the frame
36 void R_Mesh_Start(float farclip);
37
38 // ends mesh rendering for the frame
39 // (only valid after R_Mesh_Start)
40 void R_Mesh_Finish(void);
41
42 // clears depth buffer, used for masked sky rendering
43 // (only valid between R_Mesh_Start and R_Mesh_Finish)
44 void R_Mesh_ClearDepth(void);
45
46 // renders current batch of meshs
47 // (only valid between R_Mesh_Start and R_Mesh_Finish)
48 void R_Mesh_Render(void);
49
50 // allocates space in geometry buffers, and fills in pointers to the buffers in passsed struct
51 // (it is up to the caller to fill in the geometry data)
52 // (make sure you scale your colors by the colorscale field)
53 // (only valid between R_Mesh_Start and R_Mesh_Finish)
54 int R_Mesh_Draw_GetBuffer(rmeshbufferinfo_t *m, int wantoverbright);
55
56 // saves a section of the rendered frame to a .tga file
57 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
58 // used by R_Envmap_f and internally in backend, clears the frame
59 void R_ClearScreen(void);
60 // invoke refresh of frame
61 void SCR_UpdateScreen (void);
62
63 #endif
64