diff --git a/bsputil/decompile.cpp b/bsputil/decompile.cpp index 19aaa642..1de95ea3 100644 --- a/bsputil/decompile.cpp +++ b/bsputil/decompile.cpp @@ -868,7 +868,7 @@ static compiled_brush_t DecompileLeafTask( DefaultSkipSide(side, bsp); } else { const char *name = nullptr; - const gtexinfo_t *ti; + const mtexinfo_t *ti; auto faces = finalSide.faces; diff --git a/common/bsputils.cc b/common/bsputils.cc index bf85663f..2039c399 100644 --- a/common/bsputils.cc +++ b/common/bsputils.cc @@ -73,7 +73,7 @@ const mface_t *BSP_GetFace(const mbsp_t *bsp, int 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) { return nullptr; @@ -81,7 +81,7 @@ const gtexinfo_t *BSP_GetTexinfo(const mbsp_t *bsp, int texinfo) if (texinfo >= bsp->texinfo.size()) { return nullptr; } - const gtexinfo_t *tex = &bsp->texinfo[texinfo]; + const mtexinfo_t *tex = &bsp->texinfo[texinfo]; return tex; } @@ -133,7 +133,7 @@ qplane3d Face_Plane(const mbsp_t *bsp, const mface_t *f) 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()) return nullptr; @@ -147,7 +147,7 @@ const miptex_t *Face_Miptex(const mbsp_t *bsp, const mface_t *face) if (!bsp->dtex.textures.size()) return nullptr; - const gtexinfo_t *texinfo = Face_Texinfo(bsp, face); + const mtexinfo_t *texinfo = Face_Texinfo(bsp, face); if (texinfo == 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 gtexinfo_t *texinfo = Face_Texinfo(bsp, face); + const mtexinfo_t *texinfo = Face_Texinfo(bsp, face); if (!texinfo) { 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) { 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; } else { 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) { - const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; + const mtexinfo_t *tex = &bsp->texinfo[face->texinfo]; const char *texname = Face_TextureName(bsp, face); logging::print("face {}, texture '{}', {} edges; vectors:\n" diff --git a/include/common/bspfile.hh b/include/common/bspfile.hh index 79166b60..19806616 100644 --- a/include/common/bspfile.hh +++ b/include/common/bspfile.hh @@ -962,7 +962,7 @@ struct fmt::formatter> : formatter> using texvecf = texvec; -struct gtexinfo_t +struct mtexinfo_t { texvecf vecs; // [s/t][xyz offset] surfflags_t flags; // native miptex flags + extended flags @@ -985,10 +985,10 @@ struct texinfo_t texinfo_t() = default; // 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 - operator gtexinfo_t() const { return {vecs, {flags}, miptex}; } + operator mtexinfo_t() const { return {vecs, {flags}, miptex}; } // serialize for streams auto stream_data() { return std::tie(vecs, miptex, flags); } @@ -1005,14 +1005,14 @@ struct q2_texinfo_t q2_texinfo_t() = default; // 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), nexttexinfo(model.nexttexinfo) { } // 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 auto stream_data() { return std::tie(vecs, flags, value, texture, nexttexinfo); } @@ -1660,7 +1660,7 @@ struct mbsp_t std::vector dplanes; std::vector dvertexes; std::vector dnodes; - std::vector texinfo; + std::vector texinfo; std::vector dfaces; std::vector dclipnodes; std::vector dedges; diff --git a/include/common/bsputils.hh b/include/common/bsputils.hh index 45c10239..d86039af 100644 --- a/include/common/bsputils.hh +++ b/include/common/bsputils.hh @@ -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 dplane_t *BSP_GetPlane(const mbsp_t *bsp, int planenum); 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); 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); 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 char *Face_TextureName(const mbsp_t *bsp, const mface_t *face); const qvec3f &GetSurfaceVertexPoint(const mbsp_t *bsp, const mface_t *f, int v); diff --git a/include/light/light.hh b/include/light/light.hh index abe4f7e5..34ea56ee 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -85,7 +85,7 @@ constexpr size_t MAXDIMENSION = 255 + 1; struct texorg_t { qmat4x4f texSpaceToWorld; - const gtexinfo_t *texinfo; + const mtexinfo_t *texinfo; vec_t planedist; }; diff --git a/include/light/ltface.hh b/include/light/ltface.hh index 75d4ff75..6faa2d45 100644 --- a/include/light/ltface.hh +++ b/include/light/ltface.hh @@ -72,7 +72,7 @@ public: qmat4x4f WorldToTexSpace(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); // 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); diff --git a/light/ltface.cc b/light/ltface.cc index 005446e0..1d1d2c7e 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -43,7 +43,7 @@ std::atomic 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 @@ -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) { - const gtexinfo_t *tex = Face_Texinfo(bsp, face); + const mtexinfo_t *tex = Face_Texinfo(bsp, face); if (tex == nullptr) return {}; @@ -198,7 +198,7 @@ qvec3f faceextents_t::LMCoordToWorld(qvec2f lm) const 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) { Q_assert_unreachable(); return qmat4x4f(); @@ -227,7 +227,7 @@ constexpr qvec3d TexCoordToWorld(vec_t s, vec_t t, const texorg_t *texorg) /* Debug helper - move elsewhere? */ 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); 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; worldmaxs[0] = worldmaxs[1] = worldmaxs[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++) { const int edge = bsp->dsurfedges[face->firstedge + i]; @@ -772,7 +772,7 @@ static bool Lightsurf_Init( 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->tnormal = -qv::normalize(tex->vecs.row(1).xyz()); @@ -2876,7 +2876,7 @@ static std::vector BoxBlurImage(const std::vector &input, int w, 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) 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. */ - 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)) { 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 diff --git a/light/phong.cc b/light/phong.cc index caf83c66..7d80f840 100644 --- a/light/phong.cc +++ b/light/phong.cc @@ -391,7 +391,7 @@ static vector MakeFaceCache(const mbsp_t *bsp) */ 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->value != 0 && ((texinfo->flags.native & Q2_SURF_LIGHT) == 0)) { return texinfo->value; diff --git a/light/surflight.cc b/light/surflight.cc index db05c2ef..127eb717 100644 --- a/light/surflight.cc +++ b/light/surflight.cc @@ -51,7 +51,7 @@ static void MakeSurfaceLightsThread(const mbsp_t *bsp, const settings::worldspaw const mface_t *face = BSP_GetFace(bsp, i); // Face casts light? - const gtexinfo_t *info = Face_Texinfo(bsp, face); + const mtexinfo_t *info = Face_Texinfo(bsp, face); if (info == nullptr) return; if (!(info->flags.native & Q2_SURF_LIGHT) || info->value == 0) { diff --git a/light/trace.cc b/light/trace.cc index 99b0f297..4b00dfde 100644 --- a/light/trace.cc +++ b/light/trace.cc @@ -55,7 +55,7 @@ qvec4b SampleTexture(const mface_t *face, const mbsp_t *bsp, const qvec3d &point return {}; } - const gtexinfo_t *tex = &bsp->texinfo[face->texinfo]; + const mtexinfo_t *tex = &bsp->texinfo[face->texinfo]; qvec2d texcoord = WorldToTexCoord(point, tex); diff --git a/light/trace_embree.cc b/light/trace_embree.cc index ce50fd47..c88d87fb 100644 --- a/light/trace_embree.cc +++ b/light/trace_embree.cc @@ -520,7 +520,7 @@ void Embree_TraceInit(const mbsp_t *bsp) } 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; // mxd. Skip NODRAW faces, but not SKY ones (Q2's sky01.wal has both flags set) diff --git a/qbsp/writebsp.cc b/qbsp/writebsp.cc index 7833c712..f32ff3d1 100644 --- a/qbsp/writebsp.cc +++ b/qbsp/writebsp.cc @@ -66,7 +66,7 @@ size_t ExportMapTexinfo(size_t texinfonum) // this will be the index of the exported texinfo in the BSP lump 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. // e.g. Quake only accepts 0 or TEX_SPECIAL. diff --git a/vis/soundpvs.cc b/vis/soundpvs.cc index f12604eb..327a9b4b 100644 --- a/vis/soundpvs.cc +++ b/vis/soundpvs.cc @@ -60,7 +60,7 @@ static aabb3d SurfaceBBox(const mbsp_t *bsp, const mface_t *surf) void CalcAmbientSounds(mbsp_t *bsp) { const mface_t *surf; - const gtexinfo_t *info; + const mtexinfo_t *info; int i, j, k, l; mleaf_t *leaf, *hit; uint8_t *vis;