diff --git a/modules/geometry/src/vkcv/geometry/Cuboid.cpp b/modules/geometry/src/vkcv/geometry/Cuboid.cpp index 3e5c2d886a6d4a65b68162082c45e04a9f01169c..73a701b2826a7694201304b029c91af3e7191e5c 100644 --- a/modules/geometry/src/vkcv/geometry/Cuboid.cpp +++ b/modules/geometry/src/vkcv/geometry/Cuboid.cpp @@ -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, diff --git a/modules/geometry/src/vkcv/geometry/Cylinder.cpp b/modules/geometry/src/vkcv/geometry/Cylinder.cpp index 79e31496b559f049fb0a9931b7e5e061fd310cb2..67b62f694714e86877879f25e59d086627e95731 100644 --- a/modules/geometry/src/vkcv/geometry/Cylinder.cpp +++ b/modules/geometry/src/vkcv/geometry/Cylinder.cpp @@ -73,7 +73,7 @@ namespace vkcv::geometry { size_t offset = 0; 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; sinPhi = std::sin(phi); @@ -95,13 +95,23 @@ namespace vkcv::geometry { cylinderNormals.push_back(glm::vec3(sinPhi, 0.0f, cosPhi)); cylinderUVCoords.push_back(glm::vec2(u, v)); - cylinderIndices.push_back(2 + (offset + j * 2) % (vertexCount - 2)); - 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 + 3) % (vertexCount - 2)); + if (j == 1) { + cylinderIndices.push_back(2 + (offset + j * 2) % (vertexCount - 2)); + cylinderIndices.push_back(2 + (offset + j * 2 + 4) % (vertexCount - 2)); + cylinderIndices.push_back(j); + + cylinderIndices.push_back(2 + (offset + j * 2 + 5) % (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; diff --git a/projects/first_mesh/src/main.cpp b/projects/first_mesh/src/main.cpp index ecb1d9791e764b8bc36515fa7a76def7ee25ca6c..886d6e82ebf0fa68b5242624b001b20f889be22f 100644 --- a/projects/first_mesh/src/main.cpp +++ b/projects/first_mesh/src/main.cpp @@ -1,5 +1,4 @@ #include <iostream> -#include <vkcv/Buffer.hpp> #include <vkcv/Core.hpp> #include <vkcv/Image.hpp> #include <vkcv/Pass.hpp>