Graphics: Add ModelInstance class
This commit is contained in:
43
include/Nazara/Graphics/ModelInstance.hpp
Normal file
43
include/Nazara/Graphics/ModelInstance.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_MODELINSTANCE_HPP
|
||||
#define NAZARA_MODELINSTANCE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#include <Nazara/Renderer/ShaderBinding.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class AbstractBuffer;
|
||||
class MaterialSettings;
|
||||
|
||||
class NAZARA_GRAPHICS_API ModelInstance
|
||||
{
|
||||
public:
|
||||
ModelInstance(const std::shared_ptr<const MaterialSettings>& settings);
|
||||
ModelInstance(const ModelInstance&) = delete;
|
||||
ModelInstance(ModelInstance&&) noexcept = default;
|
||||
~ModelInstance() = default;
|
||||
|
||||
inline std::shared_ptr<AbstractBuffer>& GetInstanceBuffer();
|
||||
inline const std::shared_ptr<AbstractBuffer>& GetInstanceBuffer() const;
|
||||
inline ShaderBinding& GetShaderBinding();
|
||||
|
||||
ModelInstance& operator=(const ModelInstance&) = delete;
|
||||
ModelInstance& operator=(ModelInstance&&) noexcept = default;
|
||||
|
||||
private:
|
||||
std::shared_ptr<AbstractBuffer> m_instanceDataBuffer;
|
||||
ShaderBindingPtr m_shaderBinding;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/ModelInstance.inl>
|
||||
|
||||
#endif // NAZARA_MODELINSTANCE_HPP
|
||||
26
include/Nazara/Graphics/ModelInstance.inl
Normal file
26
include/Nazara/Graphics/ModelInstance.inl
Normal file
@@ -0,0 +1,26 @@
|
||||
// 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/ModelInstance.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline std::shared_ptr<AbstractBuffer>& ModelInstance::GetInstanceBuffer()
|
||||
{
|
||||
return m_instanceDataBuffer;
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<AbstractBuffer>& ModelInstance::GetInstanceBuffer() const
|
||||
{
|
||||
return m_instanceDataBuffer;
|
||||
}
|
||||
|
||||
inline ShaderBinding& ModelInstance::GetShaderBinding()
|
||||
{
|
||||
return *m_shaderBinding;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user