Add initial support for texture views

This commit is contained in:
SirLynix
2022-11-30 18:45:07 +01:00
committed by Jérôme Leclercq
parent 902dee6121
commit 42f8cdb151
13 changed files with 239 additions and 78 deletions

View File

@@ -12,25 +12,31 @@
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Texture.hpp>
#include <Nazara/Renderer/Texture.hpp>
#include <optional>
namespace Nz
{
class NAZARA_OPENGLRENDERER_API OpenGLTexture : public Texture
{
public:
OpenGLTexture(OpenGLDevice& device, const TextureInfo& params);
OpenGLTexture(OpenGLDevice& device, const TextureInfo& textureInfo);
OpenGLTexture(std::shared_ptr<OpenGLTexture> parentTexture, const TextureViewInfo& viewInfo);
OpenGLTexture(const OpenGLTexture&) = delete;
OpenGLTexture(OpenGLTexture&&) = delete;
~OpenGLTexture() = default;
bool Copy(const Texture& source, const Boxui& srcBox, const Vector3ui& dstPos) override;
std::shared_ptr<Texture> CreateView(const TextureViewInfo& viewInfo) override;
PixelFormat GetFormat() const override;
UInt8 GetLevelCount() const override;
OpenGLTexture* GetParentTexture() const override;
Vector3ui GetSize(UInt8 level = 0) const override;
inline const GL::Texture& GetTexture() const;
ImageType GetType() const override;
inline bool RequireTextureViewEmulation() const;
using Texture::Update;
bool Update(const void* ptr, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
@@ -42,8 +48,10 @@ namespace Nz
static inline GL::TextureTarget ToTextureTarget(ImageType imageType);
private:
std::optional<TextureViewInfo> m_viewInfo;
std::shared_ptr<OpenGLTexture> m_parentTexture;
GL::Texture m_texture;
TextureInfo m_params;
TextureInfo m_textureInfo;
};
}