qbsp: experimental -scale flag for applying uniform scale to map
This commit is contained in:
parent
e9539eff82
commit
537bc3686d
|
|
@ -227,6 +227,7 @@ public:
|
||||||
setting_validator<setting_int32> maxedges;
|
setting_validator<setting_int32> maxedges;
|
||||||
setting_numeric<vec_t> midsplitbrushfraction;
|
setting_numeric<vec_t> midsplitbrushfraction;
|
||||||
setting_string add;
|
setting_string add;
|
||||||
|
setting_scalar scale;
|
||||||
setting_bool loghulls;
|
setting_bool loghulls;
|
||||||
setting_bool logbmodels;
|
setting_bool logbmodels;
|
||||||
|
|
||||||
|
|
|
||||||
31
qbsp/map.cc
31
qbsp/map.cc
|
|
@ -2582,6 +2582,12 @@ static void ScaleMapFace(mapface_t &face, const qvec3d &scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
face.set_texvecs(newtexvecs);
|
face.set_texvecs(newtexvecs);
|
||||||
|
|
||||||
|
// update winding
|
||||||
|
|
||||||
|
for (qvec3d &p : face.winding) {
|
||||||
|
p = scaleM * p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RotateMapFace(mapface_t &face, const qvec3d &angles)
|
static void RotateMapFace(mapface_t &face, const qvec3d &angles)
|
||||||
|
|
@ -3070,6 +3076,27 @@ void ProcessMapBrushes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// apply global scale
|
||||||
|
if (qbsp_options.scale.value() != 1.0) {
|
||||||
|
// scale brushes
|
||||||
|
for (auto &brush : entity.mapbrushes) {
|
||||||
|
for (auto &f : brush.faces) {
|
||||||
|
ScaleMapFace(f, qvec3d(qbsp_options.scale.value()));
|
||||||
|
}
|
||||||
|
CalculateBrushBounds(brush);
|
||||||
|
}
|
||||||
|
|
||||||
|
// scale point entity origin
|
||||||
|
if (entity.epairs.find("origin") != entity.epairs.end()) {
|
||||||
|
qvec3d origin;
|
||||||
|
if (3 == entity.epairs.get_vector("origin", origin)) {
|
||||||
|
origin *= qbsp_options.scale.value();
|
||||||
|
|
||||||
|
entity.epairs.set("origin", qv::to_string(origin));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove windings, we no longer need them
|
// remove windings, we no longer need them
|
||||||
for (auto &brush : entity.mapbrushes) {
|
for (auto &brush : entity.mapbrushes) {
|
||||||
for (auto &f : brush.faces) {
|
for (auto &f : brush.faces) {
|
||||||
|
|
@ -3474,6 +3501,10 @@ inline vec_t GetBrushExtents(const mapbrush_t &hullbrush)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qbsp_options.scale.value() != 1) {
|
||||||
|
extents *= qbsp_options.scale.value();
|
||||||
|
}
|
||||||
|
|
||||||
return extents;
|
return extents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -569,6 +569,8 @@ qbsp_settings::qbsp_settings()
|
||||||
midsplitbrushfraction{this, "midsplitbrushfraction", 0.0, &common_format_group,
|
midsplitbrushfraction{this, "midsplitbrushfraction", 0.0, &common_format_group,
|
||||||
"switch to cheaper partitioning if a node contains this % of brushes in the map"},
|
"switch to cheaper partitioning if a node contains this % of brushes in the map"},
|
||||||
add{this, "add", "", "", &common_format_group, "the given map file will be appended to the base map"},
|
add{this, "add", "", "", &common_format_group, "the given map file will be appended to the base map"},
|
||||||
|
scale{this, "scale", 1.0, &map_development_group,
|
||||||
|
"scales the map brushes and point entity origins by a give factor"},
|
||||||
loghulls{this, {"loghulls"}, false, &logging_group, "print log output for collision hulls"},
|
loghulls{this, {"loghulls"}, false, &logging_group, "print log output for collision hulls"},
|
||||||
logbmodels{this, {"logbmodels"}, false, &logging_group, "print log output for bmodels"}
|
logbmodels{this, {"logbmodels"}, false, &logging_group, "print log output for bmodels"}
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue