if (e == &cl.viewent && cl.viewentity >= 0 && cl.viewentity < MAX_EDICTS && cl_entities[cl.viewentity].state_current.active)
{
e->state_current.alpha = cl_entities[cl.viewentity].state_current.alpha;
- e->state_current.effects = EF_NOSHADOW | (cl_entities[cl.viewentity].state_current.effects & (EF_ADDITIVE | EF_REFLECTIVE | EF_FULLBRIGHT));
+ e->state_current.effects = EF_NOSHADOW | (cl_entities[cl.viewentity].state_current.effects & (EF_ADDITIVE | EF_REFLECTIVE | EF_FULLBRIGHT | EF_NODEPTHTEST));
}
}
else
if (e - cl_entities == cl.viewentity)
e->render.flags |= RENDER_EXTERIORMODEL;
// transparent stuff can't be lit during the opaque stage
- if (e->render.effects & (EF_ADDITIVE) || e->render.alpha < 1)
+ if (e->render.effects & (EF_ADDITIVE | EF_NODEPTHTEST) || e->render.alpha < 1)
e->render.flags |= RENDER_TRANSPARENT;
// either fullbright or lit
if (!(e->render.effects & EF_FULLBRIGHT) && !r_fullbright.integer)
Mod_CheckLoaded(e->render.model);
e->render.flags = 0;
// transparent stuff can't be lit during the opaque stage
- if (e->render.effects & (EF_ADDITIVE) || e->render.alpha < 1)
+ if (e->render.effects & (EF_ADDITIVE | EF_NODEPTHTEST) || e->render.alpha < 1)
e->render.flags |= RENDER_TRANSPARENT;
// either fullbright or lit
if (!(e->render.effects & EF_FULLBRIGHT) && !r_fullbright.integer)
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
}
- GL_DepthTest(true);
+ GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
firstpass = false;
colorscale = 1.0f;
for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++)
{
if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_FetchAliasSkin(ent, mesh)->flags & ALIASSKIN_TRANSPARENT)
- R_MeshQueue_AddTransparent(ent->origin, R_DrawAliasModelCallback, ent, meshnum);
+ R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : ent->origin, R_DrawAliasModelCallback, ent, meshnum);
else
R_DrawAliasModelCallback(ent, meshnum);
}
R_LerpAnimation(ent);
R_UpdateEntLights(ent);
if ((chase_active.integer || !(ent->flags & RENDER_EXTERIORMODEL))
- && !VIS_CullBox(ent->mins, ent->maxs)
+ && (!VIS_CullBox(ent->mins, ent->maxs) || (ent->effects & EF_NODEPTHTEST))
&& (!envmap || !(ent->flags & (RENDER_VIEWMODEL | RENDER_EXTERIORMODEL))))
ent->visframe = r_framecount;
}
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
}
- GL_DepthTest(true);
+ GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
if (fogenabled)
{
memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
void R_DrawNoModel(entity_render_t *ent)
{
//if ((ent->effects & EF_ADDITIVE) || (ent->alpha < 1))
- R_MeshQueue_AddTransparent(ent->origin, R_DrawNoModelCallback, ent, 0);
+ R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : ent->origin, R_DrawNoModelCallback, ent, 0);
//else
// R_DrawNoModelCallback(ent, 0);
}
// LordHavoc: HalfLife maps have freaky skypolys...
if (ent->model->brush.ishlbsp)
return;
+ // sky rendering transparently would be too difficult
+ if (ent->flags & RENDER_TRANSPARENT)
+ return;
if (skyrendernow)
{
if (surf->flags & SURF_WATERALPHA)
currentalpha *= r_wateralpha.value;
- GL_DepthTest(true);
+ GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
if (ent->effects & EF_ADDITIVE)
{
rendertype = SURFRENDER_ADD;
{
rendertype = SURFRENDER_OPAQUE;
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_DepthMask(true);
+ GL_DepthMask(!(ent->effects & EF_NODEPTHTEST));
}
turb = (surf->flags & SURF_DRAWTURB) && r_waterscroll.value;
if (surf->visframe == r_framecount)
{
Matrix4x4_Transform(&ent->matrix, surf->poly_center, center);
- R_MeshQueue_AddTransparent(center, RSurfShader_Transparent_Callback, ent, surf - ent->model->brushq1.surfaces);
+ R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : center, RSurfShader_Transparent_Callback, ent, surf - ent->model->brushq1.surfaces);
}
}
}
else
{
Matrix4x4_Transform(&ent->matrix, surf->poly_center, center);
- R_MeshQueue_AddTransparent(center, RSurfShader_Transparent_Callback, ent, surf - ent->model->brushq1.surfaces);
+ R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : center, RSurfShader_Transparent_Callback, ent, surf - ent->model->brushq1.surfaces);
}
}
}
rmeshstate_t m;
if (!face->num_triangles)
return;
+ // drawing sky transparently would be too difficult
+ if (ent->flags & RENDER_TRANSPARENT)
+ return;
c_faces++;
if (skyrendernow)
{
else
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
- GL_DepthTest(true);
+ GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
m.tex[0] = R_GetTexture(face->texture->skin.base);
m.pointer_texcoord[0] = face->data_texcoordtexture2f;
colorscale = r_lightmapintensity;
facecenter[1] = (face->mins[1] + face->maxs[1]) * 0.5f;
facecenter[2] = (face->mins[2] + face->maxs[2]) * 0.5f;
Matrix4x4_Transform(&ent->matrix, facecenter, center);
- R_MeshQueue_AddTransparent(center, R_Q3BSP_DrawFace_TransparentCallback, ent, face - ent->model->brushq3.data_faces);
+ R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : center, R_Q3BSP_DrawFace_TransparentCallback, ent, face - ent->model->brushq3.data_faces);
return;
}
R_Mesh_Matrix(&ent->matrix);
"DP_EF_BLUE "
"DP_EF_FLAME "
"DP_EF_FULLBRIGHT "
+"DP_EF_NODEPTHTEST "
"DP_EF_NODRAW "
"DP_EF_NOSHADOW "
"DP_EF_RED "
#define EF_FLAME 1024 // LordHavoc: on fire
#define EF_STARDUST 2048 // LordHavoc: showering sparks
#define EF_NOSHADOW 4096 // LordHavoc: does not cast a shadow
+#define EF_NODEPTHTEST 8192 // LordHavoc: shows through walls
#define EF_STEP 0x80000000 // internal client use only - present on MOVETYPE_STEP entities, not QC accessible (too many bits)
bumptexture = r_shadow_blankbumptexture;
if (!glosstexture)
glosstexture = r_shadow_blankglosstexture;
+ // FIXME: support EF_NODEPTHTEST
GL_DepthMask(false);
GL_DepthTest(true);
if (gl_dot3arb && gl_texturecubemap && gl_combine.integer && gl_stencil)
c_sprites++;
- R_MeshQueue_AddTransparent(ent->origin, R_DrawSpriteModelCallback, ent, 0);
+ R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : ent->origin, R_DrawSpriteModelCallback, ent, 0);
}
}
// always send world submodels, they don't generate much traffic
// except in PROTOCOL_QUAKE where they hog bandwidth like crazy
- else if (!(isbmodel = (model = sv.models[s->modelindex]) != NULL && model->name[0] == '*') || sv.protocol == PROTOCOL_QUAKE)
+ else if ((!(isbmodel = (model = sv.models[s->modelindex]) != NULL && model->name[0] == '*') && !(s->effects & EF_NODEPTHTEST)) || sv.protocol == PROTOCOL_QUAKE)
{
Mod_CheckLoaded(model);
// entity has survived every check so far, check if visible