remove file_order; we can infer this from the pointers now
remove unnecessary early microbrush check, use microbrush option value on later one
This commit is contained in:
parent
bca6bda7c3
commit
faf9173f10
|
|
@ -57,7 +57,6 @@ struct bspbrush_t
|
|||
*/
|
||||
bspbrush_t *original;
|
||||
mapbrush_t *mapbrush;
|
||||
uint32_t file_order;
|
||||
aabb3d bounds;
|
||||
int side, testside; // side of node during construction
|
||||
std::vector<side_t> sides;
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ static twosided<std::unique_ptr<bspbrush_t>> SplitBrush(std::unique_ptr<bspbrush
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
v1 = BrushVolume(*result[i]);
|
||||
if (v1 < 1.0) {
|
||||
if (v1 < qbsp_options.microvolume.value()) {
|
||||
result[i] = nullptr;
|
||||
stats.c_tinyvolumes++;
|
||||
}
|
||||
|
|
@ -1021,10 +1021,10 @@ static void BuildTree_r(tree_t *tree, node_t *node, std::vector<std::unique_ptr<
|
|||
}
|
||||
|
||||
// to save time/memory we can destroy node's volume at this point
|
||||
auto children_volumes = SplitBrush(std::move(node->volume), bestplane.value(), stats);
|
||||
node->volume = nullptr;
|
||||
node->children[0]->volume = std::move(children_volumes[0]);
|
||||
node->children[1]->volume = std::move(children_volumes[1]);
|
||||
auto children_volumes = SplitBrush(std::move(node->volume), bestplane.value(), stats);
|
||||
node->volume = nullptr;
|
||||
node->children[0]->volume = std::move(children_volumes[0]);
|
||||
node->children[1]->volume = std::move(children_volumes[1]);
|
||||
|
||||
// recursively process children
|
||||
tbb::task_group g;
|
||||
|
|
@ -1049,6 +1049,7 @@ static std::unique_ptr<tree_t> BrushBSP_internal(mapentity_t *entity, std::vecto
|
|||
for (const auto &b : brushlist) {
|
||||
c_brushes++;
|
||||
|
||||
#if 0
|
||||
// fixme-brushbsp: why does this just print and do nothing? should
|
||||
// the brush be removed?
|
||||
double volume = BrushVolume(*b);
|
||||
|
|
@ -1056,6 +1057,7 @@ static std::unique_ptr<tree_t> BrushBSP_internal(mapentity_t *entity, std::vecto
|
|||
logging::print("WARNING: {}: microbrush\n",
|
||||
b->original->mapbrush->line);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (side_t &side : b->sides) {
|
||||
if (side.bevel)
|
||||
|
|
@ -1106,7 +1108,7 @@ static std::unique_ptr<tree_t> BrushBSP_internal(mapentity_t *entity, std::vecto
|
|||
|
||||
auto node = tree->create_node();
|
||||
|
||||
node->volume = BrushFromBounds(tree->bounds.grow(SIDESPACE));
|
||||
node->volume = BrushFromBounds(tree->bounds.grow(SIDESPACE));
|
||||
node->bounds = tree->bounds.grow(SIDESPACE);
|
||||
|
||||
tree->headnode = node;
|
||||
|
|
|
|||
|
|
@ -450,11 +450,13 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum)
|
|||
*/
|
||||
Brush_LoadEntity(entity, hullnum, brushes);
|
||||
|
||||
// assign brush file order
|
||||
size_t num_sides = 0;
|
||||
for (size_t i = 0; i < brushes.size(); ++i) {
|
||||
brushes[i]->file_order = i;
|
||||
num_sides += brushes[i]->sides.size();
|
||||
}
|
||||
|
||||
logging::print(logging::flag::STAT, "INFO: calculating BSP for {} brushes with {} sides\n", brushes.size(), num_sides);
|
||||
|
||||
// entity->brushes = ChopBrushes(entity->brushes);
|
||||
|
||||
// if (entity == map.world_entity() && hullnum <= 0) {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static void ConvertNodeToLeaf(node_t *node, const contentflags_t &contents)
|
|||
node->original_brushes.insert(node->original_brushes.end(), node->children[base ^ 1]->original_brushes.begin(), node->children[base ^ 1]->original_brushes.end());
|
||||
|
||||
std::sort(node->original_brushes.begin(), node->original_brushes.end(), [](const bspbrush_t *a, const bspbrush_t *b) {
|
||||
return a->file_order < b->file_order;
|
||||
return a->mapbrush < b->mapbrush;
|
||||
});
|
||||
auto unique = std::unique(node->original_brushes.begin(), node->original_brushes.end());
|
||||
node->original_brushes.erase(unique, node->original_brushes.end());
|
||||
|
|
|
|||
Loading…
Reference in New Issue