-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
93 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <dragon/graphics.hpp> | ||
|
||
Dragon::Graphics::Model::Model(Dragon::Graphics::Engine* parent, Dragon::Graphics::Window* owner, std::vector<Dragon::Graphics::Vertex> &verts) { | ||
VkBufferCreateInfo bufferInfo{}; | ||
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; | ||
bufferInfo.size = sizeof(Dragon::Graphics::Vertex) * verts.size(); | ||
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; | ||
bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; | ||
|
||
VmaAllocationCreateInfo allocInfo{}; | ||
allocInfo.usage = VMA_MEMORY_USAGE_AUTO; | ||
|
||
VkResult result = vmaCreateBuffer(parent->getParent()->getAllocator(), &bufferInfo, &allocInfo, &this->vertexBuffer.buffer, &this->vertexBuffer.allocation, nullptr); | ||
|
||
if (result != VK_SUCCESS) { | ||
throw fmt::format("vmaCreateBuffer failed with {}", string_VkResult(result)); | ||
} | ||
} | ||
|
||
void Dragon::Graphics::Model::close(Dragon::Graphics::Engine* parent, Dragon::Graphics::Window* owner) { | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#version 450 | ||
|
||
layout(location = 0) in vec3 fragColor; | ||
layout(location = 0) in vec4 fragColor; | ||
|
||
layout(location = 0) out vec4 outColor; | ||
|
||
void main() { | ||
outColor = vec4(fragColor, 1.0); | ||
outColor = fragColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
#version 450 | ||
|
||
layout(location = 0) out vec3 fragColor; | ||
layout(location = 0) in vec2 inPosition; | ||
layout(location = 1) in vec4 inColor; | ||
|
||
vec2 positions[3] = vec2[]( | ||
vec2(0.0, -0.5), | ||
vec2(0.5, 0.5), | ||
vec2(-0.5, 0.5) | ||
); | ||
|
||
vec3 colors[3] = vec3[]( | ||
vec3(1.0, 0.0, 0.0), | ||
vec3(0.0, 1.0, 0.0), | ||
vec3(0.0, 0.0, 1.0) | ||
); | ||
layout(location = 0) out vec4 fragColor; | ||
|
||
void main() { | ||
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0); | ||
fragColor = colors[gl_VertexIndex]; | ||
gl_Position = vec4(inPosition, 0.0, 1.0); | ||
fragColor = inColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters