int HWDrawInfo::SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &lightdata, const secplane_t *plane) { if (Level->HasDynamicLights && !isFullbrightScene()) { Plane p; FLightNode * node = sub->section->lighthead; lightdata.Clear(); while (node) { FDynamicLight * light = node->lightsource; if (!light->IsActive()) { node = node->nextLight; continue; } iter_dlightf++; p.Set(plane->Normal(), plane->fD()); draw_dlightf += lightdata.GetLight(sub->sector->PortalGroup, p, light, true); node = node->nextLight; } return screen->mLights->UploadLights(lightdata); } else return -1; }
//========================================================================== // // Draw the plane segment into the gap // //========================================================================== void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, bool ceiling) { GLSectorPlane plane; int lightlevel; FColormap Colormap; FMaterial * gltexture; plane.GetFromSector(sec, ceiling); gltexture=FMaterial::ValidateTexture(plane.texture, false, true); if (!gltexture) return; if (isFullbrightScene()) { Colormap.Clear(); lightlevel=255; } else { Colormap = sec->Colormap; if (gltexture->tex->isFullbright()) { Colormap.MakeWhite(); lightlevel=255; } else lightlevel=abs(ceiling? sec->GetCeilingLight() : sec->GetFloorLight()); } int rel = getExtraLight(); SetColor(lightlevel, rel, Colormap, 1.0f); SetFog(lightlevel, rel, &Colormap, false); gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false); float fviewx = Viewpoint.Pos.X; float fviewy = Viewpoint.Pos.Y; float fviewz = Viewpoint.Pos.Z; gl_RenderState.SetPlaneTextureRotation(&plane, gltexture); gl_RenderState.Apply(); float prj_fac1 = (planez-fviewz)/(ws->z1-fviewz); float prj_fac2 = (planez-fviewz)/(ws->z2-fviewz); float px1 = fviewx + prj_fac1 * (ws->x1-fviewx); float py1 = fviewy + prj_fac1 * (ws->y1-fviewy); float px2 = fviewx + prj_fac2 * (ws->x1-fviewx); float py2 = fviewy + prj_fac2 * (ws->y1-fviewy); float px3 = fviewx + prj_fac2 * (ws->x2-fviewx); float py3 = fviewy + prj_fac2 * (ws->y2-fviewy); float px4 = fviewx + prj_fac1 * (ws->x2-fviewx); float py4 = fviewy + prj_fac1 * (ws->y2-fviewy); FQuadDrawer qd; qd.Set(0, px1, planez, py1, px1 / 64, -py1 / 64); qd.Set(1, px2, planez, py2, px2 / 64, -py2 / 64); qd.Set(2, px3, planez, py3, px3 / 64, -py3 / 64); qd.Set(3, px4, planez, py4, px4 / 64, -py4 / 64); qd.Render(GL_TRIANGLE_FAN); gl_RenderState.EnableTextureMatrix(false); }