build perf: de-templateize texvec<T>, we only need texvecf
This commit is contained in:
parent
26dedb603f
commit
36e157254c
|
|
@ -2429,6 +2429,22 @@ inline void ReadQ2BSP(lump_reader &reader, T &bsp)
|
||||||
reader.read(Q2_LUMP_AREAPORTALS, bsp.dareaportals);
|
reader.read(Q2_LUMP_AREAPORTALS, bsp.dareaportals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void texvecf::stream_read(std::istream &stream)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 2; i++)
|
||||||
|
for (size_t x = 0; x < 4; x++) {
|
||||||
|
stream >= this->at(i, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void texvecf::stream_write(std::ostream &stream) const
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 2; i++)
|
||||||
|
for (size_t x = 0; x < 4; x++) {
|
||||||
|
stream <= this->at(i, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void bspdata_t::bspxentries::transfer(const char *xname, std::vector<uint8_t> &xdata)
|
void bspdata_t::bspxentries::transfer(const char *xname, std::vector<uint8_t> &xdata)
|
||||||
{
|
{
|
||||||
entries.insert_or_assign(xname, std::move(xdata));
|
entries.insert_or_assign(xname, std::move(xdata));
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,7 @@ struct texdef_valve_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: merge with map.cc copy
|
// FIXME: merge with map.cc copy
|
||||||
template<typename T>
|
inline texdef_valve_t(const texvecf &in_vecs)
|
||||||
inline texdef_valve_t(const texvec<T> &in_vecs)
|
|
||||||
{
|
{
|
||||||
// From the valve -> bsp code,
|
// From the valve -> bsp code,
|
||||||
// out->vecs[n].xyz = axis[n].xyz / scale[n];
|
// out->vecs[n].xyz = axis[n].xyz / scale[n];
|
||||||
|
|
|
||||||
|
|
@ -371,10 +371,9 @@ struct fmt::formatter<bspversion_t>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
struct texvecf : qmat<float, 2, 4>
|
||||||
struct texvec : qmat<T, 2, 4>
|
|
||||||
{
|
{
|
||||||
using qmat<T, 2, 4>::qmat;
|
using qmat<float, 2, 4>::qmat;
|
||||||
|
|
||||||
template<typename T2>
|
template<typename T2>
|
||||||
constexpr qvec<T2, 2> uvs(const qvec<T2, 3> &pos) const
|
constexpr qvec<T2, 2> uvs(const qvec<T2, 3> &pos) const
|
||||||
|
|
@ -392,31 +391,16 @@ struct texvec : qmat<T, 2, 4>
|
||||||
// Not blit compatible because qmat is column-major but
|
// Not blit compatible because qmat is column-major but
|
||||||
// texvecs are row-major
|
// texvecs are row-major
|
||||||
|
|
||||||
void stream_read(std::istream &stream)
|
void stream_read(std::istream &stream);
|
||||||
{
|
void stream_write(std::ostream &stream) const;
|
||||||
for (size_t i = 0; i < 2; i++)
|
|
||||||
for (size_t x = 0; x < 4; x++) {
|
|
||||||
stream >= this->at(i, x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void stream_write(std::ostream &stream) const
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < 2; i++)
|
|
||||||
for (size_t x = 0; x < 4; x++) {
|
|
||||||
stream <= this->at(i, x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fmt support
|
// Fmt support
|
||||||
template<class T>
|
template<>
|
||||||
struct fmt::formatter<texvec<T>> : fmt::formatter<qmat<T, 2, 4>>
|
struct fmt::formatter<texvecf> : fmt::formatter<qmat<float, 2, 4>>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
using texvecf = texvec<float>;
|
|
||||||
|
|
||||||
// type to store a hull index; max 256 hulls, zero is valid.
|
// type to store a hull index; max 256 hulls, zero is valid.
|
||||||
using hull_index_t = std::optional<uint8_t>;
|
using hull_index_t = std::optional<uint8_t>;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue