2022-08-19 04:20:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-16 19:23:35 +00:00
|
|
|
#include "camera.h"
|
2022-09-23 04:44:07 +00:00
|
|
|
#include "entt/entity/fwd.hpp"
|
2022-09-22 02:52:06 +00:00
|
|
|
#include "gfx/mesh.h"
|
2022-08-19 04:20:53 +00:00
|
|
|
#include "event/event.h"
|
|
|
|
#include "renderable.h"
|
2022-09-23 04:44:07 +00:00
|
|
|
#include "simpleengine/gfx/renderer.h"
|
2022-08-19 04:20:53 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <GLFW/glfw3.h>
|
2022-10-15 03:17:22 +00:00
|
|
|
#include <unordered_map>
|
2022-08-19 04:20:53 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2022-09-23 04:44:07 +00:00
|
|
|
#include <entt/entt.hpp>
|
|
|
|
|
2022-08-19 04:20:53 +00:00
|
|
|
namespace simpleengine {
|
2022-09-23 04:44:07 +00:00
|
|
|
namespace ecs {
|
|
|
|
class Entity;
|
|
|
|
}
|
|
|
|
|
2022-10-15 03:17:22 +00:00
|
|
|
//class Scene : public simpleengine::Event {
|
|
|
|
class Scene : public simpleengine::Renderable {
|
2022-09-23 04:44:07 +00:00
|
|
|
protected:
|
|
|
|
entt::registry registry;
|
|
|
|
std::shared_ptr<gfx::Renderer> renderer;
|
2022-10-15 03:17:22 +00:00
|
|
|
|
|
|
|
// Last transform matrixes for all entities.
|
|
|
|
std::unordered_map<uint32_t, glm::mat4> last_transforms;
|
2022-10-16 19:23:35 +00:00
|
|
|
|
|
|
|
std::shared_ptr<Camera> camera;
|
2022-08-19 04:20:53 +00:00
|
|
|
public:
|
2022-10-16 19:23:35 +00:00
|
|
|
Scene(std::shared_ptr<gfx::Renderer> renderer, std::shared_ptr<Camera> camera);
|
2022-09-23 04:44:07 +00:00
|
|
|
|
|
|
|
ecs::Entity create_entity();
|
|
|
|
|
|
|
|
virtual void update(const float& delta_time) override;
|
2022-10-16 19:23:35 +00:00
|
|
|
virtual void input_update(const float& delta_time) override;
|
2022-10-15 03:17:22 +00:00
|
|
|
virtual void render(const float& interpolate_alpha, const float& frame_time) override;
|
2022-10-13 03:18:47 +00:00
|
|
|
|
|
|
|
virtual void destroy() override;
|
2022-08-19 04:20:53 +00:00
|
|
|
};
|
|
|
|
}
|