Example #1
0
void GLWall::SkyLine(sector_t *fs, line_t *line)
{
	FSectorPortal *secport = line->GetTransferredPortal();
	GLSkyInfo skyinfo;
	int ptype;

	// JUSTHIT is used as an indicator that a skybox is in use.
	// This is to avoid recursion

	if (!gl_noskyboxes && secport && (secport->mSkybox == nullptr || !(secport->mFlags & PORTSF_INSKYBOX)))
	{
		ptype = PORTALTYPE_SKYBOX;
		secportal = secport;
	}
	else
	{
		skyinfo.init(fs->sky, Colormap.FadeColor);
		ptype = PORTALTYPE_SKY;
		sky = UniqueSkies.Get(&skyinfo);
	}
	ztop[0] = zceil[0];
	ztop[1] = zceil[1];
	zbottom[0] = zfloor[0];
	zbottom[1] = zfloor[1];
	PutPortal(ptype);
}
Example #2
0
void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect)
{
	int ptype = -1;

	FSectorPortal *sportal = sector->ValidatePortal(plane);
	if (sportal != nullptr && sportal->mFlags & PORTSF_INSKYBOX) sportal = nullptr;	// no recursions, delete it here to simplify the following code

	// Either a regular sky or a skybox with skyboxes disabled
	if ((sportal == nullptr && sector->GetTexture(plane) == skyflatnum) || (gl_noskyboxes && sportal != nullptr && sportal->mType == PORTS_SKYVIEWPOINT))
	{
		GLSkyInfo skyinfo;
		skyinfo.init(sector->sky, Colormap.FadeColor);
		ptype = PORTALTYPE_SKY;
		sky = UniqueSkies.Get(&skyinfo);
	}
	else if (sportal != nullptr)
	{
		switch (sportal->mType)
		{
		case PORTS_STACKEDSECTORTHING:
		case PORTS_PORTAL:
		case PORTS_LINKEDPORTAL:
		{
			FPortal *glport = sector->GetGLPortal(plane);
			if (glport != NULL)
			{
				if (sector->PortalBlocksView(plane)) return;

				if (GLPortal::instack[1 - plane]) return;
				ptype = PORTALTYPE_SECTORSTACK;
				portal = glport;
			}
			break;
		}

		case PORTS_SKYVIEWPOINT:
		case PORTS_HORIZON:
		case PORTS_PLANE:
			ptype = PORTALTYPE_SKYBOX;
			secportal = sportal;
			break;
		}
	}
	else if (allowreflect && sector->GetReflect(plane) > 0)
	{
		if ((plane == sector_t::ceiling && ViewPos.Z > sector->ceilingplane.fD()) ||
			(plane == sector_t::floor && ViewPos.Z < -sector->floorplane.fD())) return;
		ptype = PORTALTYPE_PLANEMIRROR;
		planemirror = plane == sector_t::ceiling ? &sector->ceilingplane : &sector->floorplane;
	}
	if (ptype != -1)
	{
		PutPortal(ptype);
	}
}
Example #3
0
void GLEEHorizonPortal::DrawContents()
{
	PortalAll.Clock();
	sector_t *sector = portal->mOrigin;
	if (sector->GetTexture(sector_t::floor) == skyflatnum ||
		sector->GetTexture(sector_t::ceiling) == skyflatnum)
	{
		GLSkyInfo skyinfo;
		skyinfo.init(sector->sky, 0);
		GLSkyPortal sky(&skyinfo, true);
		sky.DrawContents();
	}
	if (sector->GetTexture(sector_t::ceiling) != skyflatnum)
	{
		GLHorizonInfo horz;
		horz.plane.GetFromSector(sector, true);
		horz.lightlevel = gl_ClampLight(sector->GetCeilingLight());
		horz.colormap = sector->ColorMap;
		if (portal->mType == PORTS_PLANE)
		{
			horz.plane.Texheight = ViewPos.Z + fabs(horz.plane.Texheight);
		}
		GLHorizonPortal ceil(&horz, true);
		ceil.DrawContents();
	}
	if (sector->GetTexture(sector_t::floor) != skyflatnum)
	{
		GLHorizonInfo horz;
		horz.plane.GetFromSector(sector, false);
		horz.lightlevel = gl_ClampLight(sector->GetFloorLight());
		horz.colormap = sector->ColorMap;
		if (portal->mType == PORTS_PLANE)
		{
			horz.plane.Texheight = ViewPos.Z - fabs(horz.plane.Texheight);
		}
		GLHorizonPortal floor(&horz, true);
		floor.DrawContents();
	}



}
Example #4
0
void HWEEHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
{
	auto &vp = di->Viewpoint;
	sector_t *sector = portal->mOrigin;
	if (sector->GetTexture(sector_t::floor) == skyflatnum ||
		sector->GetTexture(sector_t::ceiling) == skyflatnum)
	{
		GLSkyInfo skyinfo;
		skyinfo.init(di, sector->sky, 0);
		HWSkyPortal sky(screen->mSkyData, mState, &skyinfo, true);
		sky.DrawContents(di, state);
	}
	if (sector->GetTexture(sector_t::ceiling) != skyflatnum)
	{
		GLHorizonInfo horz;
		horz.plane.GetFromSector(sector, sector_t::ceiling);
		horz.lightlevel = hw_ClampLight(sector->GetCeilingLight());
		horz.colormap = sector->Colormap;
		horz.specialcolor = 0xffffffff;
		if (portal->mType == PORTS_PLANE)
		{
			horz.plane.Texheight = vp.Pos.Z + fabs(horz.plane.Texheight);
		}
		HWHorizonPortal ceil(mState, &horz, di->Viewpoint, true);
		ceil.DrawContents(di, state);
	}
	if (sector->GetTexture(sector_t::floor) != skyflatnum)
	{
		GLHorizonInfo horz;
		horz.plane.GetFromSector(sector, sector_t::floor);
		horz.lightlevel = hw_ClampLight(sector->GetFloorLight());
		horz.colormap = sector->Colormap;
		horz.specialcolor = 0xffffffff;
		if (portal->mType == PORTS_PLANE)
		{
			horz.plane.Texheight = vp.Pos.Z - fabs(horz.plane.Texheight);
		}
		HWHorizonPortal floor(mState, &horz, di->Viewpoint, true);
		floor.DrawContents(di, state);
	}
}