Redesign of animation queue for unreal, add get_tangibles_near to drivenengine

This commit is contained in:
2023-07-24 17:19:25 -04:00
parent 4da86e6f89
commit 87aa47b96d
19 changed files with 1406 additions and 980 deletions

View File

@@ -211,13 +211,18 @@ enum MessageType {
MSG_INVOKE,
};
// Note: IdVector is weird in that it deliberately uses std::vector
// instead of eng::vector. This is because we want plane scans
// to not touch the engine heap.
//
using IdVector = std::vector<int64_t>;
using StringVec = eng::vector<eng::string>;
using StringPair = std::pair<eng::string, eng::string>;
using StringSet = eng::set<eng::string>;
using LuaSourceVec = eng::vector<StringPair>;
using LuaSourcePtr = std::unique_ptr<LuaSourceVec>;
using HashValue = std::pair<uint64_t, uint64_t>;
using IdVector = eng::vector<int64_t>;
// Ascii uppercase and lowercase.
eng::string ascii_tolower(std::string_view c);
@@ -241,6 +246,7 @@ IdVector id_vector_create(int64_t id1=-1, int64_t id2=-1, int64_t id3=-1, int64_
// Print an ID vector to a stream.
void print_id_vector(const IdVector &idv, std::ostream *os);
void print_id_vector(const std::vector<uint64_t> &idv, std::ostream *os);
// ID vector debug string.
eng::string id_vector_debug_string(const IdVector &idv);
@@ -249,7 +255,10 @@ eng::string id_vector_debug_string(const IdVector &idv);
IdVector sort_union_id_vectors(const IdVector &v1, const IdVector &v2);
// Get a 128-bit hashvalue for a string.
HashValue hash_string(const eng::string &str);
HashValue hash_string(std::string_view str);
// Get a 128-bit hashvalue for a string, with a previous value.
HashValue hash_string(HashValue prev, std::string_view str);
// Get a 128-bit hashvalue for an ID vector.
HashValue hash_id_vector(const IdVector &idv);
@@ -322,18 +331,32 @@ void remove_marked_items(T &vec) {
}
// An XYZ coordinate, general purpose.
struct XYZ {
float x, y, z;
XYZ() { x=0; y=0; z=0; }
XYZ(float ix, float iy, float iz) { x=ix; y=iy; z=iz; }
bool operator ==(const XYZ &o) const { return x==o.x && y == o.y && z==o.z; }
bool operator !=(const XYZ &o) const { return x!=o.x || y != o.y || z!=o.z; }
XYZ operator -(const XYZ &o) const { return XYZ(x-o.x, y-o.y, z-o.z); }
XYZ operator +(const XYZ &o) const { return XYZ(x+o.x, y+o.y, z+o.z); }
XYZ operator *(float scale) const { return XYZ(x*scale, y*scale, z*scale); }
eng::string debug_string() const;
template <typename NUMBER>
struct NumXYZ {
using Number = NUMBER;
Number x, y, z;
NumXYZ() { x=0; y=0; z=0; }
NumXYZ(Number ix, Number iy, Number iz) { x=ix; y=iy; z=iz; }
void operator =(const NumXYZ &other) { x = other.x; y = other.y; z = other.z; }
void operator =(Number n) { x = n; y = n; z = n; }
bool operator ==(const NumXYZ &o) const { return x==o.x && y == o.y && z==o.z; }
bool operator !=(const NumXYZ &o) const { return x!=o.x || y != o.y || z!=o.z; }
NumXYZ operator -(const NumXYZ &o) const { return NumXYZ(x-o.x, y-o.y, z-o.z); }
NumXYZ operator +(const NumXYZ &o) const { return NumXYZ(x+o.x, y+o.y, z+o.z); }
NumXYZ operator *(float scale) const { return NumXYZ(x*scale, y*scale, z*scale); }
template<typename ONUMBER>
const NumXYZ<ONUMBER> convert() const { NumXYZ<ONUMBER> r; r.x=ONUMBER(x); r.y=ONUMBER(y); r.z=ONUMBER(z); return r; }
eng::string debug_string() const {
eng::ostringstream oss;
oss << "(" << x << "," << y << "," << z << ")";
return oss.str();
}
};
using XYZ=NumXYZ<float>;
using DXYZ=NumXYZ<double>;
// util::ostringstream
//
// This is a variant of ostringstream in which it is possible
@@ -455,4 +478,9 @@ inline std::ostream &operator<<(std::ostream &oss, const util::XYZ &xyz) {
return oss;
}
inline std::ostream &operator<<(std::ostream &oss, const util::DXYZ &xyz) {
oss << xyz.x << "," << xyz.y << "," << xyz.z;
return oss;
}
#endif // UTIL_HPP