Page 4 of 4
Posted: Tue Dec 14, 2004 5:41 am
by guru
I think you are a bit hard on timmie there, graf. zdoomgl is still very much in the making. I'm sure timmie will be open to all suggestions made in that direction, just drop him a line with some information on the basic editing tricks you would like to see supported, help him a bit with implementing them or at least explain the nature of the origial doom renderer's behaviour and we should soon see a very nice zdoomgl renderer. I do agree with the other stuff you said.
Posted: Tue Dec 14, 2004 5:59 am
by Chilvence
guru wrote: or at least explain the nature of the origial doom renderer's .
Heh. I think he can manage that much himself...
Anyway, even if wads like Eternal Doom could be accounted for easily, in light of what I can understand (or at least assume) about polymost, it still seems a bit roundabout. Perhaps even the line_horizon special would be a trivial thing to support with it.
Lexus: new 3d models today, wheee
Posted: Tue Dec 14, 2004 6:28 am
by Graf Zahl
guru wrote:I think you are a bit hard on timmie there, graf. zdoomgl is still very much in the making. I'm sure timmie will be open to all suggestions made in that direction, just drop him a line with some information on the basic editing tricks you would like to see supported, help him a bit with implementing them or at least explain the nature of the origial doom renderer's behaviour and we should soon see a very nice zdoomgl renderer. I do agree with the other stuff you said.
I wasn't hard on Timmie. I was hard on the current state of ZDoomGL. I know it's not finished but one can't deny that the priorities are a bit odd. For example, the renderer has massive problems (hence a complete rewrite) but dynamic lighting has to come first (to attract the geeks who can't accept Doom as it is.)
Normally I'd try to make it robust first and add the 'cool' stuff afterward.
About rendering hacks:
For self referencing sectors the best fix is to have 2 sectors assigned to each subsector: one for gameplay and one for rendering. The gameplay sector should be the same as it is now but for rendering any linedef which has the same sector at both sides should be considered inconclusive for sector assignment and all the neighboring subsectors checked whether they contain any conclusive sector reference. If done correctly such an approach will find all self referencing objects in the map and assign a meaningful render sector to them - biggest problem solved!
And this is my solution as C++ code:
Code: Select all
fixed_t bbox[4];
register line_t *li;
register sector_t *sector;
int i,j, total = numlines;
TArray<subsector_t *> undetermined;
subsector_t * ss;
bool found;
for (i=0 ; i<numsubsectors ; i++)
{
ss=&subsectors[i];
seg_t *seg = &segs[ss->firstline];
ss->sector = NULL;
ss->render_sector = NULL;
M_ClearBox(ss->bbox);
for(j=0; j<ss->numlines; j++)
{
seg->subsector=ss;
M_AddToBox(ss->bbox,seg->v1->x, seg->v1->y);
seg++;
}
// For gameplay just pick the sector from the first seg
seg = &segs[ss->firstline];
for(j=0; j<ss->numlines; j++)
{
if(seg->sidedef)
{
ss->sector = seg->sidedef->sector;
break;
}
seg++;
}
seg = &segs[ss->firstline];
for(j=0; j<ss->numlines; j++)
{
if(seg->sidedef && (!seg->PartnerSeg || seg->sidedef->sector!=seg->PartnerSeg->sidedef->sector))
{
ss->render_sector = seg->sidedef->sector;
break;
}
seg++;
}
if(ss->render_sector == NULL)
{
undetermined.Push(ss);
}
if(ss->sector == NULL)
{
Printf("P_GroupLines: Subsector %d a part of no sector!\n",i);
continue;
}
}
while (undetermined.Size())
{
bool deleted=false;
for(i=undetermined.Size()-1;i>=0;i--)
{
subsector_t * ss=undetermined[i];
seg_t * seg = &segs[ss->firstline];
found=false;
for(j=0; j<ss->numlines; j++)
{
if (seg->PartnerSeg && seg->PartnerSeg->subsector)
{
if (seg->PartnerSeg->subsector->render_sector)
{
ss->render_sector=seg->PartnerSeg->subsector->render_sector;
undetermined.Delete(i);
deleted=1;
break;
}
}
seg++;
}
}
if (!deleted && undetermined.Size())
{
// This only happens when a subsector is off the map.
// Don't bother and just assign the real sector for rendering
for(i=undetermined.Size()-1;i>=0;i--)
{
subsector_t * ss=undetermined[i];
ss->render_sector=ss->sector;
}
break;
}
}