60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "vulkan_engine/asset/loader.h"
|
|
#include "graphics.h"
|
|
#include "physics.h"
|
|
#include "utils/thread_pool.h"
|
|
#include "socket/iocp.h"
|
|
|
|
namespace veng {
|
|
|
|
class Engine {
|
|
public:
|
|
Engine(gsl::not_null<Graphics*> vulkan_graphics,
|
|
utils::ThreadPool* thread_pool, Network::IOCP* iocp)
|
|
: vulkan_graphics(vulkan_graphics), thread_pool_(thread_pool), iocp_(iocp) {}
|
|
|
|
void init();
|
|
|
|
void LoadModelAsset(std::string path, std::string name);
|
|
const Model* GetStaticModel(std::string name);
|
|
|
|
// 수명을 무제한으로 놓고 싶으면 lifespan을 -1으로 설정하면 됨
|
|
std::shared_ptr<Model> SpawnLifedModel(std::string asset_name, std::string name,
|
|
std::float_t lifespan);
|
|
std::shared_ptr<Model> GetSpawnedObject(std::string name);
|
|
|
|
void Update();
|
|
void NetUpdate(std::shared_ptr<Network::Socket> sock);
|
|
|
|
void NetworkUpload(std::shared_ptr<Network::Socket> sock);
|
|
void ResponseToServerAndRefresh(std::shared_ptr<Network::Socket> sock);
|
|
|
|
std::function<void(Engine&)> BeginPlay = [](Engine& engine) {};
|
|
std::function<void(Engine&, std::float_t delta_time)> Tick =
|
|
[](Engine& engine, std::float_t delta_time) {};
|
|
|
|
glm::mat4 view =
|
|
glm::lookAt(glm::vec3(0.f, 0.f, -5.f), glm::vec3(0.f, 0.f, 0.f),
|
|
glm::vec3(0.f, -1.f, 0.f));
|
|
glm::mat4 projection =
|
|
glm::perspective(glm::radians(103.f), 800.f / 600.f, 0.1f, 1000.f);
|
|
|
|
gsl::not_null<Graphics*> vulkan_graphics;
|
|
|
|
private:
|
|
Loader asset_loader_;
|
|
Physics physics_controller_;
|
|
utils::ThreadPool* thread_pool_;
|
|
Network::IOCP* iocp_;
|
|
|
|
glm::ivec2 window_size_ = {0, 0};
|
|
std::double_t last_frame_time_ = 0.0;
|
|
|
|
std::unordered_map<std::string, veng::Model> model_assets_;
|
|
|
|
std::unordered_map<std::string, std::shared_ptr<Model>> models_;
|
|
};
|
|
|
|
} // namespace veng
|