]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - gl_backend.h
fixed some dynamic lighting bugs related to glowing self
[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, const 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 fovx, double fovy, double zNear, double zFar);
16 void GL_SetupView_Mode_PerspectiveInfiniteFarClip (double fovx, double fovy, double zNear);
17 void GL_SetupView_Mode_Ortho (double x1, double y1, double x2, double y2, double zNear, double zFar);
18 void GL_UseColorArray(void);
19 void GL_Color(float cr, float cg, float cb, float ca);
20
21 extern cvar_t gl_lockarrays;
22
23 extern int c_meshelements, c_meshs;
24
25 //input to R_Mesh_State
26 typedef struct
27 {
28         int depthwrite; // force depth writing enabled even if polygon is not opaque
29         int depthdisable; // disable depth read/write entirely
30         int blendfunc1;
31         int blendfunc2;
32         //int wantoverbright;
33         int tex1d[MAX_TEXTUREUNITS];
34         int tex[MAX_TEXTUREUNITS];
35         int tex3d[MAX_TEXTUREUNITS];
36         int texcubemap[MAX_TEXTUREUNITS];
37         int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
38         int texalphascale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
39         int texcombinergb[MAX_TEXTUREUNITS]; // works with or without combine for some operations
40         int texcombinealpha[MAX_TEXTUREUNITS]; // does nothing without combine
41 }
42 rmeshstate_t;
43
44 // overbright rendering scale for the current state
45 extern int r_lightmapscalebit;
46 extern float r_colorscale;
47 extern float *varray_vertex;
48 extern float *varray_color;
49 extern float *varray_texcoord[MAX_TEXTUREUNITS];
50 extern int mesh_maxverts;
51
52 // adds console variables and registers the render module (only call from GL_Init)
53 void gl_backend_init(void);
54
55 // starts mesh rendering for the frame
56 void R_Mesh_Start(void);
57
58 // ends mesh rendering for the frame
59 // (only valid after R_Mesh_Start)
60 void R_Mesh_Finish(void);
61
62 // sets up the requested transform matrix
63 void R_Mesh_Matrix(const matrix4x4_t *matrix);
64
65 // sets up the requested state
66 void R_Mesh_State(const rmeshstate_t *m);
67
68 // sets up the requested main state
69 void R_Mesh_MainState(const rmeshstate_t *m);
70
71 // sets up the requested texture state
72 void R_Mesh_TextureState(const rmeshstate_t *m);
73
74 // enlarges vertex arrays if they are too small
75 #define R_Mesh_ResizeCheck(numverts) if ((numverts) > mesh_maxverts) _R_Mesh_ResizeCheck(numverts);
76 void _R_Mesh_ResizeCheck(int numverts);
77
78 // renders the mesh in the varray_* buffers
79 void R_Mesh_Draw(int numverts, int numtriangles, const int *elements);
80
81 // saves a section of the rendered frame to a .tga file
82 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
83 // used by R_Envmap_f and internally in backend, clears the frame
84 void R_ClearScreen(void);
85 // invoke refresh of frame
86 void SCR_UpdateScreen (void);
87
88 #endif
89