]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - gl_backend.h
fix restart command (can't do the "connect local" for a restart)
[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 #define POLYGONELEMENTS_MAXPOINTS 258
8 extern int polygonelements[768];
9
10 void GL_DrawRangeElements(int firstvert, int endvert, int indexcount, int *index);
11
12 void GL_SetupView_ViewPort (int x, int y, int width, int height);
13 void GL_SetupView_Orientation_Identity (void);
14 void GL_SetupView_Orientation_FromEntity (vec3_t origin, vec3_t angles);
15 void GL_SetupView_Mode_Perspective (double aspect, double fovx, double fovy, double zNear, double zFar);
16 void GL_SetupView_Mode_Ortho (double x1, double y1, double x2, double y2, double zNear, double zFar);
17 void GL_DepthFunc(int value);
18 void GL_ClearDepth(void);
19
20 extern cvar_t gl_lockarrays;
21
22 extern int c_meshelements, c_meshs;
23
24 //input to R_Mesh_State
25 typedef struct
26 {
27         int depthwrite; // force depth writing enabled even if polygon is not opaque
28         int depthdisable; // disable depth read/write entirely
29         int blendfunc1;
30         int blendfunc2;
31         //int wantoverbright;
32         int tex[MAX_TEXTUREUNITS];
33         int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
34 }
35 rmeshstate_t;
36
37 // overbright rendering scale for the current state
38 extern int r_lightmapscalebit;
39 extern float r_colorscale;
40 extern float *varray_vertex;
41 extern float *varray_color;
42 extern float *varray_texcoord[MAX_TEXTUREUNITS];
43 extern int mesh_maxverts;
44
45 // adds console variables and registers the render module (only call from GL_Init)
46 void gl_backend_init(void);
47
48 // starts mesh rendering for the frame
49 void R_Mesh_Start(void);
50
51 // ends mesh rendering for the frame
52 // (only valid after R_Mesh_Start)
53 void R_Mesh_Finish(void);
54
55 // sets up the requested transform matrix
56 void R_Mesh_Matrix(const matrix4x4_t *matrix);
57
58 // sets up the requested state
59 void R_Mesh_State(const rmeshstate_t *m);
60
61 // sets up the requested main state
62 void R_Mesh_MainState(const rmeshstate_t *m);
63
64 // sets up the requested texture state
65 void R_Mesh_TextureState(const rmeshstate_t *m);
66
67 // enlarges vertex arrays if they are too small
68 #define R_Mesh_ResizeCheck(numverts) if ((numverts) > mesh_maxverts) _R_Mesh_ResizeCheck(numverts);
69 void _R_Mesh_ResizeCheck(int numverts);
70
71 // renders the mesh in the varray_* buffers
72 void R_Mesh_Draw(int numverts, int numtriangles, int *elements);
73
74 // saves a section of the rendered frame to a .tga file
75 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
76 // used by R_Envmap_f and internally in backend, clears the frame
77 void R_ClearScreen(void);
78 // invoke refresh of frame
79 void SCR_UpdateScreen (void);
80
81 #endif
82