일단은 멀티로 접속이 됨..

This commit is contained in:
2025-06-19 02:42:49 +09:00
parent 1b79d946c3
commit fc8217a608
25 changed files with 584 additions and 574 deletions

View File

@@ -5,20 +5,25 @@
#include <vector>
#include "material.h"
#include "utils/snowflake.h"
#include "vulkan_engine/vulkan/buffer_handle.h"
#include "vulkan_engine/vulkan/vertex.h"
#include "utils/snowflake.h"
extern std::uint8_t CLIENTID;
namespace veng {
struct Model {
Model() : graphics_(nullptr) {}
Model(class Graphics* graphics) : graphics_(graphics) {}
Model() : ID(utils::GenerateID(CLIENTID)), graphics_(nullptr) {
}
Model(class Graphics* graphics)
: ID(utils::GenerateID(CLIENTID)), graphics_(graphics) {
}
~Model();
Model(const Model& other)
: asset_name(other.asset_name),
: ID(utils::GenerateID(CLIENTID)),
name(/*"_" + */other.name),
asset_name(other.asset_name),
vertices(other.vertices),
vertex_buffer(other.vertex_buffer),
indices(other.indices),
@@ -39,14 +44,14 @@ struct Model {
OnColision(other.OnColision),
visible(other.visible),
colision(other.colision),
networkReplicated(other.networkReplicated) {
name = "_" + other.name;
ID = utils::GenerateID(CLIENTID);
networkReplicated(other.networkReplicated),
lastUpdatedTime(other.lastUpdatedTime) {
graphics_ = nullptr;
}
Model(Model&& other)
: name(other.name),
: ID(other.ID),
name(other.name),
asset_name(other.asset_name),
vertices(std::move(other.vertices)),
vertex_buffer(std::move(other.vertex_buffer)),
@@ -68,9 +73,8 @@ struct Model {
OnColision(other.OnColision),
visible(other.visible),
colision(other.colision),
networkReplicated(other.networkReplicated)
{
ID = other.ID;
networkReplicated(other.networkReplicated),
lastUpdatedTime(other.lastUpdatedTime) {
::memset(&other.ID, 0, 8);
graphics_ = other.graphics_;
@@ -104,6 +108,7 @@ struct Model {
visible = other.visible;
colision = other.colision;
networkReplicated = other.networkReplicated;
lastUpdatedTime = other.lastUpdatedTime;
graphics_ = other.graphics_;
other.graphics_ = nullptr;
@@ -141,13 +146,14 @@ struct Model {
glm::vec3 original_offset = glm::vec3(0.f);
Model* owner = this;
std::weak_ptr<Model> owner;
std::float_t radius = 0.f;
std::float_t lifespan = -1.f;
std::function<void(Model* self, Model* other)> OnColision = nullptr;
std::function<void(std::shared_ptr<Model> self, std::shared_ptr<Model> other)>
OnColision = nullptr;
bool visible = true;
bool colision = false;
@@ -156,6 +162,10 @@ struct Model {
bool needsUpdate = true;
double lastUpdatedTime = 0.f; // 서버 기준 업데이트된 시간임
std::mutex modding;
private:
class Graphics* graphics_;
};