remove some more old format cruft
parent
a0c34f42e9
commit
62de5eccf3
|
@ -199,7 +199,6 @@ extern void resetclipplanes();
|
|||
extern int getmippedtexture(const cube &p, int orient);
|
||||
extern void forcemip(cube &c, bool fixtex = true);
|
||||
extern bool subdividecube(cube &c, bool fullcheck=true, bool brighten=true);
|
||||
extern void edgespan2vectorcube(cube &c);
|
||||
extern int faceconvexity(const ivec v[4]);
|
||||
extern int faceconvexity(const ivec v[4], int &vis);
|
||||
extern int faceconvexity(const vertinfo *verts, int numverts, int size);
|
||||
|
|
|
@ -588,80 +588,6 @@ void remip_()
|
|||
|
||||
COMMANDN(remip, remip_, "");
|
||||
|
||||
static inline int edgeval(cube &c, const ivec &p, int dim, int coord)
|
||||
{
|
||||
return edgeget(cubeedge(c, dim, p[R[dim]]>>3, p[C[dim]]>>3), coord);
|
||||
}
|
||||
|
||||
void genvertp(cube &c, ivec &p1, ivec &p2, ivec &p3, plane &pl, bool solid = false)
|
||||
{
|
||||
int dim = 0;
|
||||
if(p1.y==p2.y && p2.y==p3.y) dim = 1;
|
||||
else if(p1.z==p2.z && p2.z==p3.z) dim = 2;
|
||||
|
||||
int coord = p1[dim];
|
||||
ivec v1(p1), v2(p2), v3(p3);
|
||||
v1[dim] = solid ? coord*8 : edgeval(c, p1, dim, coord);
|
||||
v2[dim] = solid ? coord*8 : edgeval(c, p2, dim, coord);
|
||||
v3[dim] = solid ? coord*8 : edgeval(c, p3, dim, coord);
|
||||
|
||||
pl.toplane(v1.tovec(), v2.tovec(), v3.tovec());
|
||||
}
|
||||
|
||||
static bool threeplaneintersect(plane &pl1, plane &pl2, plane &pl3, vec &dest)
|
||||
{
|
||||
vec &t1 = dest, t2, t3, t4;
|
||||
t1.cross(pl1, pl2); t4 = t1; t1.mul(pl3.offset);
|
||||
t2.cross(pl3, pl1); t2.mul(pl2.offset);
|
||||
t3.cross(pl2, pl3); t3.mul(pl1.offset);
|
||||
t1.add(t2);
|
||||
t1.add(t3);
|
||||
t1.mul(-1);
|
||||
float d = t4.dot(pl3);
|
||||
if(d==0) return false;
|
||||
t1.div(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void genedgespanvert(ivec &p, cube &c, vec &v)
|
||||
{
|
||||
ivec p1(8-p.x, p.y, p.z);
|
||||
ivec p2(p.x, 8-p.y, p.z);
|
||||
ivec p3(p.x, p.y, 8-p.z);
|
||||
|
||||
plane plane1, plane2, plane3;
|
||||
genvertp(c, p, p1, p2, plane1);
|
||||
genvertp(c, p, p2, p3, plane2);
|
||||
genvertp(c, p, p3, p1, plane3);
|
||||
if(plane1==plane2) genvertp(c, p, p1, p2, plane1, true);
|
||||
if(plane1==plane3) genvertp(c, p, p1, p2, plane1, true);
|
||||
if(plane2==plane3) genvertp(c, p, p2, p3, plane2, true);
|
||||
|
||||
ASSERT(threeplaneintersect(plane1, plane2, plane3, v));
|
||||
//ASSERT(v.x>=0 && v.x<=8);
|
||||
//ASSERT(v.y>=0 && v.y<=8);
|
||||
//ASSERT(v.z>=0 && v.z<=8);
|
||||
v.x = max(0.0f, min(8.0f, v.x));
|
||||
v.y = max(0.0f, min(8.0f, v.y));
|
||||
v.z = max(0.0f, min(8.0f, v.z));
|
||||
}
|
||||
|
||||
void edgespan2vectorcube(cube &c)
|
||||
{
|
||||
if(isentirelysolid(c) || isempty(c)) return;
|
||||
cube o = c;
|
||||
loop(x, 2) loop(y, 2) loop(z, 2)
|
||||
{
|
||||
ivec p(8*x, 8*y, 8*z);
|
||||
vec v;
|
||||
genedgespanvert(p, o, v);
|
||||
|
||||
edgeset(cubeedge(c, 0, y, z), x, int(v.x+0.49f));
|
||||
edgeset(cubeedge(c, 1, z, x), y, int(v.y+0.49f));
|
||||
edgeset(cubeedge(c, 2, x, y), z, int(v.z+0.49f));
|
||||
}
|
||||
}
|
||||
|
||||
const ivec cubecoords[8] = // verts of bounding cube
|
||||
{
|
||||
#define GENCUBEVERT(n, x, y, z) ivec(x, y, z),
|
||||
|
|
|
@ -161,24 +161,6 @@ enum { OCTSAV_CHILDREN = 0, OCTSAV_EMPTY, OCTSAV_SOLID, OCTSAV_NORMAL, OCTSAV_LO
|
|||
enum { LMID_AMBIENT = 0, LMID_AMBIENT1, LMID_BRIGHT, LMID_BRIGHT1, LMID_DARK, LMID_DARK1, LMID_RESERVED };
|
||||
#define LAYER_DUP (1<<7)
|
||||
|
||||
struct surfacecompat
|
||||
{
|
||||
uchar texcoords[8];
|
||||
uchar w, h;
|
||||
ushort x, y;
|
||||
uchar lmid, layer;
|
||||
};
|
||||
|
||||
struct normalscompat
|
||||
{
|
||||
bvec normals[4];
|
||||
};
|
||||
|
||||
struct mergecompat
|
||||
{
|
||||
ushort u1, u2, v1, v2;
|
||||
};
|
||||
|
||||
struct polysurfacecompat
|
||||
{
|
||||
uchar lmid[2];
|
||||
|
@ -867,7 +849,7 @@ bool load_world(const char *mname, const char *cname) // still supports a
|
|||
}
|
||||
int bpp = 3;
|
||||
if(type&(1<<4) && (type&0x0F)!=2) bpp = 4;
|
||||
f->seek(bpp*512*512, SEEK_CUR);
|
||||
f->seek(bpp*LM_PACKW*LM_PACKH, SEEK_CUR);
|
||||
}
|
||||
|
||||
if(hdr.numpvs > 0) loadpvs(f, hdr.numpvs);
|
||||
|
|
Loading…
Reference in New Issue