diff --git a/include/Nazara/Graphics/ElementRenderer.hpp b/include/Nazara/Graphics/ElementRenderer.hpp index 656ef354b..ea35a47b9 100644 --- a/include/Nazara/Graphics/ElementRenderer.hpp +++ b/include/Nazara/Graphics/ElementRenderer.hpp @@ -19,6 +19,7 @@ namespace Nz class CommandBufferBuilder; class RenderElement; class RenderFrame; + class ViewerInstance; struct ElementRendererData; class NAZARA_GRAPHICS_API ElementRenderer @@ -28,8 +29,8 @@ namespace Nz virtual ~ElementRenderer(); virtual std::unique_ptr InstanciateData() = 0; - virtual void Prepare(ElementRendererData& rendererData, RenderFrame& currentFrame, const Pointer* elements, std::size_t elementCount); - virtual void Render(ElementRendererData& rendererData, CommandBufferBuilder& commandBuffer, const Pointer* elements, std::size_t elementCount) = 0; + virtual void Prepare(const ViewerInstance& viewerInstance, ElementRendererData& rendererData, RenderFrame& currentFrame, const Pointer* elements, std::size_t elementCount); + virtual void Render(const ViewerInstance& viewerInstance, ElementRendererData& rendererData, CommandBufferBuilder& commandBuffer, const Pointer* elements, std::size_t elementCount) = 0; virtual void Reset(ElementRendererData& rendererData, RenderFrame& currentFrame); }; diff --git a/include/Nazara/Graphics/Material.hpp b/include/Nazara/Graphics/Material.hpp index 0f1a9ecae..24eb79c71 100644 --- a/include/Nazara/Graphics/Material.hpp +++ b/include/Nazara/Graphics/Material.hpp @@ -22,7 +22,7 @@ namespace Nz inline void AddPass(std::size_t passIndex, std::shared_ptr pass); inline void AddPass(std::string passName, std::shared_ptr pass); - inline MaterialPass* GetPass(std::size_t passIndex) const; + inline const std::shared_ptr& GetPass(std::size_t passIndex) const; inline bool HasPass(std::size_t passIndex) const; diff --git a/include/Nazara/Graphics/Material.inl b/include/Nazara/Graphics/Material.inl index a72b2838c..d45d8de43 100644 --- a/include/Nazara/Graphics/Material.inl +++ b/include/Nazara/Graphics/Material.inl @@ -21,17 +21,23 @@ namespace Nz return AddPass(registry.GetPassIndex(passName), std::move(pass)); } - inline MaterialPass* Material::GetPass(std::size_t passIndex) const + inline const std::shared_ptr& Material::GetPass(std::size_t passIndex) const { if (passIndex >= m_passes.size()) - return nullptr; + { + static std::shared_ptr dummy; + return dummy; + } - return m_passes[passIndex].get(); + return m_passes[passIndex]; } inline bool Material::HasPass(std::size_t passIndex) const { - return GetPass(passIndex) != nullptr; + if (passIndex >= m_passes.size()) + return false; + + return m_passes[passIndex] != nullptr; } inline void Material::RemovePass(std::size_t passIndex) diff --git a/include/Nazara/Graphics/MaterialPass.hpp b/include/Nazara/Graphics/MaterialPass.hpp index 230b8ed29..2fd2104b4 100644 --- a/include/Nazara/Graphics/MaterialPass.hpp +++ b/include/Nazara/Graphics/MaterialPass.hpp @@ -52,6 +52,8 @@ namespace Nz inline void EnsurePipelineUpdate() const; + void FillShaderBinding(std::vector& bindings) const; + inline RendererComparison GetDepthCompareFunc() const; inline BlendEquation GetBlendAlphaModeEquation() const; inline BlendEquation GetBlendColorModeEquation() const; diff --git a/include/Nazara/Graphics/MaterialSettings.hpp b/include/Nazara/Graphics/MaterialSettings.hpp index 969c5fce8..3978bcc3b 100644 --- a/include/Nazara/Graphics/MaterialSettings.hpp +++ b/include/Nazara/Graphics/MaterialSettings.hpp @@ -39,6 +39,7 @@ namespace Nz inline const Builder& GetBuilderData() const; inline const std::vector