consistency rename; gtexinfo_t -> mtexinfo_t

This commit is contained in:
Jonathan 2022-06-16 09:36:31 -04:00
parent 617cd3b089
commit 41ef66190f
13 changed files with 32 additions and 32 deletions

View File

@ -868,7 +868,7 @@ static compiled_brush_t DecompileLeafTask(
DefaultSkipSide(side, bsp); DefaultSkipSide(side, bsp);
} else { } else {
const char *name = nullptr; const char *name = nullptr;
const gtexinfo_t *ti; const mtexinfo_t *ti;
auto faces = finalSide.faces; auto faces = finalSide.faces;

View File

@ -73,7 +73,7 @@ const mface_t *BSP_GetFace(const mbsp_t *bsp, int fnum)
return &bsp->dfaces[fnum]; return &bsp->dfaces[fnum];
} }
const gtexinfo_t *BSP_GetTexinfo(const mbsp_t *bsp, int texinfo) const mtexinfo_t *BSP_GetTexinfo(const mbsp_t *bsp, int texinfo)
{ {
if (texinfo < 0) { if (texinfo < 0) {
return nullptr; return nullptr;
@ -81,7 +81,7 @@ const gtexinfo_t *BSP_GetTexinfo(const mbsp_t *bsp, int texinfo)
if (texinfo >= bsp->texinfo.size()) { if (texinfo >= bsp->texinfo.size()) {
return nullptr; return nullptr;
} }
const gtexinfo_t *tex = &bsp->texinfo[texinfo]; const mtexinfo_t *tex = &bsp->texinfo[texinfo];
return tex; return tex;
} }
@ -133,7 +133,7 @@ qplane3d Face_Plane(const mbsp_t *bsp, const mface_t *f)
return result; return result;
} }
const gtexinfo_t *Face_Texinfo(const mbsp_t *bsp, const mface_t *face) const mtexinfo_t *Face_Texinfo(const mbsp_t *bsp, const mface_t *face)
{ {
if (face->texinfo < 0 || face->texinfo >= bsp->texinfo.size()) if (face->texinfo < 0 || face->texinfo >= bsp->texinfo.size())
return nullptr; return nullptr;
@ -147,7 +147,7 @@ const miptex_t *Face_Miptex(const mbsp_t *bsp, const mface_t *face)
if (!bsp->dtex.textures.size()) if (!bsp->dtex.textures.size())
return nullptr; return nullptr;
const gtexinfo_t *texinfo = Face_Texinfo(bsp, face); const mtexinfo_t *texinfo = Face_Texinfo(bsp, face);
if (texinfo == nullptr) if (texinfo == nullptr)
return nullptr; return nullptr;
@ -163,7 +163,7 @@ const miptex_t *Face_Miptex(const mbsp_t *bsp, const mface_t *face)
const char *Face_TextureName(const mbsp_t *bsp, const mface_t *face) const char *Face_TextureName(const mbsp_t *bsp, const mface_t *face)
{ {
const gtexinfo_t *texinfo = Face_Texinfo(bsp, face); const mtexinfo_t *texinfo = Face_Texinfo(bsp, face);
if (!texinfo) { if (!texinfo) {
return ""; return "";
@ -225,7 +225,7 @@ int // mxd. Returns CONTENTS_ value for Q1, Q2_SURF_ bitflags for Q2...
Face_ContentsOrSurfaceFlags(const mbsp_t *bsp, const mface_t *face) Face_ContentsOrSurfaceFlags(const mbsp_t *bsp, const mface_t *face)
{ {
if (bsp->loadversion->game->id == GAME_QUAKE_II) { if (bsp->loadversion->game->id == GAME_QUAKE_II) {
const gtexinfo_t *info = Face_Texinfo(bsp, face); const mtexinfo_t *info = Face_Texinfo(bsp, face);
return info->flags.native; return info->flags.native;
} else { } else {
return TextureName_Contents(Face_TextureName(bsp, face)); return TextureName_Contents(Face_TextureName(bsp, face));
@ -522,7 +522,7 @@ qvec3f Face_Centroid(const mbsp_t *bsp, const mface_t *face)
void Face_DebugPrint(const mbsp_t *bsp, const mface_t *face) void Face_DebugPrint(const mbsp_t *bsp, const mface_t *face)
{ {
const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; const mtexinfo_t *tex = &bsp->texinfo[face->texinfo];
const char *texname = Face_TextureName(bsp, face); const char *texname = Face_TextureName(bsp, face);
logging::print("face {}, texture '{}', {} edges; vectors:\n" logging::print("face {}, texture '{}', {} edges; vectors:\n"

View File

@ -962,7 +962,7 @@ struct fmt::formatter<texvec<T>> : formatter<qmat<T, 2, 4>>
using texvecf = texvec<float>; using texvecf = texvec<float>;
struct gtexinfo_t struct mtexinfo_t
{ {
texvecf vecs; // [s/t][xyz offset] texvecf vecs; // [s/t][xyz offset]
surfflags_t flags; // native miptex flags + extended flags surfflags_t flags; // native miptex flags + extended flags
@ -985,10 +985,10 @@ struct texinfo_t
texinfo_t() = default; texinfo_t() = default;
// convert from mbsp_t // convert from mbsp_t
texinfo_t(const gtexinfo_t &model) : vecs(model.vecs), miptex(model.miptex), flags(model.flags.native) { } texinfo_t(const mtexinfo_t &model) : vecs(model.vecs), miptex(model.miptex), flags(model.flags.native) { }
// convert to mbsp_t // convert to mbsp_t
operator gtexinfo_t() const { return {vecs, {flags}, miptex}; } operator mtexinfo_t() const { return {vecs, {flags}, miptex}; }
// serialize for streams // serialize for streams
auto stream_data() { return std::tie(vecs, miptex, flags); } auto stream_data() { return std::tie(vecs, miptex, flags); }
@ -1005,14 +1005,14 @@ struct q2_texinfo_t
q2_texinfo_t() = default; q2_texinfo_t() = default;
// convert from mbsp_t // convert from mbsp_t
q2_texinfo_t(const gtexinfo_t &model) q2_texinfo_t(const mtexinfo_t &model)
: vecs(model.vecs), flags(model.flags.native), value(model.value), texture(model.texture), : vecs(model.vecs), flags(model.flags.native), value(model.value), texture(model.texture),
nexttexinfo(model.nexttexinfo) nexttexinfo(model.nexttexinfo)
{ {
} }
// convert to mbsp_t // convert to mbsp_t
operator gtexinfo_t() const { return {vecs, {flags}, -1, value, texture, nexttexinfo}; } operator mtexinfo_t() const { return {vecs, {flags}, -1, value, texture, nexttexinfo}; }
// serialize for streams // serialize for streams
auto stream_data() { return std::tie(vecs, flags, value, texture, nexttexinfo); } auto stream_data() { return std::tie(vecs, flags, value, texture, nexttexinfo); }
@ -1660,7 +1660,7 @@ struct mbsp_t
std::vector<dplane_t> dplanes; std::vector<dplane_t> dplanes;
std::vector<qvec3f> dvertexes; std::vector<qvec3f> dvertexes;
std::vector<bsp2_dnode_t> dnodes; std::vector<bsp2_dnode_t> dnodes;
std::vector<gtexinfo_t> texinfo; std::vector<mtexinfo_t> texinfo;
std::vector<mface_t> dfaces; std::vector<mface_t> dfaces;
std::vector<bsp2_dclipnode_t> dclipnodes; std::vector<bsp2_dclipnode_t> dclipnodes;
std::vector<bsp2_dedge_t> dedges; std::vector<bsp2_dedge_t> dedges;

View File

@ -35,13 +35,13 @@ const mleaf_t *BSP_GetLeaf(const mbsp_t *bsp, int leafnum);
const mleaf_t *BSP_GetLeafFromNodeNum(const mbsp_t *bsp, int nodenum); const mleaf_t *BSP_GetLeafFromNodeNum(const mbsp_t *bsp, int nodenum);
const dplane_t *BSP_GetPlane(const mbsp_t *bsp, int planenum); const dplane_t *BSP_GetPlane(const mbsp_t *bsp, int planenum);
const mface_t *BSP_GetFace(const mbsp_t *bsp, int fnum); const mface_t *BSP_GetFace(const mbsp_t *bsp, int fnum);
const gtexinfo_t *BSP_GetTexinfo(const mbsp_t *bsp, int texinfo); const mtexinfo_t *BSP_GetTexinfo(const mbsp_t *bsp, int texinfo);
mface_t *BSP_GetFace(mbsp_t *bsp, int fnum); mface_t *BSP_GetFace(mbsp_t *bsp, int fnum);
int Face_VertexAtIndex(const mbsp_t *bsp, const mface_t *f, int v); int Face_VertexAtIndex(const mbsp_t *bsp, const mface_t *f, int v);
const qvec3f &Face_PointAtIndex(const mbsp_t *bsp, const mface_t *f, int v); const qvec3f &Face_PointAtIndex(const mbsp_t *bsp, const mface_t *f, int v);
qplane3d Face_Plane(const mbsp_t *bsp, const mface_t *f); qplane3d Face_Plane(const mbsp_t *bsp, const mface_t *f);
const gtexinfo_t *Face_Texinfo(const mbsp_t *bsp, const mface_t *face); const mtexinfo_t *Face_Texinfo(const mbsp_t *bsp, const mface_t *face);
const miptex_t *Face_Miptex(const mbsp_t *bsp, const mface_t *face); const miptex_t *Face_Miptex(const mbsp_t *bsp, const mface_t *face);
const char *Face_TextureName(const mbsp_t *bsp, const mface_t *face); const char *Face_TextureName(const mbsp_t *bsp, const mface_t *face);
const qvec3f &GetSurfaceVertexPoint(const mbsp_t *bsp, const mface_t *f, int v); const qvec3f &GetSurfaceVertexPoint(const mbsp_t *bsp, const mface_t *f, int v);

View File

@ -85,7 +85,7 @@ constexpr size_t MAXDIMENSION = 255 + 1;
struct texorg_t struct texorg_t
{ {
qmat4x4f texSpaceToWorld; qmat4x4f texSpaceToWorld;
const gtexinfo_t *texinfo; const mtexinfo_t *texinfo;
vec_t planedist; vec_t planedist;
}; };

View File

@ -72,7 +72,7 @@ public:
qmat4x4f WorldToTexSpace(const mbsp_t *bsp, const mface_t *f); qmat4x4f WorldToTexSpace(const mbsp_t *bsp, const mface_t *f);
qmat4x4f TexSpaceToWorld(const mbsp_t *bsp, const mface_t *f); qmat4x4f TexSpaceToWorld(const mbsp_t *bsp, const mface_t *f);
qvec2d WorldToTexCoord(const qvec3d &world, const gtexinfo_t *tex); qvec2d WorldToTexCoord(const qvec3d &world, const mtexinfo_t *tex);
void PrintFaceInfo(const mface_t *face, const mbsp_t *bsp); void PrintFaceInfo(const mface_t *face, const mbsp_t *bsp);
// FIXME: remove light param. add normal param and dir params. // FIXME: remove light param. add normal param and dir params.
vec_t GetLightValue(const settings::worldspawn_keys &cfg, const light_t *entity, vec_t dist); vec_t GetLightValue(const settings::worldspawn_keys &cfg, const light_t *entity, vec_t dist);

View File

@ -43,7 +43,7 @@ std::atomic<uint32_t> fully_transparent_lightmaps;
/* ======================================================================== */ /* ======================================================================== */
qvec2d WorldToTexCoord(const qvec3d &world, const gtexinfo_t *tex) qvec2d WorldToTexCoord(const qvec3d &world, const mtexinfo_t *tex)
{ {
/* /*
* The (long double) casts below are important: The original code * The (long double) casts below are important: The original code
@ -65,7 +65,7 @@ qvec2d WorldToTexCoord(const qvec3d &world, const gtexinfo_t *tex)
static qvec2f Face_WorldToTexCoord(const mbsp_t *bsp, const mface_t *face, const qvec3f &world) static qvec2f Face_WorldToTexCoord(const mbsp_t *bsp, const mface_t *face, const qvec3f &world)
{ {
const gtexinfo_t *tex = Face_Texinfo(bsp, face); const mtexinfo_t *tex = Face_Texinfo(bsp, face);
if (tex == nullptr) if (tex == nullptr)
return {}; return {};
@ -198,7 +198,7 @@ qvec3f faceextents_t::LMCoordToWorld(qvec2f lm) const
qmat4x4f WorldToTexSpace(const mbsp_t *bsp, const mface_t *f) qmat4x4f WorldToTexSpace(const mbsp_t *bsp, const mface_t *f)
{ {
const gtexinfo_t *tex = Face_Texinfo(bsp, f); const mtexinfo_t *tex = Face_Texinfo(bsp, f);
if (tex == nullptr) { if (tex == nullptr) {
Q_assert_unreachable(); Q_assert_unreachable();
return qmat4x4f(); return qmat4x4f();
@ -227,7 +227,7 @@ constexpr qvec3d TexCoordToWorld(vec_t s, vec_t t, const texorg_t *texorg)
/* Debug helper - move elsewhere? */ /* Debug helper - move elsewhere? */
void PrintFaceInfo(const mface_t *face, const mbsp_t *bsp) void PrintFaceInfo(const mface_t *face, const mbsp_t *bsp)
{ {
const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; const mtexinfo_t *tex = &bsp->texinfo[face->texinfo];
const char *texname = Face_TextureName(bsp, face); const char *texname = Face_TextureName(bsp, face);
logging::print("face {}, texture {}, {} edges; vectors:\n" logging::print("face {}, texture {}, {} edges; vectors:\n"
@ -260,7 +260,7 @@ static void CalcFaceExtents(const mface_t *face, const mbsp_t *bsp, lightsurf_t
maxs[0] = maxs[1] = -VECT_MAX; maxs[0] = maxs[1] = -VECT_MAX;
worldmaxs[0] = worldmaxs[1] = worldmaxs[2] = -VECT_MAX; worldmaxs[0] = worldmaxs[1] = worldmaxs[2] = -VECT_MAX;
worldmins[0] = worldmins[1] = worldmins[2] = VECT_MAX; worldmins[0] = worldmins[1] = worldmins[2] = VECT_MAX;
const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; const mtexinfo_t *tex = &bsp->texinfo[face->texinfo];
for (int i = 0; i < face->numedges; i++) { for (int i = 0; i < face->numedges; i++) {
const int edge = bsp->dsurfedges[face->firstedge + i]; const int edge = bsp->dsurfedges[face->firstedge + i];
@ -772,7 +772,7 @@ static bool Lightsurf_Init(
return false; return false;
} }
const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; const mtexinfo_t *tex = &bsp->texinfo[face->texinfo];
lightsurf->snormal = qv::normalize(tex->vecs.row(0).xyz()); lightsurf->snormal = qv::normalize(tex->vecs.row(0).xyz());
lightsurf->tnormal = -qv::normalize(tex->vecs.row(1).xyz()); lightsurf->tnormal = -qv::normalize(tex->vecs.row(1).xyz());
@ -2876,7 +2876,7 @@ static std::vector<qvec4f> BoxBlurImage(const std::vector<qvec4f> &input, int w,
bool Face_IsLightmapped(const mbsp_t *bsp, const mface_t *face) bool Face_IsLightmapped(const mbsp_t *bsp, const mface_t *face)
{ {
const gtexinfo_t *texinfo = Face_Texinfo(bsp, face); const mtexinfo_t *texinfo = Face_Texinfo(bsp, face);
if (texinfo == nullptr) if (texinfo == nullptr)
return false; return false;
@ -3242,7 +3242,7 @@ void LightFace(const mbsp_t *bsp, mface_t *face, facesup_t *facesup, const setti
} }
/* minlight - Use Q2 surface light, or the greater of global or model minlight. */ /* minlight - Use Q2 surface light, or the greater of global or model minlight. */
const gtexinfo_t *texinfo = Face_Texinfo(bsp, face); // mxd. Surface lights... const mtexinfo_t *texinfo = Face_Texinfo(bsp, face); // mxd. Surface lights...
if (texinfo != nullptr && texinfo->value > 0 && (texinfo->flags.native & Q2_SURF_LIGHT)) { if (texinfo != nullptr && texinfo->value > 0 && (texinfo->flags.native & Q2_SURF_LIGHT)) {
LightFace_Min(bsp, face, Face_LookupTextureColor(bsp, face), texinfo->value * 2.0f, lightsurf, LightFace_Min(bsp, face, Face_LookupTextureColor(bsp, face), texinfo->value * 2.0f, lightsurf,
lightmaps); // Playing by the eye here... 2.0 == 256 / 128; 128 is the light value, at which the surface lightmaps); // Playing by the eye here... 2.0 == 256 / 128; 128 is the light value, at which the surface

View File

@ -391,7 +391,7 @@ static vector<face_cache_t> MakeFaceCache(const mbsp_t *bsp)
*/ */
static int Q2_FacePhongValue(const mbsp_t *bsp, const mface_t *face) static int Q2_FacePhongValue(const mbsp_t *bsp, const mface_t *face)
{ {
const gtexinfo_t *texinfo = BSP_GetTexinfo(bsp, face->texinfo); const mtexinfo_t *texinfo = BSP_GetTexinfo(bsp, face->texinfo);
if (texinfo != nullptr) { if (texinfo != nullptr) {
if (texinfo->value != 0 && ((texinfo->flags.native & Q2_SURF_LIGHT) == 0)) { if (texinfo->value != 0 && ((texinfo->flags.native & Q2_SURF_LIGHT) == 0)) {
return texinfo->value; return texinfo->value;

View File

@ -51,7 +51,7 @@ static void MakeSurfaceLightsThread(const mbsp_t *bsp, const settings::worldspaw
const mface_t *face = BSP_GetFace(bsp, i); const mface_t *face = BSP_GetFace(bsp, i);
// Face casts light? // Face casts light?
const gtexinfo_t *info = Face_Texinfo(bsp, face); const mtexinfo_t *info = Face_Texinfo(bsp, face);
if (info == nullptr) if (info == nullptr)
return; return;
if (!(info->flags.native & Q2_SURF_LIGHT) || info->value == 0) { if (!(info->flags.native & Q2_SURF_LIGHT) || info->value == 0) {

View File

@ -55,7 +55,7 @@ qvec4b SampleTexture(const mface_t *face, const mbsp_t *bsp, const qvec3d &point
return {}; return {};
} }
const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; const mtexinfo_t *tex = &bsp->texinfo[face->texinfo];
qvec2d texcoord = WorldToTexCoord(point, tex); qvec2d texcoord = WorldToTexCoord(point, tex);

View File

@ -520,7 +520,7 @@ void Embree_TraceInit(const mbsp_t *bsp)
} }
const int contents_or_surf_flags = Face_ContentsOrSurfaceFlags(bsp, face); // mxd const int contents_or_surf_flags = Face_ContentsOrSurfaceFlags(bsp, face); // mxd
const gtexinfo_t *texinfo = Face_Texinfo(bsp, face); const mtexinfo_t *texinfo = Face_Texinfo(bsp, face);
const bool is_q2 = bsp->loadversion->game->id == GAME_QUAKE_II; const bool is_q2 = bsp->loadversion->game->id == GAME_QUAKE_II;
// mxd. Skip NODRAW faces, but not SKY ones (Q2's sky01.wal has both flags set) // mxd. Skip NODRAW faces, but not SKY ones (Q2's sky01.wal has both flags set)

View File

@ -66,7 +66,7 @@ size_t ExportMapTexinfo(size_t texinfonum)
// this will be the index of the exported texinfo in the BSP lump // this will be the index of the exported texinfo in the BSP lump
const size_t i = map.bsp.texinfo.size(); const size_t i = map.bsp.texinfo.size();
gtexinfo_t &dest = map.bsp.texinfo.emplace_back(); mtexinfo_t &dest = map.bsp.texinfo.emplace_back();
// make sure we don't write any non-native flags. // make sure we don't write any non-native flags.
// e.g. Quake only accepts 0 or TEX_SPECIAL. // e.g. Quake only accepts 0 or TEX_SPECIAL.

View File

@ -60,7 +60,7 @@ static aabb3d SurfaceBBox(const mbsp_t *bsp, const mface_t *surf)
void CalcAmbientSounds(mbsp_t *bsp) void CalcAmbientSounds(mbsp_t *bsp)
{ {
const mface_t *surf; const mface_t *surf;
const gtexinfo_t *info; const mtexinfo_t *info;
int i, j, k, l; int i, j, k, l;
mleaf_t *leaf, *hit; mleaf_t *leaf, *hit;
uint8_t *vis; uint8_t *vis;