Beispiel #1
0
bool FDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor)
{

    // mark it checked
    sub->validcount=validcount;


    // We must collect any subsector that either is connected to this one with a miniseg
    // or has the same visplane.
    // We must not collect any subsector that  has the anchor's visplane!
    if (!sub->degenerate)
    {
        // Is not being rendered so don't bother.
        if (!(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return true;

        if (sub->render_sector->GetTexture(sector_t::floor) != anchor->GetTexture(sector_t::floor) ||
                sub->render_sector->GetPlaneTexZ(sector_t::floor)!=anchor->GetPlaneTexZ(sector_t::floor) ||
                GetFloorLight(sub->render_sector)!=GetFloorLight(anchor))
        {
            if (sub==viewsubsector && viewz<anchor->GetPlaneTexZ(sector_t::floor)) inview=true;
            HandledSubsectors.Push (sub);
        }
    }

    // We can assume that all segs in this subsector are connected to a subsector that has
    // to be checked as well
    for(DWORD j=0; j<sub->numlines; j++)
    {
        seg_t * seg = sub->firstline + j;
        if (seg->PartnerSeg)
        {
            subsector_t * backsub = seg->PartnerSeg->Subsector;

            // could be an anchor itself.
            if (!CheckAnchorFloor (backsub)) // must not be an anchor itself!
            {
                if (backsub->validcount!=validcount)
                {
                    if (!CollectSubsectorsFloor (backsub, anchor)) return false;
                }
            }
            else if (sub->render_sector == backsub->render_sector)
            {
                // Any anchor not within the original anchor's visplane terminates the processing.
                if (sub->render_sector->GetTexture(sector_t::floor)!=anchor->GetTexture(sector_t::floor) ||
                        sub->render_sector->GetPlaneTexZ(sector_t::floor)!=anchor->GetPlaneTexZ(sector_t::floor) ||
                        GetFloorLight(sub->render_sector)!=GetFloorLight(anchor))
                {
                    return false;
                }
            }
            if (!seg->linedef || (seg->frontsector==seg->backsector && sub->render_sector!=backsub->render_sector))
                lowersegs.Push(seg);
        }
    }
    return true;
}
Beispiel #2
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 #3
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();
}