Add third coordinate
This commit is contained in:
@@ -86,7 +86,7 @@ std::array<VkVertexInputAttributeDescription, 2> RenderEngine::Vertex::get_verte
|
|||||||
// Bind vertex loc
|
// Bind vertex loc
|
||||||
descriptions[0].binding = 0;
|
descriptions[0].binding = 0;
|
||||||
descriptions[0].location = 0;
|
descriptions[0].location = 0;
|
||||||
descriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
|
descriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||||
descriptions[0].offset = offsetof(Vertex, pos);
|
descriptions[0].offset = offsetof(Vertex, pos);
|
||||||
|
|
||||||
// Bind color
|
// Bind color
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class RenderEngine
|
|||||||
};
|
};
|
||||||
struct Vertex
|
struct Vertex
|
||||||
{
|
{
|
||||||
glm::vec2 pos;
|
glm::vec3 pos;
|
||||||
glm::vec3 color;
|
glm::vec3 color;
|
||||||
static VkVertexInputBindingDescription get_binding_description();
|
static VkVertexInputBindingDescription get_binding_description();
|
||||||
static std::array<VkVertexInputAttributeDescription, 2> get_vertex_attribute_descriptions();
|
static std::array<VkVertexInputAttributeDescription, 2> get_vertex_attribute_descriptions();
|
||||||
@@ -51,13 +51,22 @@ class RenderEngine
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<Vertex> vertices_ = {
|
const std::vector<Vertex> vertices_ = {
|
||||||
{{-0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}},
|
{{-0.5f, -0.5f, 0.5f}, {1.0f, 0.0f, 0.0f}},
|
||||||
{{0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}},
|
{{0.5f, -0.5f, 0.5f}, {0.0f, 1.0f, 0.0f}},
|
||||||
{{0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}},
|
{{0.5f, 0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}},
|
||||||
{{-0.5f, 0.5f}, {1.0f, 1.0f, 1.0f}}
|
{{-0.5f, 0.5f, 0.5f}, {1.0f, 1.0f, 1.0f}},
|
||||||
|
{{-0.5f, -0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}},
|
||||||
|
{{0.5f, -0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}},
|
||||||
|
{{0.5f, 0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}},
|
||||||
|
{{-0.5f, 0.5f, -0.5f}, {1.0f, 1.0f, 1.0f}}
|
||||||
};
|
};
|
||||||
const std::vector<uint16_t> indices_ = {
|
const std::vector<uint16_t> indices_ = {
|
||||||
0, 1, 2, 2, 3, 0
|
0, 1, 2, 2, 3, 0,
|
||||||
|
2, 1, 5, 5, 6, 2,
|
||||||
|
0, 3, 7, 7, 4, 0,
|
||||||
|
3, 2, 6, 6, 7, 3,
|
||||||
|
7, 6, 5, 5, 4, 7,
|
||||||
|
4, 5, 1, 1, 0, 4
|
||||||
};
|
};
|
||||||
|
|
||||||
ModelManager model_manager_;
|
ModelManager model_manager_;
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ layout(binding = 0) uniform UniformBufferObject {
|
|||||||
mat4 proj;
|
mat4 proj;
|
||||||
} ubo;
|
} ubo;
|
||||||
|
|
||||||
layout(location = 0) in vec2 inPosition;
|
layout(location = 0) in vec3 inPosition;
|
||||||
layout(location = 1) in vec3 inColor;
|
layout(location = 1) in vec3 inColor;
|
||||||
|
|
||||||
layout(location = 0) out vec3 fragColor;
|
layout(location = 0) out vec3 fragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 0.0, 1.0);
|
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);
|
||||||
fragColor = inColor;
|
fragColor = inColor;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user