WIP
This commit is contained in:
11
src/Nazara/Graphics/InstancedRenderable.cpp
Normal file
11
src/Nazara/Graphics/InstancedRenderable.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
InstancedRenderable::~InstancedRenderable() = default;
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <Nazara/Graphics/Model.hpp>
|
||||
#include <Nazara/Graphics/GraphicalMesh.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/ModelInstance.hpp>
|
||||
#include <Nazara/Renderer/CommandBufferBuilder.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -26,6 +28,25 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void Model::Draw(CommandBufferBuilder& commandBuffer, ModelInstance& instance) const
|
||||
{
|
||||
commandBuffer.BindShaderBinding(instance.GetShaderBinding());
|
||||
|
||||
for (std::size_t i = 0; i < m_subMeshes.size(); ++i)
|
||||
{
|
||||
const auto& submeshData = m_subMeshes[i];
|
||||
const auto& indexBuffer = m_graphicalMesh->GetIndexBuffer(i);
|
||||
const auto& vertexBuffer = m_graphicalMesh->GetVertexBuffer(i);
|
||||
const auto& renderPipeline = submeshData.material->GetPipeline()->GetRenderPipeline(submeshData.vertexBufferData);
|
||||
|
||||
commandBuffer.BindIndexBuffer(indexBuffer.get());
|
||||
commandBuffer.BindVertexBuffer(0, vertexBuffer.get());
|
||||
commandBuffer.BindPipeline(*renderPipeline);
|
||||
|
||||
commandBuffer.DrawIndexed(static_cast<Nz::UInt32>(m_graphicalMesh->GetIndexCount(i)));
|
||||
}
|
||||
}
|
||||
|
||||
const std::shared_ptr<AbstractBuffer>& Model::GetIndexBuffer(std::size_t subMeshIndex) const
|
||||
{
|
||||
return m_graphicalMesh->GetIndexBuffer(subMeshIndex);
|
||||
@@ -47,5 +68,4 @@ namespace Nz
|
||||
{
|
||||
return m_graphicalMesh->GetVertexBuffer(subMeshIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
0
src/Nazara/Utility/Components/NodeComponent.cpp
Normal file
0
src/Nazara/Utility/Components/NodeComponent.cpp
Normal file
Reference in New Issue
Block a user