*** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@869 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+31
-31
@@ -9,14 +9,14 @@ void render_wall(sqr *o, sqr *s, int x1, int y1, int x2, int y2, int mip, sqr *d
|
||||
{
|
||||
float c1 = s->floor;
|
||||
float c2 = s->floor;
|
||||
if(s->type==FHF) { c1 -= d1->vdelta/4.0f; c2 -= d2->vdelta/4.0f; };
|
||||
if(s->type==FHF) { c1 -= d1->vdelta/4.0f; c2 -= d2->vdelta/4.0f; }
|
||||
float f1 = s->ceil;
|
||||
float f2 = s->ceil;
|
||||
if(s->type==CHF) { f1 += d1->vdelta/4.0f; f2 += d2->vdelta/4.0f; };
|
||||
if(s->type==CHF) { f1 += d1->vdelta/4.0f; f2 += d2->vdelta/4.0f; }
|
||||
//if(f1-c1<=0 && f2-c2<=0) return;
|
||||
render_square(o->wtex, c1, c2, f1, f2, x1<<mip, y1<<mip, x2<<mip, y2<<mip, 1<<mip, d1, d2, topleft);
|
||||
return;
|
||||
};
|
||||
}
|
||||
{
|
||||
float f1 = s->floor;
|
||||
float f2 = s->floor;
|
||||
@@ -34,7 +34,7 @@ void render_wall(sqr *o, sqr *s, int x1, int y1, int x2, int y2, int mip, sqr *d
|
||||
}
|
||||
if(f1>=c1 && f2>=c2) goto skip;
|
||||
render_square(o->wtex, f1, f2, c1, c2, x1<<mip, y1<<mip, x2<<mip, y2<<mip, 1<<mip, d1, d2, topleft);
|
||||
};
|
||||
}
|
||||
skip:
|
||||
{
|
||||
float f1 = o->ceil;
|
||||
@@ -53,8 +53,8 @@ void render_wall(sqr *o, sqr *s, int x1, int y1, int x2, int y2, int mip, sqr *d
|
||||
}
|
||||
if(c1<=f1 && c2<=f2) return;
|
||||
render_square(o->utex, f1, f2, c1, c2, x1<<mip, y1<<mip, x2<<mip, y2<<mip, 1<<mip, d1, d2, topleft);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const int MAX_MIP = 5; // 32x32 unit blocks
|
||||
const int MIN_LOD = 2;
|
||||
@@ -64,7 +64,7 @@ const int MAX_LOD = 250;
|
||||
int lod = 40, lodtop, lodbot, lodleft, lodright;
|
||||
int min_lod;
|
||||
|
||||
int lod_factor() { return lod; };
|
||||
int lod_factor() { return lod; }
|
||||
|
||||
VARP(minlod, LOW_LOD, 60, MAX_LOD);
|
||||
|
||||
@@ -86,16 +86,16 @@ bool issemi(int mip, int x, int y, int x1, int y1, int x2, int y2)
|
||||
case CORNER:
|
||||
case SOLID: break;
|
||||
default: return true;
|
||||
};
|
||||
}
|
||||
switch(SWS(w, x+x2, y+y2, msize)->type)
|
||||
{
|
||||
case SEMISOLID: if(issemi(mip, x+x2, y+y2, x1, y1, x2, y2)) return true;
|
||||
case CORNER:
|
||||
case SOLID: break;
|
||||
default: return true;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
bool render_floor, render_ceil;
|
||||
|
||||
@@ -118,7 +118,7 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
for(int ox = x; ox<xs; ox++) for(int oy = y; oy<ys; oy++) // first collect occlusion information for this block
|
||||
{
|
||||
SWS(w,ox,oy,sz)->occluded = isoccluded(camera1->o.x, camera1->o.y, (float)(ox<<mip), (float)(oy<<mip), fsize);
|
||||
};
|
||||
}
|
||||
|
||||
int pvx = (int)vx>>mip;
|
||||
int pvy = (int)vy>>mip;
|
||||
@@ -126,7 +126,7 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
{
|
||||
//SWS(w,vxx,vyy,sz)->occluded = 0;
|
||||
SWS(w, pvx, pvy, sz)->occluded = 0; // player cell never occluded
|
||||
};
|
||||
}
|
||||
|
||||
#define df(x) s->floor-(x->vdelta/4.0f)
|
||||
#define dc(x) s->ceil+(x->vdelta/4.0f)
|
||||
@@ -151,14 +151,14 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
while(yy<ys-1 && (next = SWS(w,xx,yy+1,sz))->defer && !next->occluded) yy++; // collect 2xN rect of lower mip
|
||||
render_seg_new(vx, vy, vh, mip-1, xx*2, start*2, xx*2+2, yy*2+2);
|
||||
continue;
|
||||
};
|
||||
}
|
||||
stats[mip]++;
|
||||
LOOPD
|
||||
if((s->type==SPACE || s->type==FHF) && s->ceil>=vh && render_ceil)
|
||||
render_flat(s->ctex, xx<<mip, yy<<mip, 1<<mip, s->ceil, s, t, u, v, true);
|
||||
if(s->type==CHF) //if(s->ceil>=vh)
|
||||
render_flatdelta(s->ctex, xx<<mip, yy<<mip, 1<<mip, dc(s), dc(t), dc(u), dc(v), s, t, u, v, true);
|
||||
}};
|
||||
}}
|
||||
|
||||
LOOPH continue; // floors
|
||||
LOOPD
|
||||
@@ -166,13 +166,13 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
{
|
||||
render_flat(s->ftex, xx<<mip, yy<<mip, 1<<mip, s->floor, s, t, u, v, false);
|
||||
if(s->floor<hdr.waterlevel && !SOLID(s)) addwaterquad(xx<<mip, yy<<mip, 1<<mip);
|
||||
};
|
||||
}
|
||||
if(s->type==FHF)
|
||||
{
|
||||
render_flatdelta(s->ftex, xx<<mip, yy<<mip, 1<<mip, df(s), df(t), df(u), df(v), s, t, u, v, false);
|
||||
if(s->floor-s->vdelta/4.0f<hdr.waterlevel && !SOLID(s)) addwaterquad(xx<<mip, yy<<mip, 1<<mip);
|
||||
};
|
||||
}};
|
||||
}
|
||||
}}
|
||||
|
||||
LOOPH continue; // walls
|
||||
LOOPD
|
||||
@@ -193,12 +193,12 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
if(SOLID(z))
|
||||
{
|
||||
if(SOLID(w)) { render_wall(w, h2 = s, xx+1, yy, xx, yy+1, mip, t, v, false); topleft = false; }
|
||||
else if(SOLID(v)) { render_wall(v, h2 = s, xx, yy, xx+1, yy+1, mip, s, u, false); };
|
||||
else if(SOLID(v)) { render_wall(v, h2 = s, xx, yy, xx+1, yy+1, mip, s, u, false); }
|
||||
}
|
||||
else if(SOLID(t))
|
||||
{
|
||||
if(SOLID(w)) { render_wall(w, h1 = s, xx+1, yy+1, xx, yy, mip, u, s, false); }
|
||||
else if(SOLID(v)) { render_wall(v, h1 = s, xx, yy+1, xx+1, yy, mip, v, t, false); topleft = false; };
|
||||
else if(SOLID(v)) { render_wall(v, h1 = s, xx, yy+1, xx+1, yy, mip, v, t, false); topleft = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,16 +207,16 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
if(z->ceil-z->floor < t->ceil-t->floor)
|
||||
{
|
||||
if(wv) { render_wall(h1 = s, h2 = v, xx+1, yy, xx, yy+1, mip, t, v, false); topleft = false; }
|
||||
else { render_wall(h1 = s, h2 = w, xx, yy, xx+1, yy+1, mip, s, u, false); };
|
||||
else { render_wall(h1 = s, h2 = w, xx, yy, xx+1, yy+1, mip, s, u, false); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if(wv) { render_wall(h2 = s, h1 = v, xx+1, yy+1, xx, yy, mip, u, s, false); }
|
||||
else { render_wall(h2 = s, h1 = w, xx, yy+1, xx+1, yy, mip, v, t, false); topleft = false; };
|
||||
};
|
||||
};
|
||||
else { render_wall(h2 = s, h1 = w, xx, yy+1, xx+1, yy, mip, v, t, false); topleft = false; }
|
||||
}
|
||||
}
|
||||
render_tris(xx<<mip, yy<<mip, 1<<mip, topleft, h1, h2, s, t, u, v);
|
||||
};
|
||||
}
|
||||
|
||||
if(normalwall)
|
||||
{
|
||||
@@ -234,10 +234,10 @@ void render_seg_new(float vx, float vy, float vh, int mip, int x, int y, int xs,
|
||||
if(yy<=vyy && inner && !SOLID(v) && (!SOLID(s) || v->type!=CORNER)
|
||||
&& (v->type!=SEMISOLID || issemi(mip, xx, yy+1, 0, 0, 1, 0)))
|
||||
render_wall(s, v, xx, yy+1, xx+1, yy+1, mip, v, u, true);
|
||||
};
|
||||
}};
|
||||
}
|
||||
}}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void distlod(int &low, int &high, int angle, float widef)
|
||||
{
|
||||
@@ -246,7 +246,7 @@ void distlod(int &low, int &high, int angle, float widef)
|
||||
high = (int)(angle/f);
|
||||
if(low<min_lod) low = min_lod;
|
||||
if(high<min_lod) high = min_lod;
|
||||
};
|
||||
}
|
||||
|
||||
// does some out of date view frustrum optimisation that doesn't contribute much anymore
|
||||
|
||||
@@ -261,7 +261,7 @@ void render_world(float vx, float vy, float vh, float changelod, int yaw, int pi
|
||||
{
|
||||
min_lod = max(min_lod, (int)(MIN_LOD+(10-cdist)/1.0f*widef)); // less if lod worked better
|
||||
widef = 1.0f;
|
||||
};
|
||||
}
|
||||
lod = (int)(lod*changelod);
|
||||
if(lod<minlod) lod = minlod;
|
||||
if(lod>MAX_LOD) lod = MAX_LOD;
|
||||
@@ -285,12 +285,12 @@ void render_world(float vx, float vy, float vh, float changelod, int yaw, int pi
|
||||
{
|
||||
lodtop = lod;
|
||||
distlod(lodright, lodleft, yaw<=45 ? yaw+45 : yaw-315, widef);
|
||||
};
|
||||
}
|
||||
float hyfov = fov*h/w/2;
|
||||
render_floor = pitch<hyfov;
|
||||
render_ceil = -pitch<hyfov;
|
||||
|
||||
render_seg_new(vx, vy, vh, MAX_MIP, 0, 0, ssize>>MAX_MIP, ssize>>MAX_MIP);
|
||||
mipstats(stats[0], stats[1], stats[2]);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user