#pragma once #include #include #include #include #include "material.h" #include "vulkan/buffer_handle.h" #include "vulkan/vertex.h" namespace veng { struct Model { Model() : graphics_(nullptr) {} Model(class Graphics* graphics) : graphics_(graphics) {} ~Model(); Model(const Model& other) : vertices(other.vertices), vertex_buffer(other.vertex_buffer), indices(other.indices), index_buffer(other.index_buffer), transform(other.transform), position(other.position), linear_velocity(other.linear_velocity), linear_acceleration(other.linear_acceleration), rotation(other.rotation), angular_velocity(other.angular_velocity), angular_acceleration(other.angular_acceleration), scale(other.scale), material(other.material), original_offset(other.original_offset), owner(other.owner), radius(other.radius), OnColision(other.OnColision), visible(other.visible), colision(other.colision) { graphics_ = nullptr; } Model(Model&& other) : vertices(other.vertices), vertex_buffer(other.vertex_buffer), indices(other.indices), index_buffer(other.index_buffer), transform(other.transform), position(other.position), linear_velocity(other.linear_velocity), linear_acceleration(other.linear_acceleration), rotation(other.rotation), angular_velocity(other.angular_velocity), angular_acceleration(other.angular_acceleration), scale(other.scale), material(other.material), original_offset(other.original_offset), owner(other.owner), radius(other.radius), OnColision(other.OnColision), visible(other.visible), colision(other.colision) { graphics_ = other.graphics_; other.graphics_ = nullptr; } Model& operator=(const Model& other) { if (this != &other) { vertices = other.vertices; vertex_buffer = other.vertex_buffer; indices = other.indices; index_buffer = other.index_buffer; transform = other.transform; position = other.position; linear_velocity = other.linear_velocity; linear_acceleration = other.linear_acceleration; rotation = other.rotation; angular_velocity = other.angular_velocity; angular_acceleration = other.angular_acceleration; scale = other.scale; material = other.material; original_offset = other.original_offset; owner = other.owner; radius = other.radius; OnColision = other.OnColision; visible = other.visible; colision = other.colision; graphics_ = nullptr; } return *this; } Model& operator=(Model&& other) noexcept { if (this != &other) { vertices = std::move(other.vertices); vertex_buffer = other.vertex_buffer; indices = std::move(other.indices); index_buffer = other.index_buffer; transform = other.transform; position = other.position; linear_velocity = other.linear_velocity; linear_acceleration = other.linear_acceleration; rotation = other.rotation; angular_velocity = other.angular_velocity; angular_acceleration = other.angular_acceleration; scale = other.scale; material = std::move(other.material); original_offset = other.original_offset; owner = other.owner; radius = other.radius; OnColision = other.OnColision; visible = other.visible; colision = other.colision; // graphics_만 옮기고, 원본은 nullptr graphics_ = other.graphics_; other.graphics_ = nullptr; } return *this; } std::vector vertices; veng::BufferHandle vertex_buffer; std::vector indices; veng::BufferHandle index_buffer; glm::mat4 transform = glm::rotate(glm::mat4(1.0f), glm::radians(180.f), glm::vec3(0.f, 0.f, 1.f)); glm::vec3 position = glm::vec3(0.f); glm::vec3 linear_velocity = glm::vec3(0.f); glm::vec3 linear_acceleration = glm::vec3(0.f); glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f); glm::vec3 angular_velocity = glm::vec3(0.f); // 축 * 각속도(rad/s) glm::vec3 angular_acceleration = glm::vec3(0.f); glm::vec3 scale = glm::vec3(1.f); Material material; void Update(float dt); glm::vec3 original_offset = glm::vec3(0.f); Model* owner = this; std::float_t radius = 0.f; std::function OnColision = nullptr; bool visible = true; bool colision = false; private: class Graphics* graphics_; }; } // namespace veng