Ejemplo n.º 1
0
void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
{
    sector_t fake;
    // mark it checked
    sub->validcount=validcount;

    // Has a sector stack or skybox itself!
    if (sub->render_sector->FloorSkyBox && sub->render_sector->FloorSkyBox->bAlways) return;

    // Don't bother processing unrendered subsectors
    if (sub->numlines>2 && !(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return;

    // Must be the exact same visplane
    sector_t * me = gl_FakeFlat(sub->render_sector, &fake, false);
    if (me->GetTexture(sector_t::floor) != anchor->GetTexture(sector_t::floor) ||
            me->floorplane != anchor->floorplane ||
            GetFloorLight(me) != GetFloorLight(anchor) ||
            me->ColorMap != anchor->ColorMap ||
            me->GetXOffset(sector_t::floor) != anchor->GetXOffset(sector_t::floor) ||
            me->GetYOffset(sector_t::floor) != anchor->GetYOffset(sector_t::floor) ||
            me->GetXScale(sector_t::floor) != anchor->GetXScale(sector_t::floor) ||
            me->GetYScale(sector_t::floor) != anchor->GetYScale(sector_t::floor) ||
            me->GetAngle(sector_t::floor) != anchor->GetAngle(sector_t::floor))
    {
        // different visplane so it can't belong to this stack
        return;
    }

    HandledSubsectors.Push (sub);

    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, anchor);
        }
    }
}
Ejemplo n.º 2
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();
}
Ejemplo n.º 3
0
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();
}