void GLWall::SkyNormal(sector_t * fs,vertex_t * v1,vertex_t * v2) { ztop[0]=ztop[1]=32768.0f; zbottom[0]=zceil[0]; zbottom[1]=zceil[1]; SkyPlane(fs, sector_t::ceiling, true); ztop[0]=zfloor[0]; ztop[1]=zfloor[1]; zbottom[0]=zbottom[1]=-32768.0f; SkyPlane(fs, sector_t::floor, true); }
void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2) { if (fs->GetTexture(sector_t::floor)==skyflatnum) { if ((bs->special&0xff) == NoSkyDraw) return; FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); // For lower skies the normal logic only applies to walls with no lower texture! if (tex->UseType==FTexture::TEX_Null) { if (bs->GetTexture(sector_t::floor)==skyflatnum) { // if the back sector is closed the sky must be drawn! if (bs->ceilingplane.ZatPoint(v1) > bs->floorplane.ZatPoint(v1) || bs->ceilingplane.ZatPoint(v2) > bs->floorplane.ZatPoint(v2)) return; } else { // Special hack for Vrack2b if (bs->floorplane.ZatPoint(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy)) > FIXED2FLOAT(viewz)) return; } } zbottom[0]=zbottom[1]=-32768.0f; if ((tex && tex->UseType!=FTexture::TEX_Null) || bs->GetTexture(sector_t::floor)!=skyflatnum) { ztop[0]=zfloor[0]; ztop[1]=zfloor[1]; } else { ztop[0]=FIXED2FLOAT(bs->floorplane.ZatPoint(v1)); ztop[1]=FIXED2FLOAT(bs->floorplane.ZatPoint(v2)); flags|=GLWF_SKYHACK; // mid textures on such lines need special treatment! } } else { FPortal *pfront = fs->portals[sector_t::floor]; FPortal *pback = bs->portals[sector_t::floor]; float frontreflect = fs->GetReflect(sector_t::floor); if (frontreflect > 0) { float backreflect = bs->GetReflect(sector_t::floor); if (backreflect > 0 && bs->floorplane.d == fs->floorplane.d) { // Don't add intra-portal line to the portal. return; } } else if (pfront == NULL || pfront == pback) { return; } // stacked sectors fixed_t fsc1=fs->floorplane.ZatPoint(v1); fixed_t fsc2=fs->floorplane.ZatPoint(v2); zbottom[0]=zbottom[1]=-32768.0f; ztop[0]=FIXED2FLOAT(fsc1); ztop[1]=FIXED2FLOAT(fsc2); } SkyPlane(fs, sector_t::floor, true); }
void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2) { if (fs->GetTexture(sector_t::ceiling)==skyflatnum) { if ((bs->special&0xff) == NoSkyDraw) return; if (bs->GetTexture(sector_t::ceiling)==skyflatnum) { // if the back sector is closed the sky must be drawn! if (bs->ceilingplane.ZatPoint(v1) > bs->floorplane.ZatPoint(v1) || bs->ceilingplane.ZatPoint(v2) > bs->floorplane.ZatPoint(v2) || bs->transdoor) return; // one more check for some ugly transparent door hacks if (bs->floorplane.a==0 && bs->floorplane.b==0 && fs->floorplane.a==0 && fs->floorplane.b==0) { if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+FRACUNIT) { FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); if (!tex || tex->UseType==FTexture::TEX_Null) return; // very, very, very ugly special case (See Icarus MAP14) // It is VERY important that this is only done for a floor height difference of 1 // or it will cause glitches elsewhere. tex = TexMan(seg->sidedef->GetTexture(side_t::mid)); if (tex != NULL && !(seg->linedef->flags & ML_DONTPEGTOP) && seg->sidedef->GetTextureYOffset(side_t::mid) > 0) { ztop[0]=ztop[1]=32768.0f; zbottom[0]=zbottom[1]= FIXED2FLOAT(bs->ceilingplane.ZatPoint(v2) + seg->sidedef->GetTextureYOffset(side_t::mid)); SkyPlane(fs, sector_t::ceiling, false); return; } } } } ztop[0]=ztop[1]=32768.0f; FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top)); if (bs->GetTexture(sector_t::ceiling) != skyflatnum) { zbottom[0]=zceil[0]; zbottom[1]=zceil[1]; } else { zbottom[0]=FIXED2FLOAT(bs->ceilingplane.ZatPoint(v1)); zbottom[1]=FIXED2FLOAT(bs->ceilingplane.ZatPoint(v2)); flags|=GLWF_SKYHACK; // mid textures on such lines need special treatment! } } else { FPortal *pfront = fs->portals[sector_t::ceiling]; FPortal *pback = bs->portals[sector_t::ceiling]; float frontreflect = fs->GetReflect(sector_t::ceiling); if (frontreflect > 0) { float backreflect = bs->GetReflect(sector_t::ceiling); if (backreflect > 0 && bs->ceilingplane.d == fs->ceilingplane.d) { // Don't add intra-portal line to the portal. return; } } else if (pfront == NULL || pfront == pback) { return; } // stacked sectors fixed_t fsc1=fs->ceilingplane.ZatPoint(v1); fixed_t fsc2=fs->ceilingplane.ZatPoint(v2); ztop[0]=ztop[1]=32768.0f; zbottom[0]=FIXED2FLOAT(fsc1); zbottom[1]=FIXED2FLOAT(fsc2); } SkyPlane(fs, sector_t::ceiling, true); }
void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2) { if (fs->GetTexture(sector_t::floor)==skyflatnum) { if (bs->special == GLSector_NoSkyDraw) return; FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); // For lower skies the normal logic only applies to walls with no lower texture! if (tex->UseType==FTexture::TEX_Null) { if (bs->GetTexture(sector_t::floor)==skyflatnum) { // if the back sector is closed the sky must be drawn! if (bs->ceilingplane.ZatPoint(v1) > bs->floorplane.ZatPoint(v1) || bs->ceilingplane.ZatPoint(v2) > bs->floorplane.ZatPoint(v2)) return; } else { // Special hack for Vrack2b if (bs->floorplane.ZatPoint(ViewPos) > ViewPos.Z) return; } } zbottom[0]=zbottom[1]=-32768.0f; if ((tex && tex->UseType!=FTexture::TEX_Null) || bs->GetTexture(sector_t::floor)!=skyflatnum) { ztop[0]=zfloor[0]; ztop[1]=zfloor[1]; } else { ztop[0] = bs->floorplane.ZatPoint(v1); ztop[1] = bs->floorplane.ZatPoint(v2); flags|=GLWF_SKYHACK; // mid textures on such lines need special treatment! } } else { float frontreflect = fs->GetReflect(sector_t::floor); if (frontreflect > 0) { float backreflect = bs->GetReflect(sector_t::floor); if (backreflect > 0 && bs->floorplane.fD() == fs->floorplane.fD()) { // Don't add intra-portal line to the portal. return; } } else { int type = fs->GetPortalType(sector_t::floor); if (type == PORTS_STACKEDSECTORTHING || type == PORTS_PORTAL || type == PORTS_LINKEDPORTAL) { FPortal *pfront = fs->GetGLPortal(sector_t::floor); FPortal *pback = bs->GetGLPortal(sector_t::floor); if (pfront == NULL || fs->PortalBlocksView(sector_t::floor)) return; if (pfront == pback && !bs->PortalBlocksView(sector_t::floor)) return; } } // stacked sectors zbottom[0]=zbottom[1]=-32768.0f; ztop[0] = fs->floorplane.ZatPoint(v1); ztop[1] = fs->floorplane.ZatPoint(v2); } SkyPlane(fs, sector_t::floor, true); }
void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2) { if (fs->GetTexture(sector_t::ceiling)==skyflatnum) { if (bs->special == GLSector_NoSkyDraw) return; if (bs->GetTexture(sector_t::ceiling)==skyflatnum) { // if the back sector is closed the sky must be drawn! if (bs->ceilingplane.ZatPoint(v1) > bs->floorplane.ZatPoint(v1) || bs->ceilingplane.ZatPoint(v2) > bs->floorplane.ZatPoint(v2) || bs->transdoor) return; // one more check for some ugly transparent door hacks if (!bs->floorplane.isSlope() && !fs->floorplane.isSlope()) { if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+1.) { FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); if (!tex || tex->UseType==FTexture::TEX_Null) return; // very, very, very ugly special case (See Icarus MAP14) // It is VERY important that this is only done for a floor height difference of 1 // or it will cause glitches elsewhere. tex = TexMan(seg->sidedef->GetTexture(side_t::mid)); if (tex != NULL && !(seg->linedef->flags & ML_DONTPEGTOP) && seg->sidedef->GetTextureYOffset(side_t::mid) > 0) { ztop[0]=ztop[1]=32768.0f; zbottom[0]=zbottom[1]= bs->ceilingplane.ZatPoint(v2) + seg->sidedef->GetTextureYOffset(side_t::mid); SkyPlane(fs, sector_t::ceiling, false); return; } } } } ztop[0]=ztop[1]=32768.0f; FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top)); if (bs->GetTexture(sector_t::ceiling) != skyflatnum) { zbottom[0]=zceil[0]; zbottom[1]=zceil[1]; } else { zbottom[0] = bs->ceilingplane.ZatPoint(v1); zbottom[1] = bs->ceilingplane.ZatPoint(v2); flags|=GLWF_SKYHACK; // mid textures on such lines need special treatment! } } else { float frontreflect = fs->GetReflect(sector_t::ceiling); if (frontreflect > 0) { float backreflect = bs->GetReflect(sector_t::ceiling); if (backreflect > 0 && bs->ceilingplane.fD() == fs->ceilingplane.fD()) { // Don't add intra-portal line to the portal. return; } } else { int type = fs->GetPortalType(sector_t::ceiling); if (type == PORTS_STACKEDSECTORTHING || type == PORTS_PORTAL || type == PORTS_LINKEDPORTAL) { FPortal *pfront = fs->GetGLPortal(sector_t::ceiling); FPortal *pback = bs->GetGLPortal(sector_t::ceiling); if (pfront == NULL || fs->PortalBlocksView(sector_t::ceiling)) return; if (pfront == pback && !bs->PortalBlocksView(sector_t::ceiling)) return; } } // stacked sectors ztop[0] = ztop[1] = 32768.0f; zbottom[0] = fs->ceilingplane.ZatPoint(v1); zbottom[1] = fs->ceilingplane.ZatPoint(v2); } SkyPlane(fs, sector_t::ceiling, true); }