]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.h
you can now (try to) play in maps you don't have, and models you don't have are shown...
[xonotic/darkplaces.git] / gl_backend.h
index 9d1309218d244467f557fc9a489b82058e98f3cd..eac1e6d7a6237baf5bfc8965f7e794c351cf68df 100644 (file)
@@ -1,42 +1,63 @@
 
-#define MAX_TEXTUREUNITS 4
+#ifndef GL_BACKEND_H
+#define GL_BACKEND_H
 
-extern int c_meshtris;
+#define MAX_TEXTUREUNITS 8
+
+extern int c_meshtris, c_meshs, c_transtris, c_transmeshs;
 
 typedef struct
 {
-       int transparent;
+       //input to R_Mesh_Draw_GetBuffer
        int depthwrite; // force depth writing enabled even if polygon is not opaque
        int depthdisable; // disable depth read/write entirely
        int blendfunc1;
        int blendfunc2;
        int numtriangles;
-       int *index;
        int numverts;
+       int tex[MAX_TEXTUREUNITS];
+       int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
+       matrix4x4_t matrix; // model to world transform matrix
+
+       // output
+       int *index;
        float *vertex;
-       int vertexstep;
        float *color;
-       int colorstep;
-       // if color is NULL, these are used for all vertices
-       float cr, cg, cb, ca;
-       int tex[MAX_TEXTUREUNITS];
+       float colorscale;
        float *texcoords[MAX_TEXTUREUNITS];
-       int texcoordstep[MAX_TEXTUREUNITS];
-       float texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
 }
-rmeshinfo_t;
+rmeshbufferinfo_t;
 
 // adds console variables and registers the render module (only call from GL_Init)
 void gl_backend_init(void);
-// sets up mesh renderer for the frame
-void R_Mesh_Clear(void);
-// renders queued meshs
+
+// starts mesh rendering for the frame
+void R_Mesh_Start(float farclip);
+
+// ends mesh rendering for the frame
+// (only valid after R_Mesh_Start)
+void R_Mesh_Finish(void);
+
+// clears depth buffer, used for masked sky rendering
+// (only valid between R_Mesh_Start and R_Mesh_Finish)
+void R_Mesh_ClearDepth(void);
+
+// renders current batch of meshs
+// (only valid between R_Mesh_Start and R_Mesh_Finish)
 void R_Mesh_Render(void);
-// queues a mesh to be rendered (invokes Render if queue is full)
-void R_Mesh_Draw(const rmeshinfo_t *m);
-// renders the queued transparent meshs
-void R_Mesh_AddTransparent(void);
-// ease-of-use frontend to R_Mesh_Draw, set up meshinfo, except for index and numtriangles and numverts, then call this
-void R_Mesh_DrawPolygon(rmeshinfo_t *m, int numverts);
-// faster hardwired version of R_Mesh_Draw specifically for decals (has close ties to decal code)
-void R_Mesh_DrawDecal(const rmeshinfo_t *m);
+
+// allocates space in geometry buffers, and fills in pointers to the buffers in passsed struct
+// (it is up to the caller to fill in the geometry data)
+// (make sure you scale your colors by the colorscale field)
+// (only valid between R_Mesh_Start and R_Mesh_Finish)
+int R_Mesh_Draw_GetBuffer(rmeshbufferinfo_t *m, int wantoverbright);
+
+// saves a section of the rendered frame to a .tga file
+qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height);
+// used by R_Envmap_f and internally in backend, clears the frame
+void R_ClearScreen(void);
+// invoke refresh of frame
+void SCR_UpdateScreen (void);
+
+#endif
+