일단 충돌 구현...?

This commit is contained in:
2025-06-19 17:34:34 +09:00
parent dc2c106bad
commit 3e3769f912
8 changed files with 81 additions and 73 deletions

View File

@@ -51,8 +51,8 @@ class ThreadPool {
}
std::lock_guard<std::mutex> lock(jobQueueMutex);
auto boundFunc = [this, __job, ... __args = std::move(__args)]() mutable {
__job(this, std::move(__args)...);
auto boundFunc = [this, __job, ... __args = __args]() mutable {
__job(this, __args...);
};
auto task = std::packaged_task<void()>(std::move(boundFunc));
jobs_.push(std::move(task));

View File

@@ -8,6 +8,7 @@
#include "utils/snowflake.h"
#include "vulkan_engine/vulkan/buffer_handle.h"
#include "vulkan_engine/vulkan/vertex.h"
#include "utils/thread_pool.h"
extern std::uint8_t CLIENTID;
@@ -152,7 +153,8 @@ struct Model {
std::float_t lifespan = -1.f;
std::function<void(std::shared_ptr<Model> self, std::shared_ptr<Model> other)>
std::function<void(utils::ThreadPool* thread_pool, std::shared_ptr<Model> self,
std::shared_ptr<Model> other)>
OnColision = nullptr;
bool visible = true;

View File

@@ -1,14 +1,15 @@
#pragma once
#include "utils/thread_pool.h"
#include "vulkan_engine/asset/object/model.h"
#include "vulkan_engine/vulkan/vertex.h"
#include "utils/thread_pool.h"
namespace veng {
class Physics {
public:
void invokeOnColisionEvent(gsl::not_null<utils::ThreadPool*> thread_pool,
std::vector<std::shared_ptr<Model>> models);
void invokeOnColisionEvent(
gsl::not_null<utils::ThreadPool*> thread_pool,
std::unordered_map<std::string, std::shared_ptr<Model>>& models);
bool RayTrace(const glm::vec3& rayOrigin, const glm::vec3& rayDir,
const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2,