Revert "make brush::faces a vector"
This reverts commit 30c7ef94ac.
This was causing issues with bevel brushes in Q2 mode. Not sure why yet. Will attempt this again soonish.
This commit is contained in:
parent
be865bc5b8
commit
11d2d51165
|
|
@ -27,7 +27,7 @@
|
||||||
struct brush_t
|
struct brush_t
|
||||||
{
|
{
|
||||||
aabb3d bounds;
|
aabb3d bounds;
|
||||||
std::vector<face_t> faces;
|
face_t *faces;
|
||||||
contentflags_t contents; /* BSP contents */
|
contentflags_t contents; /* BSP contents */
|
||||||
short lmshift; /* lightmap scaling (qu/lightmap pixel), passed to the light util */
|
short lmshift; /* lightmap scaling (qu/lightmap pixel), passed to the light util */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -298,13 +298,14 @@ static bool DiscardHintSkipFace_Q2(const mtexinfo_t &texinfo)
|
||||||
CreateBrushFaces
|
CreateBrushFaces
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t *hullbrush, const int hullnum,
|
static face_t *CreateBrushFaces(const mapentity_t *src, hullbrush_t *hullbrush, const int hullnum,
|
||||||
const rotation_t rottype = rotation_t::none, const qvec3d &rotate_offset = {})
|
const rotation_t rottype = rotation_t::none, const qvec3d &rotate_offset = {})
|
||||||
{
|
{
|
||||||
vec_t r;
|
vec_t r;
|
||||||
|
face_t *f;
|
||||||
std::optional<winding_t> w;
|
std::optional<winding_t> w;
|
||||||
qbsp_plane_t plane;
|
qbsp_plane_t plane;
|
||||||
std::list<face_t> facelist;
|
face_t *facelist = NULL;
|
||||||
qvec3d point;
|
qvec3d point;
|
||||||
vec_t max, min;
|
vec_t max, min;
|
||||||
|
|
||||||
|
|
@ -342,31 +343,31 @@ static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t
|
||||||
if (!w)
|
if (!w)
|
||||||
continue; // overconstrained plane
|
continue; // overconstrained plane
|
||||||
|
|
||||||
|
// this face is a keeper
|
||||||
|
f = new face_t{};
|
||||||
|
f->planenum = PLANENUM_LEAF;
|
||||||
|
|
||||||
if (w->size() > MAXEDGES)
|
if (w->size() > MAXEDGES)
|
||||||
FError("face->numpoints > MAXEDGES ({}), source face on line {}", MAXEDGES, mapface.linenum);
|
FError("face->numpoints > MAXEDGES ({}), source face on line {}", MAXEDGES, mapface.linenum);
|
||||||
|
|
||||||
// this face is a keeper
|
|
||||||
face_t &f = facelist.emplace_front();
|
|
||||||
f.planenum = PLANENUM_LEAF;
|
|
||||||
|
|
||||||
f.w.resize(w->size());
|
f->w.resize(w->size());
|
||||||
|
|
||||||
for (size_t j = 0; j < w->size(); j++) {
|
for (size_t j = 0; j < w->size(); j++) {
|
||||||
for (size_t k = 0; k < 3; k++) {
|
for (size_t k = 0; k < 3; k++) {
|
||||||
point[k] = w->at(j)[k] - rotate_offset[k];
|
point[k] = w->at(j)[k] - rotate_offset[k];
|
||||||
r = Q_rint(point[k]);
|
r = Q_rint(point[k]);
|
||||||
if (fabs(point[k] - r) < ZERO_EPSILON)
|
if (fabs(point[k] - r) < ZERO_EPSILON)
|
||||||
f.w[j][k] = r;
|
f->w[j][k] = r;
|
||||||
else
|
else
|
||||||
f.w[j][k] = point[k];
|
f->w[j][k] = point[k];
|
||||||
|
|
||||||
if (f.w[j][k] < min)
|
if (f->w[j][k] < min)
|
||||||
min = f.w[j][k];
|
min = f->w[j][k];
|
||||||
if (f.w[j][k] > max)
|
if (f->w[j][k] > max)
|
||||||
max = f.w[j][k];
|
max = f->w[j][k];
|
||||||
}
|
}
|
||||||
|
|
||||||
hullbrush->bounds += f.w[j];
|
hullbrush->bounds += f->w[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
// account for texture offset, from txqbsp-xt
|
// account for texture offset, from txqbsp-xt
|
||||||
|
|
@ -385,12 +386,14 @@ static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t
|
||||||
point -= rotate_offset;
|
point -= rotate_offset;
|
||||||
plane.dist = qv::dot(plane.normal, point);
|
plane.dist = qv::dot(plane.normal, point);
|
||||||
|
|
||||||
f.texinfo = hullnum > 0 ? 0 : mapface.texinfo;
|
f->texinfo = hullnum > 0 ? 0 : mapface.texinfo;
|
||||||
f.planenum = FindPlane(plane, &f.planeside);
|
f->planenum = FindPlane(plane, &f->planeside);
|
||||||
f.src_entity = const_cast<mapentity_t *>(src); // FIXME: get rid of consts on src in the callers?
|
f->src_entity = const_cast<mapentity_t *>(src); // FIXME: get rid of consts on src in the callers?
|
||||||
|
|
||||||
CheckFace(&f, mapface);
|
f->next = facelist;
|
||||||
UpdateFaceSphere(&f);
|
facelist = f;
|
||||||
|
CheckFace(f, mapface);
|
||||||
|
UpdateFaceSphere(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rotatable objects must have a bounding box big enough to
|
// Rotatable objects must have a bounding box big enough to
|
||||||
|
|
@ -415,7 +418,7 @@ static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t
|
||||||
hullbrush->bounds = {-delta, delta};
|
hullbrush->bounds = {-delta, delta};
|
||||||
}
|
}
|
||||||
|
|
||||||
return { std::make_move_iterator(facelist.begin()), std::make_move_iterator(facelist.end()) };
|
return facelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -443,6 +446,17 @@ void FreeBrushes(mapentity_t *ent)
|
||||||
ent->brushes.clear();
|
ent->brushes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=====================
|
||||||
|
FreeBrush
|
||||||
|
=====================
|
||||||
|
*/
|
||||||
|
void FreeBrush(brush_t *brush)
|
||||||
|
{
|
||||||
|
FreeBrushFaces(brush->faces);
|
||||||
|
delete brush;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
|
@ -621,9 +635,10 @@ static void AddHullEdge(hullbrush_t *hullbrush, const qvec3d &p1, const qvec3d &
|
||||||
ExpandBrush
|
ExpandBrush
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void ExpandBrush(hullbrush_t *hullbrush, const aabb3d &hull_size, std::vector<face_t> &facelist)
|
static void ExpandBrush(hullbrush_t *hullbrush, const aabb3d &hull_size, const face_t *facelist)
|
||||||
{
|
{
|
||||||
int x, s;
|
int x, s;
|
||||||
|
const face_t *f;
|
||||||
qbsp_plane_t plane;
|
qbsp_plane_t plane;
|
||||||
int cBevEdge = 0;
|
int cBevEdge = 0;
|
||||||
|
|
||||||
|
|
@ -632,9 +647,9 @@ static void ExpandBrush(hullbrush_t *hullbrush, const aabb3d &hull_size, std::ve
|
||||||
hullbrush->edges.clear();
|
hullbrush->edges.clear();
|
||||||
|
|
||||||
// create all the hull points
|
// create all the hull points
|
||||||
for (auto &f : facelist)
|
for (f = facelist; f; f = f->next)
|
||||||
for (size_t i = 0; i < f.w.size(); i++) {
|
for (size_t i = 0; i < f->w.size(); i++) {
|
||||||
AddHullPoint(hullbrush, f.w[i], hull_size);
|
AddHullPoint(hullbrush, f->w[i], hull_size);
|
||||||
cBevEdge++;
|
cBevEdge++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -666,9 +681,9 @@ static void ExpandBrush(hullbrush_t *hullbrush, const aabb3d &hull_size, std::ve
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all of the edge bevels
|
// add all of the edge bevels
|
||||||
for (auto &f : facelist)
|
for (f = facelist; f; f = f->next)
|
||||||
for (size_t i = 0; i < f.w.size(); i++)
|
for (size_t i = 0; i < f->w.size(); i++)
|
||||||
AddHullEdge(hullbrush, f.w[i], f.w[(i + 1) % f.w.size()], hull_size);
|
AddHullEdge(hullbrush, f->w[i], f->w[(i + 1) % f->w.size()], hull_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
@ -720,7 +735,7 @@ std::optional<brush_t> LoadBrush(const mapentity_t *src, const mapbrush_t *mapbr
|
||||||
const qvec3d &rotate_offset, const rotation_t rottype, const int hullnum)
|
const qvec3d &rotate_offset, const rotation_t rottype, const int hullnum)
|
||||||
{
|
{
|
||||||
hullbrush_t hullbrush;
|
hullbrush_t hullbrush;
|
||||||
std::vector<face_t> facelist;
|
face_t *facelist;
|
||||||
|
|
||||||
// create the faces
|
// create the faces
|
||||||
|
|
||||||
|
|
@ -743,7 +758,7 @@ std::optional<brush_t> LoadBrush(const mapentity_t *src, const mapbrush_t *mapbr
|
||||||
facelist = CreateBrushFaces(src, &hullbrush, hullnum);
|
facelist = CreateBrushFaces(src, &hullbrush, hullnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (facelist.empty()) {
|
if (!facelist) {
|
||||||
LogPrint("WARNING: Couldn't create brush faces\n");
|
LogPrint("WARNING: Couldn't create brush faces\n");
|
||||||
LogPrint("^ brush at line {} of .map file\n", hullbrush.linenum);
|
LogPrint("^ brush at line {} of .map file\n", hullbrush.linenum);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
@ -753,6 +768,7 @@ std::optional<brush_t> LoadBrush(const mapentity_t *src, const mapbrush_t *mapbr
|
||||||
auto &hulls = options.target_game->get_hull_sizes();
|
auto &hulls = options.target_game->get_hull_sizes();
|
||||||
Q_assert(hullnum < hulls.size());
|
Q_assert(hullnum < hulls.size());
|
||||||
ExpandBrush(&hullbrush, *(hulls.begin() + hullnum), facelist);
|
ExpandBrush(&hullbrush, *(hulls.begin() + hullnum), facelist);
|
||||||
|
FreeBrushFaces(facelist);
|
||||||
facelist = CreateBrushFaces(src, &hullbrush, hullnum, rottype, rotate_offset);
|
facelist = CreateBrushFaces(src, &hullbrush, hullnum, rottype, rotate_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -785,8 +801,6 @@ static brush_stats_t Entity_SortBrushes(mapentity_t *dst, brush_types_t &types)
|
||||||
stats.sky = types.sky.size();
|
stats.sky = types.sky.size();
|
||||||
stats.solid = types.solid.size();
|
stats.solid = types.solid.size();
|
||||||
|
|
||||||
dst->brushes.reserve(stats.detail_illusionary + stats.liquid + stats.detail_fence + stats.detail + stats.sky + stats.solid);
|
|
||||||
|
|
||||||
dst->brushes.insert(dst->brushes.end(), make_move_iterator(types.detail_illusionary.begin()), make_move_iterator(types.detail_illusionary.end()));
|
dst->brushes.insert(dst->brushes.end(), make_move_iterator(types.detail_illusionary.begin()), make_move_iterator(types.detail_illusionary.end()));
|
||||||
dst->brushes.insert(dst->brushes.end(), make_move_iterator(types.liquid.begin()), make_move_iterator(types.liquid.end()));
|
dst->brushes.insert(dst->brushes.end(), make_move_iterator(types.liquid.begin()), make_move_iterator(types.liquid.end()));
|
||||||
dst->brushes.insert(dst->brushes.end(), make_move_iterator(types.detail_fence.begin()), make_move_iterator(types.detail_fence.end()));
|
dst->brushes.insert(dst->brushes.end(), make_move_iterator(types.detail_fence.begin()), make_move_iterator(types.detail_fence.end()));
|
||||||
|
|
@ -797,6 +811,19 @@ static brush_stats_t Entity_SortBrushes(mapentity_t *dst, brush_types_t &types)
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int FaceListCount(const face_t *facelist)
|
||||||
|
{
|
||||||
|
if (facelist)
|
||||||
|
return 1 + FaceListCount(facelist->next);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Brush_NumFaces(const brush_t *brush)
|
||||||
|
{
|
||||||
|
return FaceListCount(brush->faces);
|
||||||
|
}
|
||||||
|
|
||||||
static void Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int hullnum, brush_types_t &types)
|
static void Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int hullnum, brush_types_t &types)
|
||||||
{
|
{
|
||||||
const char *classname;
|
const char *classname;
|
||||||
|
|
|
||||||
17
qbsp/csg4.cc
17
qbsp/csg4.cc
|
|
@ -206,9 +206,9 @@ static void RemoveOutsideFaces(const brush_t &brush, face_t **inside, face_t **o
|
||||||
while (face) {
|
while (face) {
|
||||||
next = face->next;
|
next = face->next;
|
||||||
std::optional<winding_t> w = face->w;
|
std::optional<winding_t> w = face->w;
|
||||||
for (auto &clipface : brush.faces) {
|
for (const face_t *clipface = brush.faces; clipface; clipface = clipface->next) {
|
||||||
qbsp_plane_t clipplane = map.planes[clipface.planenum];
|
qbsp_plane_t clipplane = map.planes[clipface->planenum];
|
||||||
if (!clipface.planeside) {
|
if (!clipface->planeside) {
|
||||||
clipplane = -clipplane;
|
clipplane = -clipplane;
|
||||||
}
|
}
|
||||||
w = w->clip(clipplane, ON_EPSILON, true)[SIDE_FRONT];
|
w = w->clip(clipplane, ON_EPSILON, true)[SIDE_FRONT];
|
||||||
|
|
@ -491,12 +491,12 @@ CopyBrushFaces
|
||||||
*/
|
*/
|
||||||
static face_t *CopyBrushFaces(const brush_t &brush)
|
static face_t *CopyBrushFaces(const brush_t &brush)
|
||||||
{
|
{
|
||||||
face_t *facelist, *newface;
|
face_t *facelist, *face, *newface;
|
||||||
|
|
||||||
facelist = NULL;
|
facelist = NULL;
|
||||||
for (auto &face : brush.faces) {
|
for (face = brush.faces; face; face = face->next) {
|
||||||
brushfaces++;
|
brushfaces++;
|
||||||
newface = new face_t(face);
|
newface = new face_t(*face);
|
||||||
newface->contents = { options.target_game->create_empty_contents(), brush.contents };
|
newface->contents = { options.target_game->create_empty_contents(), brush.contents };
|
||||||
newface->lmshift = { brush.lmshift, brush.lmshift };
|
newface->lmshift = { brush.lmshift, brush.lmshift };
|
||||||
newface->next = facelist;
|
newface->next = facelist;
|
||||||
|
|
@ -595,8 +595,9 @@ std::list<surface_t> CSGFaces(const mapentity_t *entity)
|
||||||
outside = NULL;
|
outside = NULL;
|
||||||
|
|
||||||
RemoveOutsideFaces(clipbrush, &inside, &outside);
|
RemoveOutsideFaces(clipbrush, &inside, &outside);
|
||||||
for (auto &clipface : clipbrush.faces)
|
const face_t *clipface = clipbrush.faces;
|
||||||
ClipInside(&clipface, overwrite, &inside, &outside);
|
for (; clipface; clipface = clipface->next)
|
||||||
|
ClipInside(clipface, overwrite, &inside, &outside);
|
||||||
|
|
||||||
// inside = parts of `brush` that are inside `clipbrush`
|
// inside = parts of `brush` that are inside `clipbrush`
|
||||||
// outside = parts of `brush` that are outside `clipbrush`
|
// outside = parts of `brush` that are outside `clipbrush`
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,8 @@ void ExportObj_Brushes(const std::string &filesuffix, const std::vector<const br
|
||||||
std::vector<const face_t *> faces;
|
std::vector<const face_t *> faces;
|
||||||
|
|
||||||
for (const brush_t *brush : brushes)
|
for (const brush_t *brush : brushes)
|
||||||
for (auto &face : brush->faces)
|
for (const face_t *face = brush->faces; face; face = face->next)
|
||||||
faces.push_back(&face);
|
faces.push_back(face);
|
||||||
|
|
||||||
ExportObj_Faces(filesuffix, faces);
|
ExportObj_Faces(filesuffix, faces);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2182,11 +2182,11 @@ void WriteBspBrushMap(const std::filesystem::path &name, const std::vector<brush
|
||||||
|
|
||||||
for (auto &brush : list) {
|
for (auto &brush : list) {
|
||||||
fmt::print(f, "{{\n");
|
fmt::print(f, "{{\n");
|
||||||
for (auto &face : brush.faces) {
|
for (const face_t *face = brush.faces; face; face = face->next) {
|
||||||
// FIXME: Factor out this mess
|
// FIXME: Factor out this mess
|
||||||
qbsp_plane_t plane = map.planes.at(face.planenum);
|
qbsp_plane_t plane = map.planes.at(face->planenum);
|
||||||
|
|
||||||
if (face.planeside) {
|
if (face->planeside) {
|
||||||
plane = -plane;
|
plane = -plane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
61
qbsp/qbsp.cc
61
qbsp/qbsp.cc
|
|
@ -97,20 +97,20 @@ Adds any additional planes necessary to allow the brush to be expanded
|
||||||
against axial bounding boxes
|
against axial bounding boxes
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static std::vector<std::tuple<size_t, const face_t *>> AddBrushBevels(const brush_t &b)
|
static std::vector<std::tuple<size_t, face_t *>> AddBrushBevels(const brush_t *b)
|
||||||
{
|
{
|
||||||
// add already-present planes
|
// add already-present planes
|
||||||
std::vector<std::tuple<size_t, const face_t *>> planes;
|
std::vector<std::tuple<size_t, face_t *>> planes;
|
||||||
|
|
||||||
for (auto &f : b.faces) {
|
for (face_t *f = b->faces; f; f = f->next) {
|
||||||
int32_t planenum = f.planenum;
|
int32_t planenum = f->planenum;
|
||||||
|
|
||||||
if (f.planeside) {
|
if (f->planeside) {
|
||||||
planenum = FindPlane(-map.planes[f.planenum], nullptr);
|
planenum = FindPlane(-map.planes[f->planenum], nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t outputplanenum = ExportMapPlane(planenum);
|
int32_t outputplanenum = ExportMapPlane(planenum);
|
||||||
planes.emplace_back(outputplanenum, &f);
|
planes.emplace_back(outputplanenum, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -131,13 +131,13 @@ static std::vector<std::tuple<size_t, const face_t *>> AddBrushBevels(const brus
|
||||||
qplane3d new_plane { };
|
qplane3d new_plane { };
|
||||||
new_plane.normal[axis] = dir;
|
new_plane.normal[axis] = dir;
|
||||||
if (dir == 1)
|
if (dir == 1)
|
||||||
new_plane.dist = b.bounds.maxs()[axis];
|
new_plane.dist = b->bounds.maxs()[axis];
|
||||||
else
|
else
|
||||||
new_plane.dist = -b.bounds.mins()[axis];
|
new_plane.dist = -b->bounds.mins()[axis];
|
||||||
|
|
||||||
int32_t planenum = FindPlane(new_plane, nullptr);
|
int32_t planenum = FindPlane(new_plane, nullptr);
|
||||||
int32_t outputplanenum = ExportMapPlane(planenum);
|
int32_t outputplanenum = ExportMapPlane(planenum);
|
||||||
planes.emplace_back(outputplanenum, &b.faces.front());
|
planes.emplace_back(outputplanenum, b->faces);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the plane is not in it canonical order, swap it
|
// if the plane is not in it canonical order, swap it
|
||||||
|
|
@ -185,20 +185,19 @@ static std::vector<std::tuple<size_t, const face_t *>> AddBrushBevels(const brus
|
||||||
continue;
|
continue;
|
||||||
current.dist = qv::dot(w[j], current.normal);
|
current.dist = qv::dot(w[j], current.normal);
|
||||||
|
|
||||||
auto it = b.faces.begin();
|
face_t *f;
|
||||||
|
|
||||||
// if all the points on all the sides are
|
// if all the points on all the sides are
|
||||||
// behind this plane, it is a proper edge bevel
|
// behind this plane, it is a proper edge bevel
|
||||||
for (; it != b.faces.end(); it++) {
|
for (f = b->faces; f; f = f->next) {
|
||||||
auto &f = *it;
|
auto &plane = map.planes[f->planenum];
|
||||||
auto &plane = map.planes[f.planenum];
|
qplane3d temp = f->planeside ? -plane : plane;
|
||||||
qplane3d temp = f.planeside ? -plane : plane;
|
|
||||||
|
|
||||||
// if this plane has allready been used, skip it
|
// if this plane has allready been used, skip it
|
||||||
if (qv::epsilonEqual(current, temp))
|
if (qv::epsilonEqual(current, temp))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto &w2 = f.w;
|
auto &w2 = f->w;
|
||||||
if (!w2.size())
|
if (!w2.size())
|
||||||
continue;
|
continue;
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
@ -211,13 +210,13 @@ static std::vector<std::tuple<size_t, const face_t *>> AddBrushBevels(const brus
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it == b.faces.end())
|
if (f)
|
||||||
continue; // wasn't part of the outer hull
|
continue; // wasn't part of the outer hull
|
||||||
|
|
||||||
// add this plane
|
// add this plane
|
||||||
int32_t planenum = FindPlane(current, nullptr);
|
int32_t planenum = FindPlane(current, nullptr);
|
||||||
int32_t outputplanenum = ExportMapPlane(planenum);
|
int32_t outputplanenum = ExportMapPlane(planenum);
|
||||||
planes.emplace_back(outputplanenum, &b.faces.front());
|
planes.emplace_back(outputplanenum, b->faces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +235,7 @@ static void ExportBrushList(const mapentity_t *entity, node_t *node, uint32_t &b
|
||||||
dbrush_t &brush = map.bsp.dbrushes.emplace_back(
|
dbrush_t &brush = map.bsp.dbrushes.emplace_back(
|
||||||
dbrush_t{static_cast<int32_t>(map.bsp.dbrushsides.size()), 0, b.contents.native});
|
dbrush_t{static_cast<int32_t>(map.bsp.dbrushsides.size()), 0, b.contents.native});
|
||||||
|
|
||||||
auto bevels = AddBrushBevels(b);
|
auto bevels = AddBrushBevels(&b);
|
||||||
|
|
||||||
for (auto &plane : bevels) {
|
for (auto &plane : bevels) {
|
||||||
map.bsp.dbrushsides.push_back(
|
map.bsp.dbrushsides.push_back(
|
||||||
|
|
@ -753,10 +752,10 @@ static void BSPX_Brushes_AddModel(struct bspxbrushes_s *ctx, int modelnum, std::
|
||||||
|
|
||||||
for (auto &b : brushes) {
|
for (auto &b : brushes) {
|
||||||
permodel.numbrushes++;
|
permodel.numbrushes++;
|
||||||
for (auto &f : b.faces) {
|
for (face_t *f = b.faces; f; f = f->next) {
|
||||||
/*skip axial*/
|
/*skip axial*/
|
||||||
if (fabs(map.planes[f.planenum].normal[0]) == 1 || fabs(map.planes[f.planenum].normal[1]) == 1 ||
|
if (fabs(map.planes[f->planenum].normal[0]) == 1 || fabs(map.planes[f->planenum].normal[1]) == 1 ||
|
||||||
fabs(map.planes[f.planenum].normal[2]) == 1)
|
fabs(map.planes[f->planenum].normal[2]) == 1)
|
||||||
continue;
|
continue;
|
||||||
permodel.numfaces++;
|
permodel.numfaces++;
|
||||||
}
|
}
|
||||||
|
|
@ -774,10 +773,10 @@ static void BSPX_Brushes_AddModel(struct bspxbrushes_s *ctx, int modelnum, std::
|
||||||
for (auto &b : brushes) {
|
for (auto &b : brushes) {
|
||||||
bspxbrushes_perbrush perbrush {};
|
bspxbrushes_perbrush perbrush {};
|
||||||
|
|
||||||
for (auto &f : b.faces) {
|
for (face_t *f = b.faces; f; f = f->next) {
|
||||||
/*skip axial*/
|
/*skip axial*/
|
||||||
if (fabs(map.planes[f.planenum].normal[0]) == 1 || fabs(map.planes[f.planenum].normal[1]) == 1 ||
|
if (fabs(map.planes[f->planenum].normal[0]) == 1 || fabs(map.planes[f->planenum].normal[1]) == 1 ||
|
||||||
fabs(map.planes[f.planenum].normal[2]) == 1)
|
fabs(map.planes[f->planenum].normal[2]) == 1)
|
||||||
continue;
|
continue;
|
||||||
perbrush.numfaces++;
|
perbrush.numfaces++;
|
||||||
}
|
}
|
||||||
|
|
@ -815,18 +814,18 @@ static void BSPX_Brushes_AddModel(struct bspxbrushes_s *ctx, int modelnum, std::
|
||||||
|
|
||||||
str <= perbrush;
|
str <= perbrush;
|
||||||
|
|
||||||
for (auto &f : b.faces) {
|
for (face_t *f = b.faces; f; f = f->next) {
|
||||||
/*skip axial*/
|
/*skip axial*/
|
||||||
if (fabs(map.planes[f.planenum].normal[0]) == 1 || fabs(map.planes[f.planenum].normal[1]) == 1 ||
|
if (fabs(map.planes[f->planenum].normal[0]) == 1 || fabs(map.planes[f->planenum].normal[1]) == 1 ||
|
||||||
fabs(map.planes[f.planenum].normal[2]) == 1)
|
fabs(map.planes[f->planenum].normal[2]) == 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bspxbrushes_perface perface;
|
bspxbrushes_perface perface;
|
||||||
|
|
||||||
if (f.planeside) {
|
if (f->planeside) {
|
||||||
perface = -map.planes[f.planenum];
|
perface = -map.planes[f->planenum];
|
||||||
} else {
|
} else {
|
||||||
perface = map.planes[f.planenum];
|
perface = map.planes[f->planenum];
|
||||||
}
|
}
|
||||||
|
|
||||||
str <= std::tie(perface.normal, perface.dist);
|
str <= std::tie(perface.normal, perface.dist);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue