]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - gl_backend.h
most of the framework for hardware accelerated transforms is back, just the actual...
[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 transparent;
13         int depthwrite; // force depth writing enabled even if polygon is not opaque
14         int depthdisable; // disable depth read/write entirely
15         int blendfunc1;
16         int blendfunc2;
17         int numtriangles;
18         int numverts;
19         int tex[MAX_TEXTUREUNITS];
20         int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
21         // model to world transform matrix
22         matrix4x4_t matrix;
23
24         // output
25         int *index;
26         float *vertex;
27         float *color;
28         float colorscale;
29         float *texcoords[MAX_TEXTUREUNITS];
30 }
31 rmeshbufferinfo_t;
32
33 // adds console variables and registers the render module (only call from GL_Init)
34 void gl_backend_init(void);
35
36 // starts mesh rendering for the frame
37 void R_Mesh_Start(float farclip);
38
39 // ends mesh rendering for the frame
40 // (only valid after R_Mesh_Start)
41 void R_Mesh_Finish(void);
42
43 // clears depth buffer, used for masked sky rendering
44 // (only valid between R_Mesh_Start and R_Mesh_Finish)
45 void R_Mesh_ClearDepth(void);
46
47 // renders current batch of meshs
48 // (only valid between R_Mesh_Start and R_Mesh_Finish)
49 void R_Mesh_Render(void);
50
51 // renders the queued transparent meshs
52 // (only valid between R_Mesh_Start and R_Mesh_Finish)
53 void R_Mesh_AddTransparent(void);
54
55 // allocates space in geometry buffers, and fills in pointers to the buffers in passsed struct
56 // (it is up to the caller to fill in the geometry data)
57 // (make sure you scale your colors by the colorscale field)
58 // (only valid between R_Mesh_Start and R_Mesh_Finish)
59 int R_Mesh_Draw_GetBuffer(rmeshbufferinfo_t *m, int wantoverbright);
60
61 // saves a section of the rendered frame to a .tga file
62 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
63 // used by R_Envmap_f and internally in backend, clears the frame
64 void R_ClearScreen(void);
65 // invoke refresh of frame
66 void SCR_UpdateScreen (void);
67
68 #endif
69