]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
Added snd_channellayout to configure the speaker layout dynamically (0: auto, 1:...
[xonotic/darkplaces.git] / gl_rmain.c
index 594d871e1e67ad8c3a1c54966c2bb29ef135a64e..88c6e0bf63faee98fc84eaf6e3593efe7daf8f62 100644 (file)
@@ -43,6 +43,7 @@ cvar_t r_showcollisionbrushes = {0, "r_showcollisionbrushes", "0", "draws collis
 cvar_t r_showcollisionbrushes_polygonfactor = {0, "r_showcollisionbrushes_polygonfactor", "-1", "expands outward the brush polygons a little bit, used to make collision brushes appear infront of walls"};
 cvar_t r_showcollisionbrushes_polygonoffset = {0, "r_showcollisionbrushes_polygonoffset", "0", "nudges brush polygon depth in hardware depth units, used to make collision brushes appear infront of walls"};
 cvar_t r_showdisabledepthtest = {0, "r_showdisabledepthtest", "0", "disables depth testing on r_show* cvars, allowing you to see what hidden geometry the graphics card is processing"};
+cvar_t r_drawportals = {0, "r_drawportals", "0", "shows portals (separating polygons) in world interior in quake1 maps"};
 cvar_t r_drawentities = {0, "r_drawentities","1", "draw entities (doors, players, projectiles, etc)"};
 cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1", "draw your weapon model"};
 cvar_t r_speeds = {0, "r_speeds","0", "displays rendering statistics and per-subsystem timings"};
@@ -983,6 +984,7 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable(&r_showcollisionbrushes_polygonfactor);
        Cvar_RegisterVariable(&r_showcollisionbrushes_polygonoffset);
        Cvar_RegisterVariable(&r_showdisabledepthtest);
+       Cvar_RegisterVariable(&r_drawportals);
        Cvar_RegisterVariable(&r_drawentities);
        Cvar_RegisterVariable(&r_drawviewmodel);
        Cvar_RegisterVariable(&r_speeds);
@@ -1701,6 +1703,7 @@ void CSQC_R_RenderScene (void)
 
 extern void R_DrawLightningBeams (void);
 extern void VM_AddPolygonsToMeshQueue (void);
+extern void R_DrawPortals (void);
 void R_RenderScene(void)
 {
        // don't let sound skip if going slow
@@ -1790,12 +1793,32 @@ void R_RenderScene(void)
                        R_TimeReport("explosions");
        }
 
+       if (gl_support_fragment_shader)
+       {
+               qglUseProgramObjectARB(0);CHECKGLERROR
+       }
        VM_AddPolygonsToMeshQueue();
 
+       if (r_drawportals.integer)
+       {
+               R_DrawPortals();
+               if (r_timereport_active)
+                       R_TimeReport("portals");
+       }
+
+       if (gl_support_fragment_shader)
+       {
+               qglUseProgramObjectARB(0);CHECKGLERROR
+       }
        R_MeshQueue_RenderTransparent();
        if (r_timereport_active)
                R_TimeReport("drawtrans");
 
+       if (gl_support_fragment_shader)
+       {
+               qglUseProgramObjectARB(0);CHECKGLERROR
+       }
+
        if (cl.csqc_vidvars.drawworld)
        {
                R_DrawCoronas();
@@ -2156,7 +2179,14 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                if (s > 0)
                        t = t + s * model->num_surfaces;
                if (t->animated)
-                       t = t->anim_frames[ent->frame != 0][(t->anim_total[ent->frame != 0] >= 2) ? ((int)(r_refdef.time * 5.0f) % t->anim_total[ent->frame != 0]) : 0];
+               {
+                       // use an alternate animation if the entity's frame is not 0,
+                       // and only if the texture has an alternate animation
+                       if (ent->frame != 0 && t->anim_total[1])
+                               t = t->anim_frames[1][(t->anim_total[1] >= 2) ? ((int)(r_refdef.time * 5.0f) % t->anim_total[1]) : 0];
+                       else
+                               t = t->anim_frames[0][(t->anim_total[0] >= 2) ? ((int)(r_refdef.time * 5.0f) % t->anim_total[0]) : 0];
+               }
                texture->currentframe = t;
        }
 
@@ -2358,7 +2388,7 @@ void RSurf_ActiveEntity(const entity_render_t *ent, qboolean wantnormals, qboole
                R_Mesh_ResizeArrays(rsurface_model->surfmesh.num_vertices);
        R_Mesh_Matrix(&ent->matrix);
        Matrix4x4_Transform(&ent->inversematrix, r_view.origin, rsurface_modelorg);
-       if ((rsurface_entity->frameblend[0].lerp != 1 || rsurface_entity->frameblend[0].frame != 0) && (rsurface_model->surfmesh.data_morphvertex3f || rsurface_model->surfmesh.data_vertexweightindex4i))
+       if ((rsurface_entity->frameblend[0].lerp != 1 || rsurface_entity->frameblend[0].frame != 0) && rsurface_model->surfmesh.isanimated)
        {
                if (wanttangents)
                {