// // Created by Иван Ильин on 13.01.2021. // #ifndef ENGINE_WORLD_H #define ENGINE_WORLD_H #include #include "Camera.h" #include "Screen.h" #include "physics/RigidBody.h" struct IntersectionInformation final { const Vec3D pointOfIntersection; const double distanceToObject; const Triangle intersectedTriangle; const ObjectNameTag objectName; const std::shared_ptr obj; const bool intersected; }; class World final { private: std::map> _objects; public: World() = default; void checkCollision(const ObjectNameTag &tag); void update(); void addBody(std::shared_ptr mesh); std::shared_ptr body(const ObjectNameTag &tag); void removeBody(const ObjectNameTag &tag); void loadBody(const ObjectNameTag &tag, const std::string &filename, const Vec3D &scale = Vec3D{1, 1, 1}); // std::string skipTags is a string that consist of all objects we want to skip in ray casting IntersectionInformation rayCast(const Vec3D &from, const Vec3D &to, const std::string &skipTags = ""); void loadMap(const std::string &filename, const Vec3D &scale = Vec3D{1, 1, 1}); std::map>::iterator begin() { return _objects.begin(); } std::map>::iterator end() { return _objects.end(); } }; #endif //INC_3DZAVR_WORLD_H