]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - gl_backend.h
changed R_Mesh_ system (again), now uses R_Mesh_GetSpace to set up varray_* pointers...
[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_SetupView_ViewPort (int x, int y, int width, int height);
11 void GL_SetupView_Orientation_Identity (void);
12 void GL_SetupView_Orientation_FromEntity (vec3_t origin, vec3_t angles);
13 void GL_SetupView_Mode_Perspective (double fovx, double fovy, double zNear, double zFar);
14 void GL_SetupView_Mode_PerspectiveInfiniteFarClip (double fovx, double fovy, double zNear);
15 void GL_SetupView_Mode_Ortho (double x1, double y1, double x2, double y2, double zNear, double zFar);
16 void GL_UseColorArray(void);
17 void GL_Color(float cr, float cg, float cb, float ca);
18 void GL_TransformToScreen(const vec4_t in, vec4_t out);
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 tex1d[MAX_TEXTUREUNITS];
33         int tex[MAX_TEXTUREUNITS];
34         int tex3d[MAX_TEXTUREUNITS];
35         int texcubemap[MAX_TEXTUREUNITS];
36         int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
37         int texalphascale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
38         int texcombinergb[MAX_TEXTUREUNITS]; // works with or without combine for some operations
39         int texcombinealpha[MAX_TEXTUREUNITS]; // does nothing without combine
40 }
41 rmeshstate_t;
42
43 // overbright rendering scale for the current state
44 extern int r_lightmapscalebit;
45 extern float r_colorscale;
46 extern float *varray_vertex;
47 extern float *varray_color;
48 extern float *varray_texcoord[MAX_TEXTUREUNITS];
49 extern int mesh_maxverts;
50
51 // adds console variables and registers the render module (only call from GL_Init)
52 void gl_backend_init(void);
53
54 // starts mesh rendering for the frame
55 void R_Mesh_Start(void);
56
57 // ends mesh rendering for the frame
58 // (only valid after R_Mesh_Start)
59 void R_Mesh_Finish(void);
60
61 // sets up the requested transform matrix
62 void R_Mesh_Matrix(const matrix4x4_t *matrix);
63
64 // sets up the requested state
65 void R_Mesh_State(const rmeshstate_t *m);
66
67 // sets up the requested main state
68 void R_Mesh_MainState(const rmeshstate_t *m);
69
70 // sets up the requested texture state
71 void R_Mesh_TextureState(const rmeshstate_t *m);
72
73 // prepares varray_* buffers for rendering a mesh
74 void R_Mesh_GetSpace(int numverts);
75 // renders the mesh in the varray_* buffers
76 void R_Mesh_Draw(int numverts, int numtriangles, const int *elements);
77
78 // saves a section of the rendered frame to a .tga file
79 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
80 // used by R_Envmap_f and internally in backend, clears the frame
81 void R_ClearScreen(void);
82 // invoke refresh of frame
83 void SCR_UpdateScreen (void);
84
85 #endif
86