]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
*** empty log message ***
[xonotic/darkplaces.git] / gl_backend.c
index cb450bde6c68950a1a817ce2d2e6f92af2241031..730ce44b3afc676af660e1ee58767442b3fcfd21 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;
@@ -232,14 +229,17 @@ void GL_SetupView_Orientation_Identity (void)
        memset(&backend_modelmatrix, 0, sizeof(backend_modelmatrix));
 }
 
-void GL_SetupView_Orientation_FromEntity (vec3_t origin, vec3_t angles)
+void GL_SetupView_Orientation_FromEntity(matrix4x4_t *matrix)
 {
-       Matrix4x4_CreateRotate(&backend_viewmatrix, -90, 1, 0, 0);
-       Matrix4x4_ConcatRotate(&backend_viewmatrix, 90, 0, 0, 1);
-       Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[2], 1, 0, 0);
-       Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[0], 0, 1, 0);
-       Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[1], 0, 0, 1);
-       Matrix4x4_ConcatTranslate(&backend_viewmatrix, -origin[0], -origin[1], -origin[2]);
+       matrix4x4_t tempmatrix, basematrix;
+       Matrix4x4_Invert_Simple(&tempmatrix, matrix);
+       Matrix4x4_CreateRotate(&basematrix, -90, 1, 0, 0);
+       Matrix4x4_ConcatRotate(&basematrix, 90, 0, 0, 1);
+       Matrix4x4_Concat(&backend_viewmatrix, &basematrix, &tempmatrix);
+       //Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[2], 1, 0, 0);
+       //Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[0], 0, 1, 0);
+       //Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[1], 0, 0, 1);
+       //Matrix4x4_ConcatTranslate(&backend_viewmatrix, -origin[0], -origin[1], -origin[2]);
        memset(&backend_modelmatrix, 0, sizeof(backend_modelmatrix));
 }
 
@@ -609,7 +609,7 @@ 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);      
+       qglScissor(x, vid.realheight - (y + height),width,height);
        CHECKGLERROR
 }
 
@@ -617,7 +617,7 @@ void GL_ScissorTest(int state)
 {
        if(gl_state.scissortest == state)
                return;
-       
+
        CHECKGLERROR
        if((gl_state.scissortest = state))
                qglEnable(GL_SCISSOR_TEST);
@@ -939,7 +939,7 @@ void R_Mesh_State_Texture(const rmeshstate_t *m)
                {
                        GL_ActiveTexture(i);
                        unit->combinergb = combinergb;
-                       if (gl_combine.integer)
+                       if (gl_combine.integer) 
                        {
                                qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, unit->combinergb);CHECKGLERROR
                        }
@@ -1003,6 +1003,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
+}
+
 /*
 ==============================================================================
 
@@ -1087,11 +1100,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();