Graphics: Add GetViewerDataUBO
This commit is contained in:
parent
a6ff64106e
commit
a0d5750ec8
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
class AbstractBuffer;
|
||||||
class RenderDevice;
|
class RenderDevice;
|
||||||
|
|
||||||
class NAZARA_GRAPHICS_API Graphics : public ModuleBase<Graphics>
|
class NAZARA_GRAPHICS_API Graphics : public ModuleBase<Graphics>
|
||||||
|
|
@ -29,6 +30,7 @@ namespace Nz
|
||||||
~Graphics();
|
~Graphics();
|
||||||
|
|
||||||
inline RenderDevice& GetRenderDevice();
|
inline RenderDevice& GetRenderDevice();
|
||||||
|
inline const std::shared_ptr<AbstractBuffer>& GetViewerDataUBO();
|
||||||
|
|
||||||
struct Config
|
struct Config
|
||||||
{
|
{
|
||||||
|
|
@ -36,6 +38,7 @@ namespace Nz
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::shared_ptr<AbstractBuffer> m_viewerDataUBO;
|
||||||
std::shared_ptr<RenderDevice> m_renderDevice;
|
std::shared_ptr<RenderDevice> m_renderDevice;
|
||||||
|
|
||||||
static Graphics* s_instance;
|
static Graphics* s_instance;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ namespace Nz
|
||||||
{
|
{
|
||||||
return *m_renderDevice;
|
return *m_renderDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const std::shared_ptr<AbstractBuffer>& Graphics::GetViewerDataUBO()
|
||||||
|
{
|
||||||
|
return m_viewerDataUBO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Graphics/DebugOff.hpp>
|
#include <Nazara/Graphics/DebugOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <Nazara/Graphics/Graphics.hpp>
|
#include <Nazara/Graphics/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/MaterialPipeline.hpp>
|
#include <Nazara/Graphics/MaterialPipeline.hpp>
|
||||||
|
#include <Nazara/Graphics/PredefinedShaderStructs.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <Nazara/Graphics/Debug.hpp>
|
#include <Nazara/Graphics/Debug.hpp>
|
||||||
|
|
||||||
|
|
@ -39,6 +40,12 @@ namespace Nz
|
||||||
throw std::runtime_error("failed to instantiate render device");
|
throw std::runtime_error("failed to instantiate render device");
|
||||||
|
|
||||||
MaterialPipeline::Initialize();
|
MaterialPipeline::Initialize();
|
||||||
|
|
||||||
|
Nz::PredefinedViewerData viewerUboOffsets = Nz::PredefinedViewerData::GetOffsets();
|
||||||
|
|
||||||
|
m_viewerDataUBO = m_renderDevice->InstantiateBuffer(Nz::BufferType_Uniform);
|
||||||
|
if (!m_viewerDataUBO->Initialize(viewerUboOffsets.totalSize, Nz::BufferUsage_DeviceLocal | Nz::BufferUsage_Dynamic))
|
||||||
|
throw std::runtime_error("failed to initialize viewer data UBO");
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::~Graphics()
|
Graphics::~Graphics()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue