Rainbow trianglegit add .
This commit is contained in:
23
Dockerfile
23
Dockerfile
@@ -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
|
||||
BIN
VulkanTest
BIN
VulkanTest
Binary file not shown.
@@ -51,11 +51,16 @@ namespace cve {
|
||||
}
|
||||
|
||||
std::vector<VkVertexInputAttributeDescription> CveModel::Vertex::getAttributeDescriptions() {
|
||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions(1);
|
||||
std::vector<VkVertexInputAttributeDescription> 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;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace cve {
|
||||
|
||||
struct Vertex {
|
||||
glm::vec2 position;
|
||||
glm::vec3 color;
|
||||
|
||||
static std::vector<VkVertexInputBindingDescription> getBindingDescriptions();
|
||||
static std::vector<VkVertexInputAttributeDescription> getAttributeDescriptions();
|
||||
};
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace cve {
|
||||
|
||||
void FirstApp::loadModels() {
|
||||
std::vector<CveModel::Vertex> 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<CveModel>(cveDevice, verticies);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Binary file not shown.
@@ -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;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user