style: reformat
This commit is contained in:
parent
bb6069f8d4
commit
18a7df1a1b
|
|
@ -1803,9 +1803,10 @@ static auto as_tuple(const surfflags_t &flags)
|
||||||
{
|
{
|
||||||
return std::tie(flags.native, flags.is_nodraw, flags.is_hintskip, flags.is_hint, flags.no_dirt, flags.no_shadow,
|
return std::tie(flags.native, flags.is_nodraw, flags.is_hintskip, flags.is_hint, flags.no_dirt, flags.no_shadow,
|
||||||
flags.no_bounce, flags.no_minlight, flags.no_expand, flags.no_phong, flags.light_ignore,
|
flags.no_bounce, flags.no_minlight, flags.no_expand, flags.no_phong, flags.light_ignore,
|
||||||
flags.surflight_rescale, flags.surflight_style, flags.surflight_color, flags.surflight_minlight_scale, flags.phong_angle, flags.phong_angle_concave, flags.phong_group, flags.minlight,
|
flags.surflight_rescale, flags.surflight_style, flags.surflight_color, flags.surflight_minlight_scale,
|
||||||
flags.minlight_color, flags.light_alpha, flags.maxlight, flags.lightcolorscale, flags.surflight_group,
|
flags.phong_angle, flags.phong_angle_concave, flags.phong_group, flags.minlight, flags.minlight_color,
|
||||||
flags.world_units_per_luxel, flags.object_channel_mask);
|
flags.light_alpha, flags.maxlight, flags.lightcolorscale, flags.surflight_group, flags.world_units_per_luxel,
|
||||||
|
flags.object_channel_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool surfflags_t::needs_write() const
|
bool surfflags_t::needs_write() const
|
||||||
|
|
|
||||||
|
|
@ -110,14 +110,8 @@ constexpr struct
|
||||||
const char *suffix;
|
const char *suffix;
|
||||||
ext id;
|
ext id;
|
||||||
decltype(load_wal) *loader;
|
decltype(load_wal) *loader;
|
||||||
} extension_list[] = {
|
} extension_list[] = {{".png", ext::STB, load_stb}, {".jpg", ext::STB, load_stb}, {".tga", ext::TGA, load_tga},
|
||||||
{".png", ext::STB, load_stb},
|
{".wal", ext::WAL, load_wal}, {".mip", ext::MIP, load_mip}, {"", ext::MIP, load_mip}};
|
||||||
{".jpg", ext::STB, load_stb},
|
|
||||||
{".tga", ext::TGA, load_tga},
|
|
||||||
{".wal", ext::WAL, load_wal},
|
|
||||||
{".mip", ext::MIP, load_mip},
|
|
||||||
{"", ext::MIP, load_mip}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Attempt to load a texture from the specified name.
|
// Attempt to load a texture from the specified name.
|
||||||
std::tuple<std::optional<texture>, fs::resolve_result, fs::data> load_texture(
|
std::tuple<std::optional<texture>, fs::resolve_result, fs::data> load_texture(
|
||||||
|
|
@ -142,9 +136,7 @@ constexpr struct
|
||||||
meta_ext id;
|
meta_ext id;
|
||||||
decltype(load_wal_meta) *loader;
|
decltype(load_wal_meta) *loader;
|
||||||
} meta_extension_list[] = {
|
} meta_extension_list[] = {
|
||||||
{".wal_json", meta_ext::WAL_JSON, load_wal_json_meta},
|
{".wal_json", meta_ext::WAL_JSON, load_wal_json_meta}, {".wal", meta_ext::WAL, load_wal_meta}};
|
||||||
{".wal", meta_ext::WAL, load_wal_meta}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Attempt to load a texture meta from the specified name.
|
// Attempt to load a texture meta from the specified name.
|
||||||
std::tuple<std::optional<texture_meta>, fs::resolve_result, fs::data> load_texture_meta(
|
std::tuple<std::optional<texture_meta>, fs::resolve_result, fs::data> load_texture_meta(
|
||||||
|
|
|
||||||
|
|
@ -290,8 +290,8 @@ struct texture_def_issues_t : logging::stat_tracker_t
|
||||||
false, true);
|
false, true);
|
||||||
|
|
||||||
stat &num_repaired = register_stat(
|
stat &num_repaired = register_stat(
|
||||||
"faces have invalid texture projections and were repaired. Use -verbose to display affected faces."
|
"faces have invalid texture projections and were repaired. Use -verbose to display affected faces.", false,
|
||||||
, false, true);
|
true);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ParseEntity(parser_t &parser, mapentity_t &entity, texture_def_issues_t &issues_stats);
|
bool ParseEntity(parser_t &parser, mapentity_t &entity, texture_def_issues_t &issues_stats);
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ void LightGrid(bspdata_t *bspdata)
|
||||||
logging::print(" {} grid_mins\n", data.grid_mins);
|
logging::print(" {} grid_mins\n", data.grid_mins);
|
||||||
logging::print(" {} grid_maxs\n", grid_maxs);
|
logging::print(" {} grid_maxs\n", grid_maxs);
|
||||||
logging::print(" {} num_styles\n", data.num_styles);
|
logging::print(" {} num_styles\n", data.num_styles);
|
||||||
|
|
||||||
// octree lump
|
// octree lump
|
||||||
if (light_options.lightgrid_format.value() == lightgrid_format_t::OCTREE) {
|
if (light_options.lightgrid_format.value() == lightgrid_format_t::OCTREE) {
|
||||||
bspdata->bspx.transfer("LIGHTGRID_OCTREE", MakeOctreeLump(bsp, data));
|
bspdata->bspx.transfer("LIGHTGRID_OCTREE", MakeOctreeLump(bsp, data));
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys
|
||||||
} else {
|
} else {
|
||||||
// Handle arghrad sky light settings http://www.bspquakeeditor.com/arghrad/sunlight.html#sky
|
// Handle arghrad sky light settings http://www.bspquakeeditor.com/arghrad/sunlight.html#sky
|
||||||
if (!texture_color.has_value()) {
|
if (!texture_color.has_value()) {
|
||||||
if (cfg.sky_surface.is_changed() && is_sky) {
|
if (cfg.sky_surface.is_changed() && is_sky) {
|
||||||
// FIXME: this only handles the "_sky_surface" "red green blue" format.
|
// FIXME: this only handles the "_sky_surface" "red green blue" format.
|
||||||
// There are other more complex variants we could handle documented in the link above.
|
// There are other more complex variants we could handle documented in the link above.
|
||||||
// FIXME: we require value to be nonzero, see the check above - not sure if this matches arghrad
|
// FIXME: we require value to be nonzero, see the check above - not sure if this matches arghrad
|
||||||
|
|
|
||||||
|
|
@ -715,18 +715,18 @@ static void Brush_LoadEntity(mapentity_t &dst, mapentity_t &src, hull_index_t hu
|
||||||
if (map.is_world_entity(src) || IsWorldBrushEntity(src) || IsNonRemoveWorldBrushEntity(src)) {
|
if (map.is_world_entity(src) || IsWorldBrushEntity(src) || IsNonRemoveWorldBrushEntity(src)) {
|
||||||
if (map.region) {
|
if (map.region) {
|
||||||
if (map.region->bounds.disjoint(mapbrush.bounds)) {
|
if (map.region->bounds.disjoint(mapbrush.bounds)) {
|
||||||
//stats.regioned_brushes++;
|
// stats.regioned_brushes++;
|
||||||
//it = entity.mapbrushes.erase(it);
|
// it = entity.mapbrushes.erase(it);
|
||||||
//logging::print("removed broosh\n");
|
// logging::print("removed broosh\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto ®ion : map.antiregions) {
|
for (auto ®ion : map.antiregions) {
|
||||||
if (!region.bounds.disjoint(mapbrush.bounds)) {
|
if (!region.bounds.disjoint(mapbrush.bounds)) {
|
||||||
//stats.regioned_brushes++;
|
// stats.regioned_brushes++;
|
||||||
//it = entity.mapbrushes.erase(it);
|
// it = entity.mapbrushes.erase(it);
|
||||||
//logging::print("removed broosh\n");
|
// logging::print("removed broosh\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
qbsp/map.cc
20
qbsp/map.cc
|
|
@ -669,9 +669,10 @@ static surfflags_t SurfFlagsForEntity(
|
||||||
// FIXME: get_color, to match settings
|
// FIXME: get_color, to match settings
|
||||||
if (entity.epairs.has("_surflight_color") && entity.epairs.get_vector("_surflight_color", color) == 3) {
|
if (entity.epairs.has("_surflight_color") && entity.epairs.get_vector("_surflight_color", color) == 3) {
|
||||||
if (color[0] <= 1 && color[1] <= 1 && color[2] <= 1) {
|
if (color[0] <= 1 && color[1] <= 1 && color[2] <= 1) {
|
||||||
flags.surflight_color = qvec3b{ (uint8_t) (color[0] * 255), (uint8_t) (color[1] * 255), (uint8_t) (color[2] * 255) };
|
flags.surflight_color =
|
||||||
|
qvec3b{(uint8_t)(color[0] * 255), (uint8_t)(color[1] * 255), (uint8_t)(color[2] * 255)};
|
||||||
} else {
|
} else {
|
||||||
flags.surflight_color = qvec3b{ (uint8_t) (color[0]), (uint8_t) (color[1]), (uint8_t) (color[2]) };
|
flags.surflight_color = qvec3b{(uint8_t)(color[0]), (uint8_t)(color[1]), (uint8_t)(color[2])};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -681,7 +682,8 @@ static surfflags_t SurfFlagsForEntity(
|
||||||
if (entity.epairs.has("_surflight_minlight_scale"))
|
if (entity.epairs.has("_surflight_minlight_scale"))
|
||||||
flags.surflight_minlight_scale = entity.epairs.get_float("_surflight_minlight_scale");
|
flags.surflight_minlight_scale = entity.epairs.get_float("_surflight_minlight_scale");
|
||||||
// Paril: inherit _surflight_minlight_scale from worldspawn if unset
|
// Paril: inherit _surflight_minlight_scale from worldspawn if unset
|
||||||
else if (!entity.epairs.has("_surflight_minlight_scale") && map.world_entity().epairs.has("_surflight_minlight_scale"))
|
else if (!entity.epairs.has("_surflight_minlight_scale") &&
|
||||||
|
map.world_entity().epairs.has("_surflight_minlight_scale"))
|
||||||
flags.surflight_minlight_scale = map.world_entity().epairs.get_float("_surflight_minlight_scale");
|
flags.surflight_minlight_scale = map.world_entity().epairs.get_float("_surflight_minlight_scale");
|
||||||
|
|
||||||
// "_minlight_exclude", "_minlight_exclude2", "_minlight_exclude3"...
|
// "_minlight_exclude", "_minlight_exclude2", "_minlight_exclude3"...
|
||||||
|
|
@ -2561,7 +2563,7 @@ static mapbrush_t ParseBrush(parser_t &parser, mapentity_t &entity, texture_def_
|
||||||
|
|
||||||
new_brush.contents = brush.contents;
|
new_brush.contents = brush.contents;
|
||||||
new_brush.line = brush.line;
|
new_brush.line = brush.line;
|
||||||
|
|
||||||
for (auto &side : brush.faces) {
|
for (auto &side : brush.faces) {
|
||||||
|
|
||||||
// if it's the side we're extruding, increase its dist
|
// if it's the side we're extruding, increase its dist
|
||||||
|
|
@ -2572,10 +2574,11 @@ static mapbrush_t ParseBrush(parser_t &parser, mapentity_t &entity, texture_def_
|
||||||
new_side.raw_info = side.raw_info;
|
new_side.raw_info = side.raw_info;
|
||||||
new_side.texname = side.texname;
|
new_side.texname = side.texname;
|
||||||
new_side.planenum = side.planenum;
|
new_side.planenum = side.planenum;
|
||||||
new_side.planenum = map.add_or_find_plane({ new_side.get_plane().get_normal(), new_side.get_plane().get_dist() + 16.f });
|
new_side.planenum = map.add_or_find_plane(
|
||||||
|
{new_side.get_plane().get_normal(), new_side.get_plane().get_dist() + 16.f});
|
||||||
|
|
||||||
new_brush.faces.emplace_back(std::move(new_side));
|
new_brush.faces.emplace_back(std::move(new_side));
|
||||||
// the inverted side is special
|
// the inverted side is special
|
||||||
} else if (side.get_plane().get_normal() == -new_brush_side.get_plane().get_normal()) {
|
} else if (side.get_plane().get_normal() == -new_brush_side.get_plane().get_normal()) {
|
||||||
|
|
||||||
// add the other side
|
// add the other side
|
||||||
|
|
@ -2584,7 +2587,8 @@ static mapbrush_t ParseBrush(parser_t &parser, mapentity_t &entity, texture_def_
|
||||||
flipped_side.contents = side.contents;
|
flipped_side.contents = side.contents;
|
||||||
flipped_side.raw_info = side.raw_info;
|
flipped_side.raw_info = side.raw_info;
|
||||||
flipped_side.texname = side.texname;
|
flipped_side.texname = side.texname;
|
||||||
flipped_side.planenum = map.add_or_find_plane({ -new_brush_side.get_plane().get_normal(), -new_brush_side.get_plane().get_dist() });
|
flipped_side.planenum = map.add_or_find_plane(
|
||||||
|
{-new_brush_side.get_plane().get_normal(), -new_brush_side.get_plane().get_dist()});
|
||||||
|
|
||||||
new_brush.faces.emplace_back(std::move(flipped_side));
|
new_brush.faces.emplace_back(std::move(flipped_side));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3234,7 +3238,7 @@ void ProcessMapBrushes()
|
||||||
// remove ents in region
|
// remove ents in region
|
||||||
if (map.region || map.antiregions.size()) {
|
if (map.region || map.antiregions.size()) {
|
||||||
|
|
||||||
for (auto it = map.entities.begin(); it != map.entities.end(); ) {
|
for (auto it = map.entities.begin(); it != map.entities.end();) {
|
||||||
auto &entity = *it;
|
auto &entity = *it;
|
||||||
|
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue