// // Created by Иван Ильин on 13.01.2021. // #ifndef ENGINE_WORLD_H #define ENGINE_WORLD_H #include #include "Camera.h" #include "io/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; void checkCollision(const ObjectNameTag &tag); public: World() = default; void update(); std::shared_ptr addBody(std::shared_ptr mesh); std::shared_ptr body(const ObjectNameTag &tag); void removeBody(const ObjectNameTag &tag); std::shared_ptr loadBody(const ObjectNameTag &tag, const std::string &filename, const Vec3D &scale = Vec3D{1, 1, 1}); void loadMap(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 = ""); std::map>::iterator begin() { return _objects.begin(); } std::map>::iterator end() { return _objects.end(); } }; #endif //INC_3DZAVR_WORLD_H