Example #1
0
bool FDrawInfo::CollectSubsectorsCeiling(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 rendererd so don't bother.
        if (!(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return true;

        if (sub->render_sector->GetTexture(sector_t::ceiling)!=anchor->GetTexture(sector_t::ceiling) ||
                sub->render_sector->GetPlaneTexZ(sector_t::ceiling)!=anchor->GetPlaneTexZ(sector_t::ceiling) ||
                GetCeilingLight(sub->render_sector)!=GetCeilingLight(anchor))
        {
            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 (!CheckAnchorCeiling (backsub)) // must not be an anchor itself!
            {
                if (backsub->validcount!=validcount)
                {
                    if (!CollectSubsectorsCeiling (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::ceiling)!=anchor->GetTexture(sector_t::ceiling) ||
                        sub->render_sector->GetPlaneTexZ(sector_t::ceiling)!=anchor->GetPlaneTexZ(sector_t::ceiling) ||
                        GetCeilingLight(sub->render_sector)!=GetCeilingLight(anchor))
                {
                    return false;
                }
            }
        }
    }
    return true;
}
Example #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();
}
Example #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();
}