5 #define MAX_TEXTUREUNITS 8
7 #define POLYGONELEMENTS_MAXPOINTS 258
8 extern int polygonelements[768];
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);
20 extern cvar_t gl_lockarrays;
22 extern int c_meshelements, c_meshs;
24 //input to R_Mesh_State
27 int depthwrite; // force depth writing enabled even if polygon is not opaque
28 int depthdisable; // disable depth read/write entirely
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
43 // overbright rendering scale for the current state
44 extern int r_lightmapscalebit;
45 extern float r_colorscale;
46 extern float *varray_vertex3f;
47 extern float *varray_color4f;
48 extern float *varray_texcoord3f[MAX_TEXTUREUNITS];
49 extern float *varray_texcoord2f[MAX_TEXTUREUNITS];
50 extern int mesh_maxverts;
52 // adds console variables and registers the render module (only call from GL_Init)
53 void gl_backend_init(void);
55 // starts mesh rendering for the frame
56 void R_Mesh_Start(void);
58 // ends mesh rendering for the frame
59 // (only valid after R_Mesh_Start)
60 void R_Mesh_Finish(void);
62 // sets up the requested transform matrix
63 void R_Mesh_Matrix(const matrix4x4_t *matrix);
65 // sets up the requested state
66 void R_Mesh_State(const rmeshstate_t *m);
68 // sets up the requested main state
69 void R_Mesh_MainState(const rmeshstate_t *m);
71 // sets up the requested texture state
72 void R_Mesh_TextureState(const rmeshstate_t *m);
74 // prepares varray_* buffers for rendering a mesh
75 void R_Mesh_GetSpace(int numverts);
76 // renders the mesh in the varray_* buffers
77 void R_Mesh_Draw(int numverts, int numtriangles, const int *elements);
79 // copies a vertex3f array into varray_vertex3f
80 void R_Mesh_CopyVertex3f(const float *vertex3f, int numverts);
81 // copies a texcoord2f array into varray_texcoord[tmu]
82 void R_Mesh_CopyTexCoord2f(int tmu, const float *texcoord2f, int numverts);
83 // copies a color4f array into varray_color4f
84 void R_Mesh_CopyColor4f(const float *color4f, int numverts);
86 // saves a section of the rendered frame to a .tga or .jpg file
87 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg);
88 // used by R_Envmap_f and internally in backend, clears the frame
89 void R_ClearScreen(void);
90 // invoke refresh of frame
91 void SCR_UpdateScreen (void);