]> icculus.org git repositories - divverent/darkplaces.git/blob - gl_backend.h
Elric rewrote the makefile, it is quite self explanatory when run.
[divverent/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_UseColorArray(void);
18 void GL_Color(float cr, float cg, float cb, float ca);
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 }
38 rmeshstate_t;
39
40 // overbright rendering scale for the current state
41 extern int r_lightmapscalebit;
42 extern float r_colorscale;
43 extern float *varray_vertex;
44 extern float *varray_color;
45 extern float *varray_texcoord[MAX_TEXTUREUNITS];
46 extern int mesh_maxverts;
47
48 // adds console variables and registers the render module (only call from GL_Init)
49 void gl_backend_init(void);
50
51 // starts mesh rendering for the frame
52 void R_Mesh_Start(void);
53
54 // ends mesh rendering for the frame
55 // (only valid after R_Mesh_Start)
56 void R_Mesh_Finish(void);
57
58 // sets up the requested transform matrix
59 void R_Mesh_Matrix(const matrix4x4_t *matrix);
60
61 // sets up the requested state
62 void R_Mesh_State(const rmeshstate_t *m);
63
64 // sets up the requested main state
65 void R_Mesh_MainState(const rmeshstate_t *m);
66
67 // sets up the requested texture state
68 void R_Mesh_TextureState(const rmeshstate_t *m);
69
70 // enlarges vertex arrays if they are too small
71 #define R_Mesh_ResizeCheck(numverts) if ((numverts) > mesh_maxverts) _R_Mesh_ResizeCheck(numverts);
72 void _R_Mesh_ResizeCheck(int numverts);
73
74 // renders the mesh in the varray_* buffers
75 void R_Mesh_Draw(int numverts, int numtriangles, int *elements);
76
77 // saves a section of the rendered frame to a .tga file
78 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
79 // used by R_Envmap_f and internally in backend, clears the frame
80 void R_ClearScreen(void);
81 // invoke refresh of frame
82 void SCR_UpdateScreen (void);
83
84 #endif
85