From a73f43bb3174e2e6901cfb23452d055605884da8 Mon Sep 17 00:00:00 2001 From: Gamemaker1998 Date: Sat, 25 Jan 2025 18:45:02 +0100 Subject: [PATCH] Minor changes --- src/gpu/Renderer.cpp | 4 +++- src/util/Model.cpp | 14 ++++++-------- src/util/Model.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gpu/Renderer.cpp b/src/gpu/Renderer.cpp index 45efed7..9a31f67 100644 --- a/src/gpu/Renderer.cpp +++ b/src/gpu/Renderer.cpp @@ -70,6 +70,7 @@ using namespace slang; void Renderer::createShaders() { + /* Slang::ComPtr globalSession; SlangGlobalSessionDesc desc = {}; createGlobalSession(&desc, globalSession.writeRef()); @@ -82,7 +83,7 @@ void Renderer::createShaders() const char* searchPaths[] = {"res/shaders/"}; sessionDesc.searchPaths = searchPaths; sessionDesc.searchPathCount = 1; - /* ... fill in `sessionDesc` ... */ + /* ... fill in `sessionDesc` ... Slang::ComPtr session; globalSession->createSession(sessionDesc, session.writeRef()); @@ -104,6 +105,7 @@ void Renderer::createShaders() int targetIndex = 0; // only one target Slang::ComPtr kernelBlob; linkedProgram->getEntryPointCode(entryPointIndex, targetIndex, kernelBlob.writeRef(), diagnostics.writeRef()); + */ } void Renderer::render(Camera cam, RenderParameter param) {} \ No newline at end of file diff --git a/src/util/Model.cpp b/src/util/Model.cpp index acecbbb..706b2ea 100644 --- a/src/util/Model.cpp +++ b/src/util/Model.cpp @@ -13,8 +13,8 @@ void Model::transform(glm::mat4 matrix) { auto e0 = positions[indices[i + 1]] - positions[indices[i + 0]]; auto e1 = positions[indices[i + 2]] - positions[indices[i + 0]]; - es.push_back(e0); - es.push_back(e1); + edges.push_back(e0); + edges.push_back(e1); faceNormals.push_back(glm::cross(e0, e1)); } @@ -25,14 +25,14 @@ std::optional Model::intersect(const Ray ray) const std::optional intersection = {}; float distance = 0; - for(size_t posIndex=0, eIndex=0, normalIndex=0; posIndex Model::intersect(const Ray ray) const const float fraction = 1.0f / glm::dot(s1, e0); const auto resultVector = glm::vec3(glm::dot(s2, e1), glm::dot(s1, s), glm::dot(s2, ray.direction)) * fraction; - const double b3 = 1 - resultVector.y - resultVector.z; + const float b3 = 1.0f - resultVector.y - resultVector.z; if(b3 < 0 || b3 > 1) continue; @@ -52,8 +52,6 @@ std::optional Model::intersect(const Ray ray) const if(resultVector.z < 0 || resultVector.z > 1) continue; - if(std::abs(1.0f - (resultVector.y + resultVector.z + b3)) > 1e-7) - continue; if(resultVector.x < 1e-6) continue; diff --git a/src/util/Model.h b/src/util/Model.h index 424008f..21a4472 100644 --- a/src/util/Model.h +++ b/src/util/Model.h @@ -22,7 +22,7 @@ public: AABB boundingBox; std::vector positions; std::vector indices; - std::vector es; + std::vector edges; std::vector faceNormals; void transform(glm::mat4 matrix); std::optional intersect(Ray ray) const;