아 화면 렌더링 안 되는건 memset으로 id복사하면서 버텍스 버퍼를 0으로 덮어써버리는게 원인이었음 그리고 현재 있는 버그는 너무 빠른 속도 또는 적당한 이동속도에서 총알을 많이 발사하면 카메라의 위치가 nan이 됨.

This commit is contained in:
2025-06-14 02:39:21 +09:00
parent 13ea246990
commit 93fda88d75
7 changed files with 168 additions and 141 deletions

View File

@@ -145,7 +145,7 @@ class IOCP {
// data는 한 가지 소켓에 보내는 패킷만 담아야 합니다
int send(SOCKET sock, std::vector<IOCPPASSINDATA*>* data);
int GetRecvedPacketCount(SOCKET sock);
int GetRecvedBytes(SOCKET sock);
private:
#ifdef _WIN32

View File

@@ -32,6 +32,7 @@ struct Model {
original_offset(other.original_offset),
owner(other.owner),
radius(other.radius),
lifespan(other.lifespan),
OnColision(other.OnColision),
visible(other.visible),
colision(other.colision) {
@@ -40,10 +41,10 @@ struct Model {
}
Model(Model&& other)
: vertices(other.vertices),
vertex_buffer(other.vertex_buffer),
indices(other.indices),
index_buffer(other.index_buffer),
: vertices(std::move(other.vertices)),
vertex_buffer(std::move(other.vertex_buffer)),
indices(std::move(other.indices)),
index_buffer(std::move(other.index_buffer)),
transform(other.transform),
position(other.position),
linear_velocity(other.linear_velocity),
@@ -56,52 +57,25 @@ struct Model {
original_offset(other.original_offset),
owner(other.owner),
radius(other.radius),
lifespan(other.lifespan),
OnColision(other.OnColision),
visible(other.visible),
colision(other.colision) {
ID = other.ID;
::memset(&other.ID, 0, 64);
::memset(&other.ID, 0, 8);
graphics_ = other.graphics_;
other.graphics_ = nullptr;
}
Model& operator=(const Model& other) {
if (this != &other) {
ID = utils::GenerateID();
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) {
ID = other.ID;
::memset(&other.ID, 0, 64);
::memset(&other.ID, 0, 8);
vertices = std::move(other.vertices);
vertex_buffer = other.vertex_buffer;
vertex_buffer = std::move(other.vertex_buffer);
indices = std::move(other.indices);
index_buffer = other.index_buffer;
index_buffer = std::move(other.index_buffer);
transform = other.transform;
position = other.position;
linear_velocity = other.linear_velocity;
@@ -114,6 +88,7 @@ struct Model {
original_offset = other.original_offset;
owner = other.owner;
radius = other.radius;
lifespan = other.lifespan;
OnColision = other.OnColision;
visible = other.visible;
colision = other.colision;
@@ -156,6 +131,8 @@ struct Model {
std::float_t radius = 0.f;
std::float_t lifespan = -1.f;
std::function<void(Model* self, Model* other)> OnColision = nullptr;
bool visible = true;

View File

@@ -25,9 +25,10 @@ class Engine {
Model* GetSpawnedObject(std::string name);
void Update();
void NetUpdate(std::shared_ptr<Network::Socket> sock);
void NetworkUpload();
void RefreshFromServer();
void NetworkUpload(std::shared_ptr<Network::Socket> sock);
void RefreshFromServer(std::shared_ptr<Network::Socket> sock);
std::function<void(Engine&)> BeginPlay = [](Engine& engine) {};
std::function<void(Engine&, std::float_t delta_time)> Tick =
@@ -52,9 +53,7 @@ class Engine {
std::unordered_map<std::string, veng::Model> model_assets_;
std::unordered_map<std::string, veng::Model> dynamic_immortal_models_;
std::unordered_map<std::string, std::pair<veng::Model, std::float_t>>
dynamic_models_;
std::unordered_map<std::string, veng::Model> models_;
};
} // namespace veng