summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/xe_device.cpp1
-rw-r--r--engine/xe_render_system.cpp8
-rw-r--r--engine/xe_render_system.hpp22
3 files changed, 27 insertions, 4 deletions
diff --git a/engine/xe_device.cpp b/engine/xe_device.cpp
index dc4d5f1..3c13150 100755
--- a/engine/xe_device.cpp
+++ b/engine/xe_device.cpp
@@ -170,6 +170,7 @@ void Device::createLogicalDevice() {
VkPhysicalDeviceFeatures deviceFeatures = {};
deviceFeatures.samplerAnisotropy = VK_TRUE;
+ deviceFeatures.fillModeNonSolid = VK_TRUE;
VkDeviceCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
diff --git a/engine/xe_render_system.cpp b/engine/xe_render_system.cpp
index ff745e6..99c92b1 100644
--- a/engine/xe_render_system.cpp
+++ b/engine/xe_render_system.cpp
@@ -10,6 +10,7 @@ RenderSystem::RenderSystem(
std::map<uint32_t, std::vector<Image*>> imageArrayBindings,
uint32_t pushCunstantDataSize,
bool cullingEnabled,
+ bool wireframeEnabled,
std::vector<VkVertexInputAttributeDescription> attributeDescptions,
uint32_t vertexSize
) : xeDevice{Engine::getInstance()->xeDevice},
@@ -23,7 +24,7 @@ RenderSystem::RenderSystem(
createUniformBuffers();
createDescriptorSets();
createPipelineLayout();
- createPipeline(xeRenderer.getSwapChainRenderPass(), vert, frag, cullingEnabled, attributeDescptions, vertexSize);
+ createPipeline(xeRenderer.getSwapChainRenderPass(), vert, frag, cullingEnabled, wireframeEnabled, attributeDescptions, vertexSize);
}
RenderSystem::~RenderSystem() {
@@ -155,7 +156,7 @@ void RenderSystem::createPipelineLayout() {
}
-void RenderSystem::createPipeline(VkRenderPass renderPass, std::string vert, std::string frag, bool cullingEnabled, std::vector<VkVertexInputAttributeDescription> attributeDescptions, uint32_t vertexSize) {
+void RenderSystem::createPipeline(VkRenderPass renderPass, std::string vert, std::string frag, bool cullingEnabled, bool wireframeEnabled, std::vector<VkVertexInputAttributeDescription> attributeDescptions, uint32_t vertexSize) {
assert(pipelineLayout != nullptr && "Cannot create pipeline before pipeline layout");
PipelineConfigInfo pipelineConfig{};
@@ -163,6 +164,9 @@ void RenderSystem::createPipeline(VkRenderPass renderPass, std::string vert, std
if (cullingEnabled) {
pipelineConfig.rasterizationInfo.cullMode = VK_CULL_MODE_BACK_BIT;
}
+ if(wireframeEnabled) {
+ pipelineConfig.rasterizationInfo.polygonMode = VK_POLYGON_MODE_LINE;
+ }
pipelineConfig.renderPass = renderPass;
pipelineConfig.pipelineLayout = pipelineLayout;
xePipeline = std::make_unique<Pipeline>(
diff --git a/engine/xe_render_system.hpp b/engine/xe_render_system.hpp
index a07b5c0..04ce52f 100644
--- a/engine/xe_render_system.hpp
+++ b/engine/xe_render_system.hpp
@@ -74,8 +74,24 @@ class RenderSystem {
return *this;
}
+ Builder& setWireframe(bool enabled) {
+ wireframeEnabled = enabled;
+ return *this;
+ }
+
std::unique_ptr<RenderSystem> build() {
- return std::make_unique<RenderSystem>(std::move(vert), std::move(frag), std::move(uniformBindings), std::move(imageBindings), std::move(imageArrayBindings), std::move(pushCunstantDataSize), std::move(cullingEnabled), std::move(attributeDescptions), std::move(vertexSize));
+ return std::make_unique<RenderSystem>(
+ std::move(vert),
+ std::move(frag),
+ std::move(uniformBindings),
+ std::move(imageBindings),
+ std::move(imageArrayBindings),
+ std::move(pushCunstantDataSize),
+ std::move(cullingEnabled),
+ std::move(wireframeEnabled),
+ std::move(attributeDescptions),
+ std::move(vertexSize)
+ );
}
private:
@@ -92,6 +108,7 @@ class RenderSystem {
std::string frag;
bool cullingEnabled{false};
+ bool wireframeEnabled{false};
};
RenderSystem(
@@ -102,6 +119,7 @@ class RenderSystem {
std::map<uint32_t, std::vector<Image*>> imageArrayBindings,
uint32_t pushCunstantDataSize,
bool cullingEnabled,
+ bool wireframeEnabled,
std::vector<VkVertexInputAttributeDescription> attributeDescptions,
uint32_t vertexSize
);
@@ -127,7 +145,7 @@ class RenderSystem {
void createDescriptorSets();
void updateDescriptorSet(int frameIndex, bool allocate);
void createPipelineLayout();
- void createPipeline(VkRenderPass renderPass, std::string vert, std::string frag, bool cullingEnabled, std::vector<VkVertexInputAttributeDescription> attributeDescptions, uint32_t vertexSize);
+ void createPipeline(VkRenderPass renderPass, std::string vert, std::string frag, bool cullingEnabled, bool wireframeEnabled, std::vector<VkVertexInputAttributeDescription> attributeDescptions, uint32_t vertexSize);
bool boundPipeline{false};
bool boundDescriptor{false};