]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
q3bsp transparency support (note: makes maps that abuse alpha in shaders for special...
[xonotic/darkplaces.git] / gl_backend.c
index c3eef34081e835296f1a08800b37a1663fa55521..56518855485b052fbd0b88d64e2ae7911ae77624 100644 (file)
@@ -72,9 +72,6 @@ int c_meshs, c_meshelements;
 
 void SCR_ScreenShot_f (void);
 
-// these are externally accessible
-int r_lightmapscalebit;
-
 static matrix4x4_t backend_viewmatrix;
 static matrix4x4_t backend_modelmatrix;
 static matrix4x4_t backend_modelviewmatrix;
@@ -344,6 +341,7 @@ static struct
        int blend;
        GLboolean depthmask;
        int depthtest;
+       int scissortest;
        int unit;
        int clientunit;
        gltextureunit_t units[MAX_TEXTUREUNITS];
@@ -605,6 +603,26 @@ void GL_LockArrays(int first, int count)
        }
 }
 
+void GL_Scissor (int x, int y, int width, int height)
+{
+       CHECKGLERROR
+       qglScissor(x, vid.realheight - (y + height),width,height);
+       CHECKGLERROR
+}
+
+void GL_ScissorTest(int state)
+{
+       if(gl_state.scissortest == state)
+               return;
+
+       CHECKGLERROR
+       if((gl_state.scissortest = state))
+               qglEnable(GL_SCISSOR_TEST);
+       else
+               qglDisable(GL_SCISSOR_TEST);
+       CHECKGLERROR
+}
+
 void GL_TransformToScreen(const vec4_t in, vec4_t out)
 {
        vec4_t temp;
@@ -982,6 +1000,19 @@ void R_Mesh_State_Texture(const rmeshstate_t *m)
        }
 }
 
+void R_Mesh_Draw_ShowTris(int numverts, int numtriangles, int *elements)
+{
+       qglBegin(GL_LINES);
+       for (;numtriangles;numtriangles--, elements += 3)
+       {
+               qglArrayElement(elements[0]);qglArrayElement(elements[1]);
+               qglArrayElement(elements[1]);qglArrayElement(elements[2]);
+               qglArrayElement(elements[2]);qglArrayElement(elements[0]);
+       }
+       qglEnd();
+       CHECKGLERROR
+}
+
 /*
 ==============================================================================
 
@@ -1066,11 +1097,6 @@ void SCR_UpdateScreen (void)
        if (gl_combine.integer && (!gl_combine_extension || r_textureunits.integer < 2))
                Cvar_SetValueQuick(&gl_combine, 0);
 
-       // lightmaps only
-       r_lightmapscalebit = 0;
-       if (gl_combine.integer && r_textureunits.integer > 1)
-               r_lightmapscalebit += 2;
-
        R_TimeReport("setup");
 
        R_ClearScreen();