move _omitbrushes to the loading phase; this will greatly improve performance of loading a map with a ton of brushes that has most of them omitted.
This commit is contained in:
parent
bfe56b0663
commit
7422776f38
|
|
@ -653,12 +653,6 @@ std::optional<bspbrush_t> LoadBrush(const mapentity_t &src, mapbrush_t &mapbrush
|
||||||
|
|
||||||
static void Brush_LoadEntity(mapentity_t &dst, mapentity_t &src, hull_index_t hullnum, content_stats_base_t &stats, bspbrush_t::container &brushes, logging::percent_clock &clock, size_t &num_clipped)
|
static void Brush_LoadEntity(mapentity_t &dst, mapentity_t &src, hull_index_t hullnum, content_stats_base_t &stats, bspbrush_t::container &brushes, logging::percent_clock &clock, size_t &num_clipped)
|
||||||
{
|
{
|
||||||
// _omitbrushes 1 just discards all brushes in the entity.
|
|
||||||
// could be useful for geometry guides, selective compilation, etc.
|
|
||||||
if (src.epairs.get_int("_omitbrushes")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clock.max += src.mapbrushes.size();
|
clock.max += src.mapbrushes.size();
|
||||||
|
|
||||||
bool all_detail, all_detail_fence, all_detail_illusionary;
|
bool all_detail, all_detail_fence, all_detail_illusionary;
|
||||||
|
|
|
||||||
13
qbsp/map.cc
13
qbsp/map.cc
|
|
@ -2207,6 +2207,10 @@ bool ParseEntity(parser_t &parser, mapentity_t &entity)
|
||||||
|
|
||||||
entity.mapbrushes.clear();
|
entity.mapbrushes.clear();
|
||||||
|
|
||||||
|
// _omitbrushes 1 just discards all brushes in the entity.
|
||||||
|
// could be useful for geometry guides, selective compilation, etc.
|
||||||
|
bool omit = entity.epairs.get_int("_omitbrushes");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!parser.parse_token())
|
if (!parser.parse_token())
|
||||||
FError("Unexpected EOF (no closing brace)");
|
FError("Unexpected EOF (no closing brace)");
|
||||||
|
|
@ -2216,7 +2220,16 @@ bool ParseEntity(parser_t &parser, mapentity_t &entity)
|
||||||
// once we run into the first brush, set up textures state.
|
// once we run into the first brush, set up textures state.
|
||||||
EnsureTexturesLoaded();
|
EnsureTexturesLoaded();
|
||||||
|
|
||||||
|
if (omit) {
|
||||||
|
// skip until a } since we don't care to load brushes on this entity
|
||||||
|
do {
|
||||||
|
if (!parser.parse_token()) {
|
||||||
|
FError("Unexpected EOF (no closing brace)");
|
||||||
|
}
|
||||||
|
} while (parser.token != "}");
|
||||||
|
} else {
|
||||||
entity.mapbrushes.emplace_back(ParseBrush(parser, entity));
|
entity.mapbrushes.emplace_back(ParseBrush(parser, entity));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ParseEpair(parser, entity);
|
ParseEpair(parser, entity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue