#pragma once #include #include #include "skeleton.hpp" #include "utils/defs.hpp" #include "utils/aabb.hpp" #include "collision/trianglemesh.hpp" #ifdef CLIENT #include "mesh_builder.hpp" #endif namespace assets { // enum ModelCollisionShapeType // { // MCS_NONE, // MCS_BOX, // MCS_SPHERE, // }; // struct ModelCollisionShape // { // ModelCollisionShapeType type = MCS_NONE; // glm::vec3 origin = glm::vec3(0.0f); // union // { // float radius; // glm::vec3 half_extents; // }; // }; class Model { public: Model() = default; static std::shared_ptr LoadFromFile(const std::string& filename); const std::string& GetName() const { return name_; } const glm::vec3& GetColOffset() const { return col_offset_; } const collision::TriangleMesh* GetColMesh() const { return cmesh_.get(); } btCollisionShape* GetColShape() const { return cshape_.get(); } const std::shared_ptr& GetSkeleton() const { return skeleton_; } CLIENT_ONLY(const std::shared_ptr& GetMesh() const { return mesh_; }) const AABB3& GetAABB() const { return aabb_; } const std::string* GetParam(const std::string& key) const; bool GetParamFloat(const std::string& key, float& out) const; private: std::string name_; glm::vec3 col_offset_ = glm::vec3(0.0f); std::unique_ptr cmesh_; // std::vector cshapes_; std::vector> subshapes_; std::unique_ptr cshape_; std::shared_ptr skeleton_; CLIENT_ONLY(std::shared_ptr mesh_;); AABB3 aabb_; std::map params_; }; }