feat: add simple transparency
This commit is contained in:
@@ -29,6 +29,11 @@ enum class TextureFilteringMode : std::uint32_t {
|
||||
Anisotropic,
|
||||
};
|
||||
|
||||
enum class BlendMode : std::uint32_t {
|
||||
Opaque,
|
||||
Transparent,
|
||||
};
|
||||
|
||||
// Metallic / roughness workflow, matching glTF:
|
||||
// metallic is read from the blue channel, roughness from green and occlusion from red,
|
||||
// so a packed (occlusion)metallicRoughness texture can be used for all three slots.
|
||||
@@ -59,6 +64,9 @@ struct Material {
|
||||
float normalScale{1.f};
|
||||
float occlusionStrength{1.f};
|
||||
|
||||
BlendMode blendMode{BlendMode::Opaque};
|
||||
float opacity{1.f};
|
||||
|
||||
TextureFilteringMode textureFilteringMode{TextureFilteringMode::Linear};
|
||||
|
||||
ImageID diffuseTexture{NULL_IMAGE_ID};
|
||||
|
||||
@@ -44,6 +44,14 @@ public:
|
||||
const IndirectDrawList& drawList,
|
||||
const IndirectDrawList::View& view);
|
||||
|
||||
void drawTransparent(
|
||||
VkCommandBuffer cmd,
|
||||
VkExtent2D renderExtent,
|
||||
const RenderResources& resources,
|
||||
const GPUBuffer& sceneDataBuffer,
|
||||
const IndirectDrawList& drawList,
|
||||
const IndirectDrawList::View& view);
|
||||
|
||||
void cleanup(VkDevice device);
|
||||
|
||||
void setRenderWireframe(bool wireframe) {
|
||||
@@ -72,6 +80,7 @@ private:
|
||||
private:
|
||||
VkPipelineLayout m_pipelineLayout{VK_NULL_HANDLE};
|
||||
std::unique_ptr<Pipeline> m_pipeline;
|
||||
std::unique_ptr<Pipeline> m_transparentPipeline;
|
||||
std::unique_ptr<Pipeline> m_depthPrepassPipeline;
|
||||
std::unique_ptr<Pipeline> m_selectionPrepassPipeline;
|
||||
|
||||
|
||||
@@ -183,6 +183,7 @@ private:
|
||||
|
||||
std::vector<MeshDrawCommand> meshDrawCommands;
|
||||
std::vector<std::size_t> sortedMeshDrawCommands;
|
||||
std::vector<std::size_t> transparentMeshDrawCommands;
|
||||
IndirectDrawList drawList;
|
||||
DrawStats lastDrawStats;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user