불안정하게 멀티 됨.. 일단은 두번째 플레이어가 첫번째 플레이어한테 보이기는 하니까...

This commit is contained in:
2025-06-15 22:36:04 +09:00
parent 06a1e41dc8
commit 711fc4c93d
11 changed files with 328 additions and 77 deletions

View File

@@ -39,7 +39,7 @@ class Socket {
std::mutex readMutex;
std::mutex writeMutex;
protected:
private:
bool valid_ = false;
};

View File

@@ -18,7 +18,8 @@ struct Model {
~Model();
Model(const Model& other)
: vertices(other.vertices),
: asset_name(other.asset_name),
vertices(other.vertices),
vertex_buffer(other.vertex_buffer),
indices(other.indices),
index_buffer(other.index_buffer),
@@ -39,12 +40,15 @@ struct Model {
visible(other.visible),
colision(other.colision),
networkReplicated(other.networkReplicated) {
name = "_" + other.name;
ID = utils::GenerateID(CLIENTID);
graphics_ = nullptr;
}
Model(Model&& other)
: vertices(std::move(other.vertices)),
: name(other.name),
asset_name(other.asset_name),
vertices(std::move(other.vertices)),
vertex_buffer(std::move(other.vertex_buffer)),
indices(std::move(other.indices)),
index_buffer(std::move(other.index_buffer)),
@@ -77,6 +81,8 @@ struct Model {
if (this != &other) {
ID = other.ID;
::memset(&other.ID, 0, 8);
name = other.name;
asset_name = other.asset_name;
vertices = std::move(other.vertices);
vertex_buffer = std::move(other.vertex_buffer);
indices = std::move(other.indices);
@@ -105,6 +111,8 @@ struct Model {
return *this;
}
utils::Snowflake ID;
std::string name;
std::string asset_name;
std::vector<char> Serialize();
void Deserialize(std::vector<char> data);
@@ -144,6 +152,9 @@ struct Model {
bool visible = true;
bool colision = false;
bool networkReplicated = true;
bool shouldBeDestroyed = false;
bool needsUpdate = true;
private:
class Graphics* graphics_;

View File

@@ -19,7 +19,7 @@ class Engine {
void LoadModelAsset(std::string path, std::string name);
const Model* GetStaticModel(std::string name);
Model* SpawnModel(std::string asset_name, std::string name);
// 수명을 무제한으로 놓고 싶으면 lifespan을 -1으로 설정하면 됨
Model* SpawnLifedModel(std::string asset_name, std::string name,
std::float_t lifespan);
Model* GetSpawnedObject(std::string name);