Skip to content
Snippets Groups Projects
Verified Commit d1e5371a authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Adjust facing of generated geometry from module

parent 68955e55
No related branches found
No related tags found
No related merge requests found
...@@ -41,12 +41,12 @@ namespace vkcv::geometry { ...@@ -41,12 +41,12 @@ namespace vkcv::geometry {
+0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, +0.5f,
+0.5f, -0.5f, -0.5f, +0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, +0.5f,
+0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f,
-0.5f, +0.5f, -0.5f, -0.5f, +0.5f, -0.5f,
-0.5f, +0.5f, +0.5f,
+0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f,
-0.5f, +0.5f, +0.5f,
+0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
......
...@@ -73,7 +73,7 @@ namespace vkcv::geometry { ...@@ -73,7 +73,7 @@ namespace vkcv::geometry {
size_t offset = 0; size_t offset = 0;
for (i = 0; i < resolution; i++) { for (i = 0; i < resolution; i++) {
u = static_cast<float>(i) / static_cast<float>(resolution); u = static_cast<float>(i) / static_cast<float>(resolution - 1);
phi = 2.0f * std::numbers::pi_v<float> * u; phi = 2.0f * std::numbers::pi_v<float> * u;
sinPhi = std::sin(phi); sinPhi = std::sin(phi);
...@@ -95,13 +95,23 @@ namespace vkcv::geometry { ...@@ -95,13 +95,23 @@ namespace vkcv::geometry {
cylinderNormals.push_back(glm::vec3(sinPhi, 0.0f, cosPhi)); cylinderNormals.push_back(glm::vec3(sinPhi, 0.0f, cosPhi));
cylinderUVCoords.push_back(glm::vec2(u, v)); cylinderUVCoords.push_back(glm::vec2(u, v));
cylinderIndices.push_back(2 + (offset + j * 2) % (vertexCount - 2)); if (j == 1) {
cylinderIndices.push_back(2 + (offset + j * 2 + 4) % (vertexCount - 2)); cylinderIndices.push_back(2 + (offset + j * 2) % (vertexCount - 2));
cylinderIndices.push_back(j); cylinderIndices.push_back(2 + (offset + j * 2 + 4) % (vertexCount - 2));
cylinderIndices.push_back(j);
cylinderIndices.push_back(2 + (offset + j * 2 + 1) % (vertexCount - 2));
cylinderIndices.push_back(2 + (offset + j * 2 + 5) % (vertexCount - 2)); cylinderIndices.push_back(2 + (offset + j * 2 + 5) % (vertexCount - 2));
cylinderIndices.push_back(2 + (offset + j * 2 + 3) % (vertexCount - 2)); cylinderIndices.push_back(2 + (offset + j * 2 + 1) % (vertexCount - 2));
cylinderIndices.push_back(2 + (offset + j * 2 + 3) % (vertexCount - 2));
} else {
cylinderIndices.push_back(2 + (offset + j * 2 + 4) % (vertexCount - 2));
cylinderIndices.push_back(2 + (offset + j * 2) % (vertexCount - 2));
cylinderIndices.push_back(j);
cylinderIndices.push_back(2 + (offset + j * 2 + 1) % (vertexCount - 2));
cylinderIndices.push_back(2 + (offset + j * 2 + 5) % (vertexCount - 2));
cylinderIndices.push_back(2 + (offset + j * 2 + 3) % (vertexCount - 2));
}
} }
offset += 4; offset += 4;
......
#include <iostream> #include <iostream>
#include <vkcv/Buffer.hpp>
#include <vkcv/Core.hpp> #include <vkcv/Core.hpp>
#include <vkcv/Image.hpp> #include <vkcv/Image.hpp>
#include <vkcv/Pass.hpp> #include <vkcv/Pass.hpp>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment