diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 06ad274..0000000 --- a/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM ubuntu:22.04 - -# Install dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - cmake \ - git \ - vulkan-tools \ - libvulkan-dev \ - vulkan-validationlayers \ - spirv-tools \ - libxxf86vm-dev \ - libxi-dev \ - libglfw3-dev \ - libglm-dev \ - wget \ - && rm -rf /var/lib/apt/lists/* - -# Install glslc -RUN wget -O /tmp/glslc.deb https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_release.html && \ - apt-get update && apt-get install -y /tmp/glslc.deb || true - -WORKDIR /workspace \ No newline at end of file diff --git a/VulkanTest b/VulkanTest index d36e5ca..0aa2d42 100755 Binary files a/VulkanTest and b/VulkanTest differ diff --git a/a.out b/a.out deleted file mode 100755 index 76a5670..0000000 Binary files a/a.out and /dev/null differ diff --git a/cve_model.cpp b/cve_model.cpp index b56d2a7..aa6bf73 100644 --- a/cve_model.cpp +++ b/cve_model.cpp @@ -51,11 +51,16 @@ namespace cve { } std::vector CveModel::Vertex::getAttributeDescriptions() { - std::vector attributeDescriptions(1); + std::vector attributeDescriptions(2); attributeDescriptions[0].binding = 0; attributeDescriptions[0].location = 0; attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT; - attributeDescriptions[0].offset = 0; + attributeDescriptions[0].offset = offsetof(Vertex, position); + + attributeDescriptions[1].binding = 0; + attributeDescriptions[1].location = 1; + attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[1].offset = offsetof(Vertex, color); return attributeDescriptions; } diff --git a/cve_model.hpp b/cve_model.hpp index 59b1adf..b148ce8 100644 --- a/cve_model.hpp +++ b/cve_model.hpp @@ -14,6 +14,8 @@ namespace cve { struct Vertex { glm::vec2 position; + glm::vec3 color; + static std::vector getBindingDescriptions(); static std::vector getAttributeDescriptions(); }; diff --git a/first_app.cpp b/first_app.cpp index d61bff0..f0d8c72 100644 --- a/first_app.cpp +++ b/first_app.cpp @@ -26,9 +26,9 @@ namespace cve { void FirstApp::loadModels() { std::vector verticies { - {{0.0f, -0.5f}}, - {{0.5f, 0.5f}}, - {{-0.5f, 0.5f}} + {{0.0f, -0.5f}, {1.0f, 0.0f, 0.0f}}, + {{0.5f, 0.5f}, {0.0f, 1.0f, 0.0f}}, + {{-0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}} }; cveModel = std::make_unique(cveDevice, verticies); diff --git a/shaders/simple_shader.frag b/shaders/simple_shader.frag index 1d1b727..ba9894d 100644 --- a/shaders/simple_shader.frag +++ b/shaders/simple_shader.frag @@ -1,7 +1,9 @@ #version 450 -layout (location = 0) out vec4 outColor; +layout(location = 0) in vec3 fragColor; + +layout(location = 0) out vec4 outColor; void main() { - outColor = vec4(1.0, 1.0, 0.0, 1.0); -} + outColor = vec4(fragColor, 1.0); +} \ No newline at end of file diff --git a/shaders/simple_shader.frag.spv b/shaders/simple_shader.frag.spv index b5a7103..da37f7e 100644 Binary files a/shaders/simple_shader.frag.spv and b/shaders/simple_shader.frag.spv differ diff --git a/shaders/simple_shader.vert b/shaders/simple_shader.vert index 5d8e89b..662c096 100644 --- a/shaders/simple_shader.vert +++ b/shaders/simple_shader.vert @@ -1,7 +1,11 @@ #version 450 layout(location = 0) in vec2 position; +layout(location = 1) in vec3 color; + +layout(location = 0) out vec3 fragColor; void main() { gl_Position = vec4(position, 0.0, 1.0); + fragColor = color; } diff --git a/shaders/simple_shader.vert.spv b/shaders/simple_shader.vert.spv index 4a3fc9b..75cc466 100644 Binary files a/shaders/simple_shader.vert.spv and b/shaders/simple_shader.vert.spv differ