]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rsurf.c
implemented support for GL_ARB_texture_compression - this is controlled
[xonotic/darkplaces.git] / gl_rsurf.c
index 6f77b47fe094faac5cb1781d06d3aee1efc656c8..da62f71ecfca406fa0b92d7b24d0d0dc5e16d7af 100644 (file)
@@ -352,6 +352,7 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, const rtlight_t *r
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        GL_CullFace(GL_NONE);
        R_Mesh_Matrix(&identitymatrix);
@@ -929,6 +930,8 @@ void R_Q1BSP_CompileShadowVolume(entity_render_t *ent, vec3_t relativelightorigi
        r_shadow_compilingrtlight->static_meshchain_shadow = Mod_ShadowMesh_Finish(r_main_mempool, r_shadow_compilingrtlight->static_meshchain_shadow, false, false, true);
 }
 
+extern cvar_t r_polygonoffset_submodel_factor;
+extern cvar_t r_polygonoffset_submodel_offset;
 void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const vec3_t lightmins, const vec3_t lightmaxs)
 {
        model_t *model = ent->model;
@@ -939,6 +942,8 @@ void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin,
        if (!BoxesOverlap(model->normalmins, model->normalmaxs, lightmins, lightmaxs))
                return;
        R_UpdateAllTextureInfo(ent);
+       if (ent->model->brush.submodel)
+               GL_PolygonOffset(r_refdef.shadowpolygonfactor + r_polygonoffset_submodel_factor.value, r_refdef.shadowpolygonoffset + r_polygonoffset_submodel_offset.value);
        if (model->brush.shadowmesh)
        {
                R_Shadow_PrepareShadowMark(model->brush.shadowmesh->numtriangles);
@@ -967,6 +972,8 @@ void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin,
                }
                R_Shadow_VolumeFromList(model->surfmesh.num_vertices, model->surfmesh.num_triangles, rsurface.vertex3f, model->surfmesh.data_element3i, model->surfmesh.data_neighbor3i, relativelightorigin, relativelightdirection, projectdistance, numshadowmark, shadowmarklist);
        }
+       if (ent->model->brush.submodel)
+               GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);
 }
 
 #define BATCHSIZE 1024
@@ -1137,6 +1144,11 @@ void R_ReplaceWorldTexture (void)
        int                     i;
        const char      *r, *newt;
        skinframe_t *skinframe;
+       if (!r_refdef.worldmodel)
+       {
+               Con_Printf("There is no worldmodel\n");
+               return;
+       }
        m = r_refdef.worldmodel;
 
        if(Cmd_Argc() < 2)
@@ -1158,7 +1170,7 @@ void R_ReplaceWorldTexture (void)
        {
                if(t->width && !strcasecmp(t->name, r))
                {
-                       if ((skinframe = R_SkinFrame_LoadExternal((char*)newt, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true)))
+                       if ((skinframe = R_SkinFrame_LoadExternal((char*)newt, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP | TEXF_COMPRESS, true)))
                        {
                                t->skinframes[0] = skinframe;
                                Con_Printf("%s replaced with %s\n", r, newt);
@@ -1179,6 +1191,11 @@ void R_ListWorldTextures (void)
        model_t         *m;
        texture_t       *t;
        int                     i;
+       if (!r_refdef.worldmodel)
+       {
+               Con_Printf("There is no worldmodel\n");
+               return;
+       }
        m = r_refdef.worldmodel;
 
        Con_Print("Worldmodel textures :\n");