lots of whitespace
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5265 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+24
-20
@@ -25,7 +25,7 @@ struct strips { vector<GLint> first; vector<GLsizei> count; };
|
||||
struct stripbatch
|
||||
{
|
||||
int tex;
|
||||
strips tris, tristrips, quads;
|
||||
strips tris, tristrips, quads;
|
||||
};
|
||||
|
||||
stripbatch skystrips = { DEFAULT_SKY };
|
||||
@@ -80,7 +80,7 @@ void addstrip(int type, int tex, int start, int n)
|
||||
{
|
||||
if(minimap) return;
|
||||
sb = &skystrips;
|
||||
loopi(n) skyfloor = min(skyfloor, verts[start + i].z);
|
||||
loopi(n) skyfloor = min(skyfloor, verts[start + i].z);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -105,7 +105,8 @@ void addstrip(int type, int tex, int start, int n)
|
||||
// leaves of all these functions, and are part of the cpu bottleneck on really slow
|
||||
// machines, hence the macros.
|
||||
|
||||
#define vert(v1, v2, v3, ls, t1, t2) { \
|
||||
#define vert(v1, v2, v3, ls, t1, t2) \
|
||||
{ \
|
||||
vertex &v = verts.add(); \
|
||||
v.u = t1; v.v = t2; \
|
||||
v.x = (float)(v1); v.y = (float)(v2); v.z = (float)(v3); \
|
||||
@@ -127,7 +128,7 @@ VARP(texturescale, 16, 32, 64);
|
||||
#define TEXTURESCALE float(texturescale)
|
||||
|
||||
int striptype = 0, striptex, oh, oy, ox, odir; // the o* vars are used by the stripification
|
||||
int ol1r, ol1g, ol1b, ol2r, ol2g, ol2b;
|
||||
int ol1r, ol1g, ol1b, ol2r, ol2g, ol2b;
|
||||
float ofloor, oceil;
|
||||
bool ohf;
|
||||
int firstindex;
|
||||
@@ -141,14 +142,16 @@ COMMAND(showmip, ARG_NONE);
|
||||
VAR(mergestrips, 0, 1, 1);
|
||||
|
||||
#define stripend(verts) \
|
||||
if(striptype) { \
|
||||
if(striptype) \
|
||||
{ \
|
||||
int type = GL_TRIANGLE_STRIP, len = verts.length()-firstindex; \
|
||||
if(mergestrips) switch(len) { \
|
||||
if(mergestrips) switch(len) \
|
||||
{ \
|
||||
case 3: type = GL_TRIANGLES; break; \
|
||||
case 4: type = GL_QUADS; swap(verts.last(), verts[verts.length()-2]); break; \
|
||||
} \
|
||||
addstrip(type, striptex, firstindex, len); \
|
||||
striptype = 0; \
|
||||
} \
|
||||
addstrip(type, striptex, firstindex, len); \
|
||||
striptype = 0; \
|
||||
}
|
||||
|
||||
void finishstrips() { stripend(verts); }
|
||||
@@ -200,7 +203,7 @@ void render_flat(int wtex, int x, int y, int size, int h, sqr *l1, sqr *l4, sqr
|
||||
int lighterr = lighterror*2;
|
||||
if((abs(ol1r-l3->r)<lighterr && abs(ol2r-l4->r)<lighterr // skip vertices if light values are close enough
|
||||
&& abs(ol1g-l3->g)<lighterr && abs(ol2g-l4->g)<lighterr
|
||||
&& abs(ol1b-l3->b)<lighterr && abs(ol2b-l4->b)<lighterr) || !wtex)
|
||||
&& abs(ol1b-l3->b)<lighterr && abs(ol2b-l4->b)<lighterr) || !wtex)
|
||||
{
|
||||
verts.setsize(verts.length()-2);
|
||||
nquads--;
|
||||
@@ -208,10 +211,10 @@ void render_flat(int wtex, int x, int y, int size, int h, sqr *l1, sqr *l4, sqr
|
||||
else
|
||||
{
|
||||
uchar *p1 = (uchar *)(&verts[verts.length()-1].r);
|
||||
ol1r = p1[0];
|
||||
ol1g = p1[1];
|
||||
ol1r = p1[0];
|
||||
ol1g = p1[1];
|
||||
ol1b = p1[2];
|
||||
uchar *p2 = (uchar *)(&verts[verts.length()-2].r);
|
||||
uchar *p2 = (uchar *)(&verts[verts.length()-2].r);
|
||||
ol2r = p2[0];
|
||||
ol2g = p2[1];
|
||||
ol2b = p2[2];
|
||||
@@ -245,9 +248,9 @@ void render_flatdelta(int wtex, int x, int y, int size, float h1, float h4, floa
|
||||
float xo = xf*x;
|
||||
float yo = yf*y;
|
||||
|
||||
bool first = striptype!=STRIP_DELTA || x!=ox+size || striptex!=wtex || y!=oy;
|
||||
bool first = striptype!=STRIP_DELTA || x!=ox+size || striptex!=wtex || y!=oy;
|
||||
|
||||
if(first)
|
||||
if(first)
|
||||
{
|
||||
stripend(verts);
|
||||
firstindex = verts.length();
|
||||
@@ -269,7 +272,7 @@ void render_flatdelta(int wtex, int x, int y, int size, float h1, float h4, floa
|
||||
if(isceil)
|
||||
{
|
||||
vert(x+size, y, h4, l4, xo+xs, yo);
|
||||
vert(x+size, y+size, h3, l3, xo+xs, yo+ys);
|
||||
vert(x+size, y+size, h3, l3, xo+xs, yo+ys);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,7 +333,7 @@ void render_square(int wtex, float floor1, float floor2, float ceil1, float ceil
|
||||
float xo = xf*(x1==x2 ? min(y1,y2) : min(x1,x2));
|
||||
|
||||
bool first = striptype!=STRIP_WALL || striptex!=wtex || ox!=x1 || oy!=y1 || ofloor!=floor1 || oceil!=ceil1 || odir!=dir,
|
||||
hf = floor1!=floor2 || ceil1!=ceil2;
|
||||
hf = floor1!=floor2 || ceil1!=ceil2;
|
||||
|
||||
if(first)
|
||||
{
|
||||
@@ -356,7 +359,7 @@ void render_square(int wtex, float floor1, float floor2, float ceil1, float ceil
|
||||
else // continue strip
|
||||
{
|
||||
int lighterr = lighterror*2;
|
||||
if((!hf && !ohf)
|
||||
if((!hf && !ohf)
|
||||
&& ((abs(ol1r-l2->r)<lighterr && abs(ol1g-l2->g)<lighterr && abs(ol1b-l2->b)<lighterr) || !wtex)) // skip vertices if light values are close enough
|
||||
{
|
||||
verts.setsize(verts.length()-2);
|
||||
@@ -402,7 +405,7 @@ void resetcubes()
|
||||
sdark.r = sdark.g = sdark.b = 0;
|
||||
|
||||
resetwater();
|
||||
}
|
||||
}
|
||||
|
||||
struct shadowvertex { float u, v, x, y, z; };
|
||||
vector<shadowvertex> shadowverts;
|
||||
@@ -438,7 +441,8 @@ static void rendershadowstrips()
|
||||
xtraverts += shadowverts.length();
|
||||
}
|
||||
|
||||
#define shadowvert(v1, v2, v3) { \
|
||||
#define shadowvert(v1, v2, v3) \
|
||||
{ \
|
||||
shadowvertex &v = shadowverts.add(); \
|
||||
v.x = (float)(v1); v.y = (float)(v2); v.z = (float)(v3); \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user