From: havoc Date: Tue, 10 Jan 2006 14:35:45 +0000 (+0000) Subject: added EF_DOUBLESIDED (and internally RENDER_NOCULLFACE) X-Git-Tag: xonotic-v0.1.0preview~4401 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e537c2269e790f67f68556ded6b7cf62c55874dd;p=xonotic%2Fdarkplaces.git added EF_DOUBLESIDED (and internally RENDER_NOCULLFACE) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5892 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index f9ba488f..0606a8d6 100644 --- 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; diff --git a/gl_rmain.c b/gl_rmain.c index 485b446d..d8970209 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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); } diff --git a/gl_rsurf.c b/gl_rsurf.c index 1ebb0c88..2c900851 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -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); } diff --git a/protocol.h b/protocol.h index 27fbf6e2..0b566fbb 100644 --- a/protocol.h +++ b/protocol.h @@ -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 diff --git a/r_shadow.c b/r_shadow.c index 1631a3ad..d3894d5b 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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);