Graphics: Add initial support for transparency

This commit is contained in:
Jérôme Leclercq
2021-09-08 19:08:44 +02:00
parent c6763bc623
commit 72f2a5b531
12 changed files with 154 additions and 40 deletions

View File

@@ -237,7 +237,7 @@ namespace Nz
viewerData.depthPrepassRenderQueue.Sort([&](const RenderElement* element)
{
return element->ComputeSortingScore(viewerData.depthPrepassRegistry);
return element->ComputeSortingScore(frustum, viewerData.depthPrepassRegistry);
});
if (viewerData.rebuildForwardPass)
@@ -258,7 +258,7 @@ namespace Nz
viewerData.forwardRenderQueue.Sort([&](const RenderElement* element)
{
return element->ComputeSortingScore(viewerData.forwardRegistry);
return element->ComputeSortingScore(frustum, viewerData.forwardRegistry);
});
}

View File

@@ -45,7 +45,7 @@ namespace Nz
const auto& vertexBuffer = m_graphicalMesh->GetVertexBuffer(i);
const auto& renderPipeline = materialPass->GetPipeline()->GetRenderPipeline(submeshData.vertexBufferData);
elements.emplace_back(std::make_unique<RenderSubmesh>(0, renderPipeline, m_graphicalMesh->GetIndexCount(i), indexBuffer, vertexBuffer, worldInstance.GetShaderBinding(), materialPass->GetShaderBinding()));
elements.emplace_back(std::make_unique<RenderSubmesh>(0, renderPipeline, m_graphicalMesh->GetIndexCount(i), indexBuffer, vertexBuffer, worldInstance, materialPass->GetShaderBinding(), materialPass->GetFlags()));
}
}

View File

@@ -40,7 +40,7 @@ namespace Nz
const auto& whiteTexture = Graphics::Instance()->GetDefaultTextures().whiteTexture2d;
elements.emplace_back(std::make_unique<RenderSpriteChain>(0, renderPipeline, vertexDeclaration, whiteTexture, 1, m_vertices.data(), materialPass->GetShaderBinding(), worldInstance.GetShaderBinding()));
elements.emplace_back(std::make_unique<RenderSpriteChain>(0, renderPipeline, vertexDeclaration, whiteTexture, 1, m_vertices.data(), materialPass->GetShaderBinding(), worldInstance, materialPass->GetFlags()));
}
const std::shared_ptr<Material>& Sprite::GetMaterial(std::size_t i) const

View File

@@ -42,7 +42,7 @@ namespace Nz
RenderIndices& indices = pair.second;
if (indices.count > 0)
elements.emplace_back(std::make_unique<RenderSpriteChain>(0, renderPipeline, vertexDeclaration, key.texture->shared_from_this(), indices.count, &m_vertices[indices.first * 4], materialPass->GetShaderBinding(), worldInstance.GetShaderBinding()));
elements.emplace_back(std::make_unique<RenderSpriteChain>(0, renderPipeline, vertexDeclaration, key.texture->shared_from_this(), indices.count, &m_vertices[indices.first * 4], materialPass->GetShaderBinding(), worldInstance, materialPass->GetFlags()));
}
}