light, common: move WindingFromFace to bspfile.c/h
This commit is contained in:
parent
fff12697e5
commit
45010089f3
|
|
@ -1565,3 +1565,39 @@ PrintBSPFileSizes(const bspdata_t *bspdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
WindingFromFace
|
||||||
|
From q2 tools
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
winding_t *WindingFromFace (const bsp2_t *bsp, const bsp2_dface_t *f)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int se;
|
||||||
|
dvertex_t *dv;
|
||||||
|
int v;
|
||||||
|
winding_t *w;
|
||||||
|
|
||||||
|
w = AllocWinding (f->numedges);
|
||||||
|
w->numpoints = f->numedges;
|
||||||
|
|
||||||
|
for (i=0 ; i<f->numedges ; i++)
|
||||||
|
{
|
||||||
|
se = bsp->dsurfedges[f->firstedge + i];
|
||||||
|
if (se < 0)
|
||||||
|
v = bsp->dedges[-se].v[1];
|
||||||
|
else
|
||||||
|
v = bsp->dedges[se].v[0];
|
||||||
|
|
||||||
|
dv = &bsp->dvertexes[v];
|
||||||
|
for (int j=0; j<3; j++) {
|
||||||
|
w->p[i][j] = dv->point[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveColinearPoints (w);
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <common/cmdlib.h>
|
#include <common/cmdlib.h>
|
||||||
#include <common/log.h>
|
#include <common/log.h>
|
||||||
|
#include <common/polylib.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -480,6 +481,8 @@ void ConvertBSPFormat(int32_t version, bspdata_t *bspdata);
|
||||||
void BSPX_AddLump(bspdata_t *bspdata, const char *xname, const void *xdata, size_t xsize);
|
void BSPX_AddLump(bspdata_t *bspdata, const char *xname, const void *xdata, size_t xsize);
|
||||||
const void *BSPX_GetLump(bspdata_t *bspdata, const char *xname, size_t *xsize);
|
const void *BSPX_GetLump(bspdata_t *bspdata, const char *xname, size_t *xsize);
|
||||||
|
|
||||||
|
winding_t *WindingFromFace (const bsp2_t *bsp, const bsp2_dface_t *f);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,6 @@ typedef struct {
|
||||||
void AddBounceLight(const vec3_t pos, const vec3_t color, const vec3_t surfnormal, vec_t area, const bsp2_t *bsp);
|
void AddBounceLight(const vec3_t pos, const vec3_t color, const vec3_t surfnormal, vec_t area, const bsp2_t *bsp);
|
||||||
int NumBounceLights();
|
int NumBounceLights();
|
||||||
const bouncelight_t *BounceLightAtIndex(int i);
|
const bouncelight_t *BounceLightAtIndex(int i);
|
||||||
winding_t *WindingFromFace (const bsp2_t *bsp, const bsp2_dface_t *f);
|
|
||||||
|
|
||||||
extern const bouncelight_t *bouncelights;
|
extern const bouncelight_t *bouncelights;
|
||||||
extern int numbouncelights;
|
extern int numbouncelights;
|
||||||
|
|
|
||||||
|
|
@ -873,42 +873,6 @@ std::unordered_map<int, std::vector<patch_t *>> facenumToPatches;
|
||||||
mutex facenumToPatches_mutex;
|
mutex facenumToPatches_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
WindingFromFace
|
|
||||||
From q2 tools
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
winding_t *WindingFromFace (const bsp2_t *bsp, const bsp2_dface_t *f)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int se;
|
|
||||||
dvertex_t *dv;
|
|
||||||
int v;
|
|
||||||
winding_t *w;
|
|
||||||
|
|
||||||
w = AllocWinding (f->numedges);
|
|
||||||
w->numpoints = f->numedges;
|
|
||||||
|
|
||||||
for (i=0 ; i<f->numedges ; i++)
|
|
||||||
{
|
|
||||||
se = bsp->dsurfedges[f->firstedge + i];
|
|
||||||
if (se < 0)
|
|
||||||
v = bsp->dedges[-se].v[1];
|
|
||||||
else
|
|
||||||
v = bsp->dedges[se].v[0];
|
|
||||||
|
|
||||||
dv = &bsp->dvertexes[v];
|
|
||||||
for (int j=0; j<3; j++) {
|
|
||||||
w->p[i][j] = dv->point[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoveColinearPoints (w);
|
|
||||||
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void SavePatch (const bsp2_t *bsp, const bsp2_dface_t *sourceface, winding_t *w)
|
void SavePatch (const bsp2_t *bsp, const bsp2_dface_t *sourceface, winding_t *w)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue