Esempio n. 1
0
void RenderPolyPlane::RenderPlanes(PolyRenderThread *thread, const TriMatrix &worldToClip, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, double skyCeilingHeight, double skyFloorHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals)
{
	if (fakeflat.FrontSector->CenterFloor() == fakeflat.FrontSector->CenterCeiling())
		return;

	RenderPolyPlane plane;
	plane.Render(thread, worldToClip, clipPlane, fakeflat, stencilValue, true, skyCeilingHeight, sectorPortals);
	plane.Render(thread, worldToClip, clipPlane, fakeflat, stencilValue, false, skyFloorHeight, sectorPortals);
}
void RenderPolyPlane::RenderPlanes(const TriMatrix &worldToClip, subsector_t *sub, uint32_t subsectorDepth, double skyCeilingHeight, double skyFloorHeight)
{
	RenderPolyPlane plane;

	if (r_3dfloors)
	{
		auto frontsector = sub->sector;
		auto &ffloors = frontsector->e->XFloor.ffloors;

		// 3D floor floors
		for (int i = 0; i < (int)ffloors.Size(); i++)
		{
			F3DFloor *fakeFloor = ffloors[i];
			if (!(fakeFloor->flags & FF_EXISTS)) continue;
			if (!fakeFloor->model) continue;
			if (fakeFloor->bottom.plane->isSlope()) continue;
			//if (!(fakeFloor->flags & FF_NOSHADE) || (fakeFloor->flags & (FF_RENDERPLANES | FF_RENDERSIDES)))
			//	R_3D_AddHeight(fakeFloor->top.plane, frontsector);
			if (!(fakeFloor->flags & FF_RENDERPLANES)) continue;
			if (fakeFloor->alpha == 0) continue;
			if (fakeFloor->flags & FF_THISINSIDE && fakeFloor->flags & FF_INVERTSECTOR) continue;
			//fakeFloor->alpha

			double fakeHeight = fakeFloor->top.plane->ZatPoint(frontsector->centerspot);
			if (fakeHeight < ViewPos.Z && fakeHeight > frontsector->floorplane.ZatPoint(frontsector->centerspot))
			{
				plane.Render3DFloor(worldToClip, sub, subsectorDepth, false, fakeFloor);
			}
		}

		// 3D floor ceilings
		for (int i = 0; i < (int)ffloors.Size(); i++)
		{
			F3DFloor *fakeFloor = ffloors[i];
			if (!(fakeFloor->flags & FF_EXISTS)) continue;
			if (!fakeFloor->model) continue;
			if (fakeFloor->top.plane->isSlope()) continue;
			//if (!(fakeFloor->flags & FF_NOSHADE) || (fakeFloor->flags & (FF_RENDERPLANES | FF_RENDERSIDES)))
			//	R_3D_AddHeight(fakeFloor->bottom.plane, frontsector);
			if (!(fakeFloor->flags & FF_RENDERPLANES)) continue;
			if (fakeFloor->alpha == 0) continue;
			if (!(fakeFloor->flags & FF_THISINSIDE) && (fakeFloor->flags & (FF_SWIMMABLE | FF_INVERTSECTOR)) == (FF_SWIMMABLE | FF_INVERTSECTOR)) continue;
			//fakeFloor->alpha

			double fakeHeight = fakeFloor->bottom.plane->ZatPoint(frontsector->centerspot);
			if (fakeHeight > ViewPos.Z && fakeHeight < frontsector->ceilingplane.ZatPoint(frontsector->centerspot))
			{
				plane.Render3DFloor(worldToClip, sub, subsectorDepth, true, fakeFloor);
			}
		}
	}

	plane.Render(worldToClip, sub, subsectorDepth, true, skyCeilingHeight);
	plane.Render(worldToClip, sub, subsectorDepth, false, skyFloorHeight);
}