Expose culling mode in shader config

This commit is contained in:
2021-02-15 13:50:27 +01:00
parent b1b4c117f2
commit b53b4b0ca1
2 changed files with 10 additions and 1 deletions

View File

@@ -14,6 +14,14 @@
namespace openVulkanoCpp::Scene
{
enum class CullMode : uint32_t
{
NONE = 0,
FRONT,
BACK,
FRONT_AND_BACK
};
enum class Topology : uint32_t
{
POINT_LIST = 0,
@@ -122,6 +130,7 @@ namespace openVulkanoCpp::Scene
std::vector<ShaderProgram> shaderPrograms{};
std::vector<VertexInputDescription> vertexInputDescriptions{};
Topology topology = Topology::TRIANGLE_LIST;
CullMode cullMode = CullMode::BACK;
ICloseable* renderShader = nullptr;
Shader() = default;

View File

@@ -67,7 +67,7 @@ namespace openVulkanoCpp::Vulkan
attributeDescriptionsSize, attributeDescriptionsData };
vk::PipelineInputAssemblyStateCreateInfo inputAssembly = { {}, static_cast<vk::PrimitiveTopology>(shader->topology), 0 };
vk::PipelineRasterizationStateCreateInfo rasterizer = {};
rasterizer.cullMode = vk::CullModeFlagBits::eBack;
rasterizer.cullMode = static_cast<vk::CullModeFlagBits>(shader->cullMode);
vk::PipelineMultisampleStateCreateInfo msaa = {};
vk::PipelineDepthStencilStateCreateInfo depth = { {}, 1, 1, vk::CompareOp::eLess };
depth.maxDepthBounds = 1;