]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added EF_DOUBLESIDED (and internally RENDER_NOCULLFACE)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 Jan 2006 14:35:45 +0000 (14:35 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 Jan 2006 14:35:45 +0000 (14:35 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5892 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
gl_rmain.c
gl_rsurf.c
protocol.h
r_shadow.c

index f9ba488f60ce94f5da2bdb8c65064e5f15e53552..0606a8d60653c490c55ec7383c0b14559f1e9c04 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1030,6 +1030,10 @@ void CL_LinkNetworkEntity(entity_t *e)
                // transparent stuff can't be lit during the opaque stage
                if (e->render.effects & (EF_ADDITIVE | EF_NODEPTHTEST) || e->render.alpha < 1)
                        e->render.flags |= RENDER_TRANSPARENT;
+               // double sided rendering mode causes backfaces to be visible
+               // (mostly useful on transparent stuff)
+               if (e->render.effects & EF_DOUBLESIDED)
+                       e->render.flags |= RENDER_NOCULLFACE;
                // either fullbright or lit
                if (!(e->render.effects & EF_FULLBRIGHT) && !r_fullbright.integer)
                        e->render.flags |= RENDER_LIGHT;
index 485b446d3d52204157ada733c63a4ebf980af16a..d8970209ef4725c999e12ea3e2ba284eeca5faf2 100644 (file)
@@ -1880,7 +1880,7 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text
        // FIXME: identify models using a better check than ent->model->brush.shadowmesh
        lightmode = ((ent->effects & EF_FULLBRIGHT) || ent->model->brush.shadowmesh) ? 0 : 2;
        GL_DepthTest(!(texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
-       if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
+       if ((texture->textureflags & Q3TEXTUREFLAG_TWOSIDED) || (ent->flags & RENDER_NOCULLFACE))
                qglDisable(GL_CULL_FACE);
        if (texture->currentnumlayers)
        {
@@ -2174,7 +2174,7 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text
                        }
                }
        }
-       if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
+       if ((texture->textureflags & Q3TEXTUREFLAG_TWOSIDED) || (ent->flags & RENDER_NOCULLFACE))
                qglEnable(GL_CULL_FACE);
 }
 
index 1ebb0c88c78ad821fc28e2ace64051082a95f3a5..2c90085192605571413461560f5e9a8665784746 100644 (file)
@@ -703,7 +703,7 @@ void R_Q1BSP_CompileShadowVolume(entity_render_t *ent, vec3_t relativelightorigi
                texture = surface->texture;
                if ((texture->basematerialflags & (MATERIALFLAG_NODRAW | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_WALL)) != MATERIALFLAG_WALL)
                        continue;
-               if (texture->textureflags & (Q3TEXTUREFLAG_TWOSIDED | Q3TEXTUREFLAG_AUTOSPRITE | Q3TEXTUREFLAG_AUTOSPRITE2))
+               if ((texture->textureflags & (Q3TEXTUREFLAG_TWOSIDED | Q3TEXTUREFLAG_AUTOSPRITE | Q3TEXTUREFLAG_AUTOSPRITE2)) || (ent->flags & RENDER_NOCULLFACE))
                        continue;
                R_Shadow_MarkVolumeFromBox(surface->num_firstshadowmeshtriangle, surface->num_triangles, model->brush.shadowmesh->vertex3f, model->brush.shadowmesh->element3i, relativelightorigin, r_shadow_compilingrtlight->cullmins, r_shadow_compilingrtlight->cullmaxs, surface->mins, surface->maxs);
        }
@@ -740,7 +740,7 @@ void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin,
                        texture = surface->texture->currentframe;
                        if ((texture->currentmaterialflags & (MATERIALFLAG_NODRAW | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_WALL)) != MATERIALFLAG_WALL)
                                continue;
-                       if (texture->textureflags & (Q3TEXTUREFLAG_TWOSIDED | Q3TEXTUREFLAG_AUTOSPRITE | Q3TEXTUREFLAG_AUTOSPRITE2))
+                       if ((texture->textureflags & (Q3TEXTUREFLAG_TWOSIDED | Q3TEXTUREFLAG_AUTOSPRITE | Q3TEXTUREFLAG_AUTOSPRITE2)) || (ent->flags & RENDER_NOCULLFACE))
                                continue;
                        R_Shadow_MarkVolumeFromBox(surface->num_firstshadowmeshtriangle, surface->num_triangles, model->brush.shadowmesh->vertex3f, model->brush.shadowmesh->element3i, relativelightorigin, lightmins, lightmaxs, surface->mins, surface->maxs);
                }
index 27fbf6e2fce1e52e4486614562b91dd677c86dff..0b566fbbba975b248d81bec6d0bbe500393b5b2b 100644 (file)
@@ -58,6 +58,7 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #define EF_NOSHADOW                            4096    // LordHavoc: does not cast a shadow
 #define EF_NODEPTHTEST                 8192    // LordHavoc: shows through walls
 #define EF_SELECTABLE                  16384   // LordHavoc: highlights when PRYDON_CLIENTCURSOR mouse is over it
+#define EF_DOUBLESIDED                 32768   //[515]: disable cull face for this entity
 
 #define EF_STEP                                        0x80000000 // internal client use only - present on MOVETYPE_STEP entities, not QC accessible (too many bits)
 
@@ -315,6 +316,7 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #define RENDER_SHADOW 65536 // cast shadow
 #define RENDER_LIGHT 131072 // receive light
 #define RENDER_TRANSPARENT 262144 // can't light during opaque stage
+#define RENDER_NOCULLFACE 524288 // render as double sided (disable GL_CULL_FACE)
 
 // this is 80 bytes
 typedef struct entity_state_s
index 1631a3adbee6c5cc523bd90a744210a0f702d14f..d3894d5b77cbe5c5e6da32bd91d7dd0fb447e489 100644 (file)
@@ -2528,7 +2528,7 @@ void R_Shadow_RenderSurfacesLighting(const entity_render_t *ent, const texture_t
        rtexture_t *basetexture;
        rtexture_t *glosstexture;
        float specularscale;
-       if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
+       if ((texture->textureflags & Q3TEXTUREFLAG_TWOSIDED) || (ent->flags & RENDER_NOCULLFACE))
                qglDisable(GL_CULL_FACE);
        else
                qglEnable(GL_CULL_FACE);