]> icculus.org git repositories - divverent/darkplaces.git/blob - gl_backend.h
another attempt to fix the warnings
[divverent/darkplaces.git] / gl_backend.h
1
2 #ifndef GL_BACKEND_H
3 #define GL_BACKEND_H
4
5 #define MAX_TEXTUREUNITS 16
6
7 #define POLYGONELEMENTS_MAXPOINTS 258
8 extern int polygonelements[(POLYGONELEMENTS_MAXPOINTS-2)*3];
9 #define QUADELEMENTS_MAXQUADS 128
10 extern int quadelements[QUADELEMENTS_MAXQUADS*6];
11
12 void GL_SetupView_Orientation_Identity(void);
13 void GL_SetupView_Orientation_FromEntity(matrix4x4_t *matrix);
14 void GL_SetupView_Mode_Perspective(double frustumx, double frustumy, double zNear, double zFar);
15 void GL_SetupView_Mode_PerspectiveInfiniteFarClip(double frustumx, double frustumy, double zNear);
16 void GL_SetupView_Mode_Ortho(double x1, double y1, double x2, double y2, double zNear, double zFar);
17 void GL_BlendFunc(int blendfunc1, int blendfunc2);
18 void GL_DepthMask(int state);
19 void GL_DepthTest(int state);
20 void GL_ColorMask(int r, int g, int b, int a);
21 void GL_Color(float cr, float cg, float cb, float ca);
22 void GL_TransformToScreen(const vec4_t in, vec4_t out);
23 void GL_LockArrays(int first, int count);
24 void GL_ActiveTexture(unsigned int num);
25 void GL_ClientActiveTexture(unsigned int num);
26 void GL_Scissor(int x, int y, int width, int height);
27 void GL_ScissorTest(int state);
28 void GL_Clear(int mask);
29
30 unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int fragmentstrings_count, const char **fragmentstrings_list);
31 void GL_Backend_FreeProgram(unsigned int prog);
32
33 extern cvar_t gl_lockarrays;
34 extern cvar_t gl_mesh_copyarrays;
35 extern cvar_t gl_paranoid;
36 extern cvar_t gl_printcheckerror;
37
38 //input to R_Mesh_TextureState
39 typedef struct rmeshstate_s
40 {
41         // textures
42         int tex1d[MAX_TEXTUREUNITS];
43         int tex[MAX_TEXTUREUNITS];
44         int tex3d[MAX_TEXTUREUNITS];
45         int texcubemap[MAX_TEXTUREUNITS];
46         // texture combine settings
47         int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
48         int texalphascale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
49         int texcombinergb[MAX_TEXTUREUNITS]; // works with or without combine for some operations
50         int texcombinealpha[MAX_TEXTUREUNITS]; // does nothing without combine
51         // matrices
52         matrix4x4_t texmatrix[MAX_TEXTUREUNITS];
53         // pointers
54         const float *pointer_texcoord[MAX_TEXTUREUNITS]; // 2D
55         const float *pointer_texcoord3f[MAX_TEXTUREUNITS]; // 3D
56 }
57 rmeshstate_t;
58
59 // adds console variables and registers the render module (only call from GL_Init)
60 void gl_backend_init(void);
61
62 // starts mesh rendering for the frame
63 void R_Mesh_Start(void);
64
65 // ends mesh rendering for the frame
66 // (only valid after R_Mesh_Start)
67 void R_Mesh_Finish(void);
68
69 // sets up the requested vertex transform matrix
70 void R_Mesh_Matrix(const matrix4x4_t *matrix);
71 // sets the vertex array pointer
72 void R_Mesh_VertexPointer(const float *vertex3f);
73 // sets the color array pointer (GL_Color only works when this is NULL)
74 void R_Mesh_ColorPointer(const float *color4f);
75 // sets the texcoord array pointer for an array unit
76 void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord);
77 // sets all textures bound to an image unit (multiple can be non-zero at once, according to OpenGL rules the highest one overrides the others)
78 void R_Mesh_TexBindAll(unsigned int unitnum, int tex1d, int tex2d, int tex3d, int texcubemap);
79 // sets these are like TexBindAll with only one of the texture indices non-zero
80 // (binds one texture type and unbinds all other types)
81 void R_Mesh_TexBind1D(unsigned int unitnum, int texnum);
82 void R_Mesh_TexBind(unsigned int unitnum, int texnum);
83 void R_Mesh_TexBind3D(unsigned int unitnum, int texnum);
84 void R_Mesh_TexBindCubeMap(unsigned int unitnum, int texnum);
85 // sets the texcoord matrix for a texenv unit
86 void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix);
87 // sets the combine state for a texenv unit
88 void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, int rgbscale, int alphascale);
89 // set up the requested texture state
90 void R_Mesh_TextureState(const rmeshstate_t *m);
91 // set up a blank texture state (faster/easier specialized version of R_Mesh_TextureState)
92 void R_Mesh_ResetTextureState(void);
93
94 // renders a mesh
95 void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements);
96 // renders a mesh as lines
97 void R_Mesh_Draw_ShowTris(int firstvertex, int numvertices, int numtriangles, const int *elements);
98
99 // saves a section of the rendered frame to a .tga or .jpg file
100 qboolean SCR_ScreenShot(char *filename, unsigned char *buffer1, unsigned char *buffer2, unsigned char *buffer3, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg, qboolean gammacorrect);
101 // used by R_Envmap_f and internally in backend, clears the frame
102 void R_ClearScreen(void);
103 // invoke refresh of frame
104 void SCR_UpdateScreen(void);
105 // invoke refresh of loading plaque (nothing else seen)
106 void SCR_UpdateLoadingScreen(void);
107
108 #endif
109