Beispiel #1
0
void HWDrawInfo::HandleHackedSubsectors()
{
	viewsubsector = Level->PointInRenderSubsector(Viewpoint.Pos);

	// Each subsector may only be processed once in this loop!
	validcount++;
	for(unsigned int i=0;i<SubsectorHacks.Size();i++)
	{
		subsector_t * sub = SubsectorHacks[i].sub;
		if (sub->validcount!=validcount && CheckAnchorFloor(sub))
		{
			// Now collect everything that is connected with this subsector.
			HandledSubsectors.Clear();
			inview=false;
			lowersegs.Clear();
			if (CollectSubsectorsFloor(sub, sub->render_sector))
			{
				for(unsigned int j=0;j<HandledSubsectors.Size();j++)
				{				
                    gl_subsectorrendernode * node = NewSubsectorRenderNode();
					node->sub = HandledSubsectors[j];
					AddOtherFloorPlane(sub->render_sector->sectornum, node);
				}
                if (inview) ProcessLowerMinisegs(lowersegs);
			}
		}
	}

	// Each subsector may only be processed once in this loop!
	validcount++;
	for(unsigned int i=0;i<SubsectorHacks.Size();i++)
	{
		subsector_t * sub = SubsectorHacks[i].sub;
		if (sub->validcount!=validcount && CheckAnchorCeiling(sub))
		{
			// Now collect everything that is connected with this subsector.
			HandledSubsectors.Clear();
			if (CollectSubsectorsCeiling(sub, sub->render_sector))
			{
				for(unsigned int j=0;j<HandledSubsectors.Size();j++)
				{				
                    gl_subsectorrendernode * node = NewSubsectorRenderNode();
					node->sub = HandledSubsectors[j];
					AddOtherCeilingPlane(sub->render_sector->sectornum, node);
				}
			}
		}
	}


	SubsectorHacks.Clear();
}
Beispiel #2
0
void FDrawInfo::HandleHackedSubsectors()
{
    lowershcount=uppershcount=0;
    totalssms.Reset();
    totalssms.Clock();

    viewsubsector = R_PointInSubsector(viewx, viewy);

    // Each subsector may only be processed once in this loop!
    validcount++;
    for(unsigned int i=0; i<SubsectorHacks.Size(); i++)
    {
        subsector_t * sub = SubsectorHacks[i].sub;
        if (sub->validcount!=validcount && CheckAnchorFloor(sub))
        {
            // Now collect everything that is connected with this subsector.
            HandledSubsectors.Clear();
            inview=false;
            lowersegs.Clear();
            if (CollectSubsectorsFloor(sub, sub->render_sector))
            {
                for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                {
                    gl_subsectorrendernode * node = SSR_List.GetNew();

                    node->sub = HandledSubsectors[j];
                    AddOtherFloorPlane(sub->render_sector->sectornum, node);
                }
                if (inview) for(unsigned int j=0; j<lowersegs.Size(); j++)
                    {
                        seg_t * seg=lowersegs[j];
                        GLRenderer->ProcessLowerMiniseg (seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
                    }
                lowershcount+=HandledSubsectors.Size();
            }
        }
    }

    // Each subsector may only be processed once in this loop!
    validcount++;
    for(unsigned int i=0; i<SubsectorHacks.Size(); i++)
    {
        subsector_t * sub = SubsectorHacks[i].sub;
        if (sub->validcount!=validcount && CheckAnchorCeiling(sub))
        {
            // Now collect everything that is connected with this subsector.
            HandledSubsectors.Clear();
            if (CollectSubsectorsCeiling(sub, sub->render_sector))
            {
                for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                {
                    gl_subsectorrendernode * node = SSR_List.GetNew();

                    node->sub = HandledSubsectors[j];
                    AddOtherCeilingPlane(sub->render_sector->sectornum, node);
                }
                uppershcount+=HandledSubsectors.Size();
            }
        }
    }


    SubsectorHacks.Clear();
    totalssms.Unclock();
}
Beispiel #3
0
//==========================================================================
//
// Draws the fake planes
//
//==========================================================================
void FDrawInfo::HandleMissingTextures()
{
    sector_t fake;
    totalms.Clock();
    totalupper=MissingUpperTextures.Size();
    totallower=MissingLowerTextures.Size();

    for(unsigned int i=0; i<MissingUpperTextures.Size(); i++)
    {
        if (!MissingUpperTextures[i].seg) continue;
        HandledSubsectors.Clear();
        validcount++;

        if (MissingUpperTextures[i].planez > viewz)
        {
            // close the hole only if all neighboring sectors are an exact height match
            // Otherwise just fill in the missing textures.
            MissingUpperTextures[i].sub->validcount=validcount;
            if (DoOneSectorUpper(MissingUpperTextures[i].sub, MissingUpperTextures[i].planez))
            {
                sector_t * sec = MissingUpperTextures[i].seg->backsector;
                // The mere fact that this seg has been added to the list means that the back sector
                // will be rendered so we can safely assume that it is already in the render list

                for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                {
                    gl_subsectorrendernode * node = SSR_List.GetNew();
                    node->sub = HandledSubsectors[j];

                    AddOtherCeilingPlane(sec->sectornum, node);
                }

                if (HandledSubsectors.Size()!=1)
                {
                    // mark all subsectors in the missing list that got processed by this
                    for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                    {
                        for(unsigned int k=0; k<MissingUpperTextures.Size(); k++)
                        {
                            if (MissingUpperTextures[k].sub==HandledSubsectors[j])
                            {
                                MissingUpperTextures[k].seg=NULL;
                            }
                        }
                    }
                }
                else MissingUpperTextures[i].seg=NULL;
                continue;
            }
        }

        if (!MissingUpperTextures[i].seg->PartnerSeg) continue;
        if (!MissingUpperTextures[i].seg->PartnerSeg->Subsector) continue;
        validcount++;
        HandledSubsectors.Clear();

        {
            // It isn't a hole. Now check whether it might be a fake bridge
            sector_t * fakesector = gl_FakeFlat(MissingUpperTextures[i].seg->frontsector, &fake, false);
            fixed_t planez = fakesector->GetPlaneTexZ(sector_t::ceiling);

            MissingUpperTextures[i].seg->PartnerSeg->Subsector->validcount=validcount;
            if (DoFakeCeilingBridge(MissingUpperTextures[i].seg->PartnerSeg->Subsector, planez))
            {
                // The mere fact that this seg has been added to the list means that the back sector
                // will be rendered so we can safely assume that it is already in the render list

                for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                {
                    gl_subsectorrendernode * node = SSR_List.GetNew();
                    node->sub = HandledSubsectors[j];
                    AddOtherCeilingPlane(fakesector->sectornum, node);
                }
            }
            continue;
        }
    }

    for(unsigned int i=0; i<MissingLowerTextures.Size(); i++)
    {
        if (!MissingLowerTextures[i].seg) continue;
        HandledSubsectors.Clear();
        validcount++;

        if (MissingLowerTextures[i].planez < viewz)
        {
            // close the hole only if all neighboring sectors are an exact height match
            // Otherwise just fill in the missing textures.
            MissingLowerTextures[i].sub->validcount=validcount;
            if (DoOneSectorLower(MissingLowerTextures[i].sub, MissingLowerTextures[i].planez))
            {
                sector_t * sec = MissingLowerTextures[i].seg->backsector;
                // The mere fact that this seg has been added to the list means that the back sector
                // will be rendered so we can safely assume that it is already in the render list

                for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                {
                    gl_subsectorrendernode * node = SSR_List.GetNew();
                    node->sub = HandledSubsectors[j];
                    AddOtherFloorPlane(sec->sectornum, node);
                }

                if (HandledSubsectors.Size()!=1)
                {
                    // mark all subsectors in the missing list that got processed by this
                    for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                    {
                        for(unsigned int k=0; k<MissingLowerTextures.Size(); k++)
                        {
                            if (MissingLowerTextures[k].sub==HandledSubsectors[j])
                            {
                                MissingLowerTextures[k].seg=NULL;
                            }
                        }
                    }
                }
                else MissingLowerTextures[i].seg=NULL;
                continue;
            }
        }

        if (!MissingLowerTextures[i].seg->PartnerSeg) continue;
        if (!MissingLowerTextures[i].seg->PartnerSeg->Subsector) continue;
        validcount++;
        HandledSubsectors.Clear();

        {
            // It isn't a hole. Now check whether it might be a fake bridge
            sector_t * fakesector = gl_FakeFlat(MissingLowerTextures[i].seg->frontsector, &fake, false);
            fixed_t planez = fakesector->GetPlaneTexZ(sector_t::floor);

            MissingLowerTextures[i].seg->PartnerSeg->Subsector->validcount=validcount;
            if (DoFakeBridge(MissingLowerTextures[i].seg->PartnerSeg->Subsector, planez))
            {
                // The mere fact that this seg has been added to the list means that the back sector
                // will be rendered so we can safely assume that it is already in the render list

                for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
                {
                    gl_subsectorrendernode * node = SSR_List.GetNew();
                    node->sub = HandledSubsectors[j];
                    AddOtherFloorPlane(fakesector->sectornum, node);
                }
            }
            continue;
        }
    }

    totalms.Unclock();
    showtotalms=totalms;
    totalms.Reset();
}
Beispiel #4
0
void FDrawInfo::ProcessSectorStacks()
{
    unsigned int i;

    validcount++;
    for (i=0; i<CeilingStacks.Size (); i++)
    {
        subsector_t * sub = CeilingStacks[i];

        HandledSubsectors.Clear();
        for(DWORD j=0; j<sub->numlines; j++)
        {
            seg_t * seg = sub->firstline + j;
            if (seg->PartnerSeg)
            {
                subsector_t * backsub = seg->PartnerSeg->Subsector;

                if (backsub->validcount!=validcount) CollectSectorStacksCeiling (backsub, sub->render_sector);
            }
        }

        for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
        {
            ss_renderflags[DWORD(HandledSubsectors[j]-subsectors)] &= ~SSRF_RENDERCEILING;

            if (sub->render_sector->CeilingSkyBox->PlaneAlpha!=0)
            {
                gl_subsectorrendernode * node = SSR_List.GetNew();
                node->sub = HandledSubsectors[j];
                AddOtherCeilingPlane(sub->render_sector->sectornum, node);
            }
        }
    }

    validcount++;
    for (i=0; i<FloorStacks.Size (); i++)
    {
        subsector_t * sub = FloorStacks[i];

        HandledSubsectors.Clear();
        for(DWORD j=0; j<sub->numlines; j++)
        {
            seg_t * seg = sub->firstline + j;
            if (seg->PartnerSeg)
            {
                subsector_t	* backsub = seg->PartnerSeg->Subsector;

                if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, sub->render_sector);
            }
        }

        for(unsigned int j=0; j<HandledSubsectors.Size(); j++)
        {
            //Printf("%d: ss %d, sec %d\n", j, HandledSubsectors[j]-subsectors, HandledSubsectors[j]->render_sector->sectornum);
            ss_renderflags[DWORD(HandledSubsectors[j]-subsectors)] &= ~SSRF_RENDERFLOOR;

            if (sub->render_sector->FloorSkyBox->PlaneAlpha!=0)
            {
                gl_subsectorrendernode * node = SSR_List.GetNew();
                node->sub = HandledSubsectors[j];
                AddOtherFloorPlane(sub->render_sector->sectornum, node);
            }
        }
    }

    FloorStacks.Clear();
    CeilingStacks.Clear();
}
void FDrawInfo::ProcessSectorStacks()
{
	unsigned int i;
	sector_t fake;

	validcount++;
	for (i=0;i<CeilingStacks.Size (); i++)
	{
		sector_t *sec = gl_FakeFlat(CeilingStacks[i], &fake, false);
		FPortal *portal = sec->portals[sector_t::ceiling];
		if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
		{
			subsector_t * sub = sec->subsectors[k];
			if (ss_renderflags[sub-subsectors] & SSRF_PROCESSED)
			{
				HandledSubsectors.Clear();
				for(DWORD j=0;j<sub->numlines;j++)
				{
					seg_t * seg = sub->firstline + j;
					if (seg->PartnerSeg)
					{
						subsector_t * backsub = seg->PartnerSeg->Subsector;

						if (backsub->validcount!=validcount) CollectSectorStacksCeiling (backsub, sec);
					}
				}
				for(unsigned int j=0;j<HandledSubsectors.Size();j++)
				{				
					subsector_t *sub = HandledSubsectors[j];
					ss_renderflags[DWORD(sub-subsectors)] &= ~SSRF_RENDERCEILING;

					if (sub->portalcoverage[sector_t::ceiling].subsectors == NULL)
					{
						gl_BuildPortalCoverage(&sub->portalcoverage[sector_t::ceiling],	sub, portal);
					}

					portal->GetGLPortal()->AddSubsector(sub);

					if (sec->GetAlpha(sector_t::ceiling) != 0 && sec->GetTexture(sector_t::ceiling) != skyflatnum)
					{
						gl_subsectorrendernode * node = SSR_List.GetNew();
						node->sub = sub;
						AddOtherCeilingPlane(sec->sectornum, node);
					}
				}
			}
		}
	}

	validcount++;
	for (i=0;i<FloorStacks.Size (); i++)
	{
		sector_t *sec = gl_FakeFlat(FloorStacks[i], &fake, false);
		FPortal *portal = sec->portals[sector_t::floor];
		if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
		{
			subsector_t * sub = sec->subsectors[k];
			if (ss_renderflags[sub-subsectors] & SSRF_PROCESSED)
			{
				HandledSubsectors.Clear();
				for(DWORD j=0;j<sub->numlines;j++)
				{
					seg_t * seg = sub->firstline + j;
					if (seg->PartnerSeg)
					{
						subsector_t	* backsub = seg->PartnerSeg->Subsector;

						if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, sec);
					}
				}

				for(unsigned int j=0;j<HandledSubsectors.Size();j++)
				{				
					subsector_t *sub = HandledSubsectors[j];
					ss_renderflags[DWORD(sub-subsectors)] &= ~SSRF_RENDERFLOOR;

					if (sub->portalcoverage[sector_t::floor].subsectors == NULL)
					{
						gl_BuildPortalCoverage(&sub->portalcoverage[sector_t::floor], sub, portal);
					}

					GLSectorStackPortal *glportal = portal->GetGLPortal();
					glportal->AddSubsector(sub);

					if (sec->GetAlpha(sector_t::floor) != 0 && sec->GetTexture(sector_t::floor) != skyflatnum)
					{
						gl_subsectorrendernode * node = SSR_List.GetNew();
						node->sub = sub;
						AddOtherFloorPlane(sec->sectornum, node);
					}
				}
			}
		}
	}

	FloorStacks.Clear();
	CeilingStacks.Clear();
}
Beispiel #6
0
//==========================================================================
//
// Draws the fake planes
//
//==========================================================================
void HWDrawInfo::HandleMissingTextures(area_t in_area)
{
	for (unsigned int i = 0; i < MissingUpperTextures.Size(); i++)
	{
		if (!MissingUpperTextures[i].seg) continue;
		HandledSubsectors.Clear();
		validcount++;

		if (MissingUpperTextures[i].Planez > Viewpoint.Pos.Z)
		{
			// close the hole only if all neighboring sectors are an exact height match
			// Otherwise just fill in the missing textures.
			MissingUpperTextures[i].sub->validcount = validcount;
			if (DoOneSectorUpper(MissingUpperTextures[i].sub, MissingUpperTextures[i].Planez, in_area))
			{
				sector_t * sec = MissingUpperTextures[i].seg->backsector;
				for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
				{
                    gl_subsectorrendernode * node = NewSubsectorRenderNode();
					node->sub = HandledSubsectors[j];

					AddOtherCeilingPlane(sec->sectornum, node);
				}

				if (HandledSubsectors.Size() != 1)
				{
					// mark all subsectors in the missing list that got processed by this
					for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
					{
						for (unsigned int k = 0; k < MissingUpperTextures.Size(); k++)
						{
							if (MissingUpperTextures[k].sub == HandledSubsectors[j])
							{
								MissingUpperTextures[k].seg = NULL;
							}
						}
					}
				}
				else MissingUpperTextures[i].seg = NULL;
				continue;
			}
		}

		if (!MissingUpperTextures[i].seg->PartnerSeg) continue;
		subsector_t *backsub = MissingUpperTextures[i].seg->PartnerSeg->Subsector;
		if (!backsub) continue;
		validcount++;
		HandledSubsectors.Clear();

		{
			// It isn't a hole. Now check whether it might be a fake bridge
			sector_t * fakesector = hw_FakeFlat(MissingUpperTextures[i].seg->frontsector, in_area, false);
			float planez = (float)fakesector->GetPlaneTexZ(sector_t::ceiling);

			backsub->validcount = validcount;
			if (DoFakeCeilingBridge(backsub, planez, in_area))
			{
				for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
				{
                    gl_subsectorrendernode * node = NewSubsectorRenderNode();
					node->sub = HandledSubsectors[j];
					AddOtherCeilingPlane(fakesector->sectornum, node);
				}
			}
			continue;
		}
	}

	for (unsigned int i = 0; i < MissingLowerTextures.Size(); i++)
	{
		if (!MissingLowerTextures[i].seg) continue;
		HandledSubsectors.Clear();
		validcount++;

		if (MissingLowerTextures[i].Planez < Viewpoint.Pos.Z)
		{
			// close the hole only if all neighboring sectors are an exact height match
			// Otherwise just fill in the missing textures.
			MissingLowerTextures[i].sub->validcount = validcount;
			if (DoOneSectorLower(MissingLowerTextures[i].sub, MissingLowerTextures[i].Planez, in_area))
			{
				sector_t * sec = MissingLowerTextures[i].seg->backsector;

				for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
				{
                    gl_subsectorrendernode * node = NewSubsectorRenderNode();
					node->sub = HandledSubsectors[j];
					AddOtherFloorPlane(sec->sectornum, node);
				}

				if (HandledSubsectors.Size() != 1)
				{
					// mark all subsectors in the missing list that got processed by this
					for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
					{
						for (unsigned int k = 0; k < MissingLowerTextures.Size(); k++)
						{
							if (MissingLowerTextures[k].sub == HandledSubsectors[j])
							{
								MissingLowerTextures[k].seg = NULL;
							}
						}
					}
				}
				else MissingLowerTextures[i].seg = NULL;
				continue;
			}
		}

		if (!MissingLowerTextures[i].seg->PartnerSeg) continue;
		subsector_t *backsub = MissingLowerTextures[i].seg->PartnerSeg->Subsector;
		if (!backsub) continue;
		validcount++;
		HandledSubsectors.Clear();

		{
			// It isn't a hole. Now check whether it might be a fake bridge
			sector_t * fakesector = hw_FakeFlat(MissingLowerTextures[i].seg->frontsector, in_area, false);
			float planez = (float)fakesector->GetPlaneTexZ(sector_t::floor);

			backsub->validcount = validcount;
			if (DoFakeBridge(backsub, planez, in_area))
			{
				for (unsigned int j = 0; j < HandledSubsectors.Size(); j++)
				{
                    gl_subsectorrendernode * node = NewSubsectorRenderNode();
					node->sub = HandledSubsectors[j];
					AddOtherFloorPlane(fakesector->sectornum, node);
				}
			}
			continue;
		}
	}
}