consistency rename; mtexinfo_t -> maptexinfo_t
This commit is contained in:
parent
8afcc54b74
commit
c62480c337
|
|
@ -133,10 +133,10 @@ struct mapdata_t
|
|||
std::vector<mapentity_t> entities;
|
||||
std::vector<qbsp_plane_t> planes;
|
||||
std::vector<texdata_t> miptex;
|
||||
std::vector<mtexinfo_t> mtexinfos;
|
||||
std::vector<maptexinfo_t> mtexinfos;
|
||||
|
||||
/* quick lookup for texinfo */
|
||||
std::map<mtexinfo_t, int> mtexinfo_lookup;
|
||||
std::map<maptexinfo_t, int> mtexinfo_lookup;
|
||||
|
||||
/* map from plane hash code to list of indicies in `planes` vector */
|
||||
std::unordered_map<int, std::vector<int>> planehash;
|
||||
|
|
@ -204,7 +204,7 @@ inline int FindMiptex(const char *name, bool internal = false, bool recursive =
|
|||
std::optional<extended_texinfo_t> extended_info;
|
||||
return FindMiptex(name, extended_info, internal, recursive);
|
||||
}
|
||||
int FindTexinfo(const mtexinfo_t &texinfo);
|
||||
int FindTexinfo(const maptexinfo_t &texinfo);
|
||||
|
||||
void PrintEntity(const mapentity_t *entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ constexpr double SIDESPACE = 24.0;
|
|||
#include <common/cmdlib.hh>
|
||||
#include <common/mathlib.hh>
|
||||
|
||||
struct mtexinfo_t
|
||||
struct maptexinfo_t
|
||||
{
|
||||
texvecf vecs; /* [s/t][xyz offset] */
|
||||
int32_t miptex = 0;
|
||||
|
|
@ -301,9 +301,9 @@ struct mtexinfo_t
|
|||
|
||||
constexpr auto as_tuple() const { return std::tie(vecs, miptex, flags, value, next); }
|
||||
|
||||
constexpr bool operator<(const mtexinfo_t &other) const { return as_tuple() < other.as_tuple(); }
|
||||
constexpr bool operator<(const maptexinfo_t &other) const { return as_tuple() < other.as_tuple(); }
|
||||
|
||||
constexpr bool operator>(const mtexinfo_t &other) const { return as_tuple() > other.as_tuple(); }
|
||||
constexpr bool operator>(const maptexinfo_t &other) const { return as_tuple() > other.as_tuple(); }
|
||||
};
|
||||
|
||||
class mapentity_t;
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t
|
|||
for (auto &mapface : hullbrush->faces) {
|
||||
if (hullnum <= 0 && Brush_IsHint(*hullbrush)) {
|
||||
/* Don't generate hintskip faces */
|
||||
const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo);
|
||||
const maptexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo);
|
||||
|
||||
if (options.target_game->texinfo_is_hintskip(texinfo.flags, map.miptexTextureName(texinfo.miptex)))
|
||||
continue;
|
||||
|
|
@ -430,7 +430,7 @@ static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t
|
|||
|
||||
// account for texture offset, from txqbsp-xt
|
||||
if (!options.oldrottex.value()) {
|
||||
mtexinfo_t texInfoNew = map.mtexinfos.at(mapface.texinfo);
|
||||
maptexinfo_t texInfoNew = map.mtexinfos.at(mapface.texinfo);
|
||||
texInfoNew.outputnum = std::nullopt;
|
||||
|
||||
texInfoNew.vecs.at(0, 3) += qv::dot(rotate_offset, texInfoNew.vecs.row(0).xyz());
|
||||
|
|
@ -720,7 +720,7 @@ static contentflags_t Brush_GetContents(const mapbrush_t *mapbrush)
|
|||
// validate that all of the sides have valid contents
|
||||
for (int i = 0; i < mapbrush->numfaces; i++) {
|
||||
const mapface_t &mapface = mapbrush->face(i);
|
||||
const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo);
|
||||
const maptexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo);
|
||||
|
||||
contentflags_t contents =
|
||||
options.target_game->face_get_contents(mapface.texname.data(), texinfo.flags, mapface.contents);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static std::ofstream InitMtlFile(const std::string &filesuffix)
|
|||
|
||||
static void ExportObjFace(std::ofstream &f, const face_t *face, int *vertcount)
|
||||
{
|
||||
const mtexinfo_t &texinfo = map.mtexinfos.at(face->texinfo);
|
||||
const maptexinfo_t &texinfo = map.mtexinfos.at(face->texinfo);
|
||||
const char *texname = map.miptexTextureName(texinfo.miptex).c_str();
|
||||
|
||||
const texture_t *texture = WADList_GetTexture(texname);
|
||||
|
|
|
|||
26
qbsp/map.cc
26
qbsp/map.cc
|
|
@ -299,7 +299,7 @@ FindTexinfo
|
|||
Returns a global texinfo number
|
||||
===============
|
||||
*/
|
||||
int FindTexinfo(const mtexinfo_t &texinfo)
|
||||
int FindTexinfo(const maptexinfo_t &texinfo)
|
||||
{
|
||||
// NaN's will break mtexinfo_lookup, since they're being used as a std::map key and don't compare properly with <.
|
||||
// They should have been stripped out already in ValidateTextureProjection.
|
||||
|
|
@ -320,12 +320,12 @@ int FindTexinfo(const mtexinfo_t &texinfo)
|
|||
map.mtexinfos.emplace_back(texinfo);
|
||||
map.mtexinfo_lookup[texinfo] = num_texinfo;
|
||||
|
||||
// catch broken < implementations in mtexinfo_t
|
||||
// catch broken < implementations in maptexinfo_t
|
||||
assert(map.mtexinfo_lookup.find(texinfo) != map.mtexinfo_lookup.end());
|
||||
|
||||
// create a copy of the miptex for animation chains
|
||||
if (map.miptex[texinfo.miptex].animation_miptex != -1) {
|
||||
mtexinfo_t anim_next = texinfo;
|
||||
maptexinfo_t anim_next = texinfo;
|
||||
|
||||
anim_next.miptex = map.miptex[texinfo.miptex].animation_miptex;
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ int FindTexinfo(const mtexinfo_t &texinfo)
|
|||
return num_texinfo;
|
||||
}
|
||||
|
||||
static surfflags_t SurfFlagsForEntity(const mtexinfo_t &texinfo, const mapentity_t *entity)
|
||||
static surfflags_t SurfFlagsForEntity(const maptexinfo_t &texinfo, const mapentity_t *entity)
|
||||
{
|
||||
surfflags_t flags{};
|
||||
const char *texname = map.miptex.at(texinfo.miptex).name.c_str();
|
||||
|
|
@ -949,7 +949,7 @@ static void SetTexinfo_QuakeEd_New(
|
|||
}
|
||||
|
||||
static void SetTexinfo_QuakeEd(const qbsp_plane_t &plane, const std::array<qvec3d, 3> &planepts, const qvec2d &shift,
|
||||
const vec_t &rotate, const qvec2d &scale, mtexinfo_t *out)
|
||||
const vec_t &rotate, const qvec2d &scale, maptexinfo_t *out)
|
||||
{
|
||||
int i, j;
|
||||
qvec3d vecs[2];
|
||||
|
|
@ -1033,7 +1033,7 @@ static void SetTexinfo_QuakeEd(const qbsp_plane_t &plane, const std::array<qvec3
|
|||
}
|
||||
|
||||
static void SetTexinfo_QuArK(
|
||||
parser_t &parser, const std::array<qvec3d, 3> &planepts, texcoord_style_t style, mtexinfo_t *out)
|
||||
parser_t &parser, const std::array<qvec3d, 3> &planepts, texcoord_style_t style, maptexinfo_t *out)
|
||||
{
|
||||
int i;
|
||||
qvec3d vecs[2];
|
||||
|
|
@ -1095,7 +1095,7 @@ static void SetTexinfo_QuArK(
|
|||
out->vecs.at(1, 3) = -qv::dot(vecs[1], planepts[0]);
|
||||
}
|
||||
|
||||
static void SetTexinfo_Valve220(qmat<vec_t, 2, 3> &axis, const qvec2d &shift, const qvec2d &scale, mtexinfo_t *out)
|
||||
static void SetTexinfo_Valve220(qmat<vec_t, 2, 3> &axis, const qvec2d &shift, const qvec2d &scale, maptexinfo_t *out)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -1299,7 +1299,7 @@ parse_error:
|
|||
FError("line {}: couldn't parse Brush Primitives texture info", parser.linenum);
|
||||
}
|
||||
|
||||
static void ParseTextureDef(parser_t &parser, mapface_t &mapface, const mapbrush_t *brush, mtexinfo_t *tx,
|
||||
static void ParseTextureDef(parser_t &parser, mapface_t &mapface, const mapbrush_t *brush, maptexinfo_t *tx,
|
||||
std::array<qvec3d, 3> &planepts, const qbsp_plane_t &plane)
|
||||
{
|
||||
vec_t rotate;
|
||||
|
|
@ -1459,7 +1459,7 @@ const texvecf &mapface_t::get_texvecs() const
|
|||
void mapface_t::set_texvecs(const texvecf &vecs)
|
||||
{
|
||||
// start with a copy of the current texinfo structure
|
||||
mtexinfo_t texInfoNew = map.mtexinfos.at(this->texinfo);
|
||||
maptexinfo_t texInfoNew = map.mtexinfos.at(this->texinfo);
|
||||
texInfoNew.outputnum = std::nullopt;
|
||||
texInfoNew.vecs = vecs;
|
||||
this->texinfo = FindTexinfo(texInfoNew);
|
||||
|
|
@ -1484,12 +1484,12 @@ bool IsValidTextureProjection(const qvec3f &faceNormal, const qvec3f &s_vec, con
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool IsValidTextureProjection(const mapface_t &mapface, const mtexinfo_t *tx)
|
||||
inline bool IsValidTextureProjection(const mapface_t &mapface, const maptexinfo_t *tx)
|
||||
{
|
||||
return IsValidTextureProjection(mapface.plane.normal, tx->vecs.row(0).xyz(), tx->vecs.row(1).xyz());
|
||||
}
|
||||
|
||||
static void ValidateTextureProjection(mapface_t &mapface, mtexinfo_t *tx)
|
||||
static void ValidateTextureProjection(mapface_t &mapface, maptexinfo_t *tx)
|
||||
{
|
||||
if (!IsValidTextureProjection(mapface, tx)) {
|
||||
logging::print("WARNING: repairing invalid texture projection on line {} (\"{}\" near {} {} {})\n", mapface.linenum,
|
||||
|
|
@ -1509,7 +1509,7 @@ static std::unique_ptr<mapface_t> ParseBrushFace(parser_t &parser, const mapbrus
|
|||
{
|
||||
std::array<qvec3d, 3> planepts;
|
||||
bool normal_ok;
|
||||
mtexinfo_t tx;
|
||||
maptexinfo_t tx;
|
||||
int i, j;
|
||||
std::unique_ptr<mapface_t> face{new mapface_t};
|
||||
|
||||
|
|
@ -2009,7 +2009,7 @@ static void ConvertMapFace(std::ofstream &f, const mapface_t &mapface, const con
|
|||
EnsureTexturesLoaded();
|
||||
const texture_t *texture = WADList_GetTexture(mapface.texname.c_str());
|
||||
|
||||
const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo);
|
||||
const maptexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo);
|
||||
|
||||
// Write plane points
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
|
|
|||
|
|
@ -1284,7 +1284,7 @@ MakeSkipTexinfo
|
|||
*/
|
||||
static int MakeSkipTexinfo()
|
||||
{
|
||||
mtexinfo_t mt{};
|
||||
maptexinfo_t mt{};
|
||||
|
||||
mt.miptex = FindMiptex("skip", true);
|
||||
mt.flags.is_skip = true;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ std::list<face_t *> SubdivideFace(face_t *f)
|
|||
int axis;
|
||||
qbsp_plane_t plane;
|
||||
face_t *front, *back;
|
||||
const mtexinfo_t *tex;
|
||||
const maptexinfo_t *tex;
|
||||
vec_t subdiv;
|
||||
vec_t extent;
|
||||
int lmshift;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ size_t ExportMapPlane(size_t planenum)
|
|||
|
||||
size_t ExportMapTexinfo(size_t texinfonum)
|
||||
{
|
||||
mtexinfo_t &src = map.mtexinfos.at(texinfonum);
|
||||
maptexinfo_t &src = map.mtexinfos.at(texinfonum);
|
||||
|
||||
if (src.outputnum.has_value())
|
||||
return src.outputnum.value();
|
||||
|
|
@ -313,9 +313,9 @@ static void WriteExtendedTexinfoFlags(void)
|
|||
return;
|
||||
|
||||
// sort by output texinfo number
|
||||
std::vector<mtexinfo_t> texinfos_sorted(map.mtexinfos);
|
||||
std::vector<maptexinfo_t> texinfos_sorted(map.mtexinfos);
|
||||
std::sort(texinfos_sorted.begin(), texinfos_sorted.end(),
|
||||
[](const mtexinfo_t &a, const mtexinfo_t &b) { return a.outputnum < b.outputnum; });
|
||||
[](const maptexinfo_t &a, const maptexinfo_t &b) { return a.outputnum < b.outputnum; });
|
||||
|
||||
json texinfofile = json::object();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue