Files
HelloVulkan/Engine/include/Engine/Vulkan/Texture.h
T

57 lines
1.2 KiB
C++

//
// Created by atdunbg on 2026/9/20.
//
#ifndef HELLOVULKAN_TEXTURE_H
#define HELLOVULKAN_TEXTURE_H
#pragma once
#include <Engine/Core/Types.h>
#include <vulkan/vulkan.hpp>
#include <string>
#include "MemoryAllocator.h"
namespace Engine {
class Device;
class MemoryAllocator;
class Texture {
public:
Texture(Device& device, MemoryAllocator& allocator, const std::string& path);
~Texture();
Texture(const Texture&) = delete;
Texture& operator=(const Texture&) = delete;
vk::Image Get() const { return m_Image; }
vk::ImageView GetView() const { return m_View; }
u32 GetWidth() const { return m_Width; }
u32 GetHeight() const { return m_Height; }
vk::Sampler GetSampler() const { return m_Sampler; }
private:
Device& m_Device;
vk::Image m_Image;
vk::ImageView m_View;
vk::DeviceMemory m_Memory;
vk::Sampler m_Sampler;
u32 m_Width = 0;
u32 m_Height = 0;
u64 m_TextureBytes = 0;
MemoryAllocator::Allocation m_ImageAllocation;
MemoryAllocator& m_Allocator;
};
} // namespace Engine
#endif //HELLOVULKAN_TEXTURE_H