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