1#ifndef DIRECTX12CUBEMAPTEXTURE_HPP_
2#define DIRECTX12CUBEMAPTEXTURE_HPP_
10#include <wrl/client.h>
19class ENGINE_API DirectX12CubemapTexture :
public ::Sleak::Texture {
21 DirectX12CubemapTexture(ID3D12Device* device,
22 ID3D12CommandQueue* commandQueue);
23 ~DirectX12CubemapTexture()
override;
26 bool LoadCubemap(
const std::array<std::string, 6>& facePaths);
28 bool LoadEquirectangular(
const std::string& path, uint32_t faceSize = 512);
32 bool LoadFromMemory(
const void* data, uint32_t
width, uint32_t
height,
33 TextureFormat format)
override;
35 bool LoadFromFile(
const std::string& filePath)
override;
37 void Bind(uint32_t slot = 0)
const override;
38 void Unbind()
const override;
40 void SetFilter(TextureFilter filter)
override;
41 void SetWrapMode(TextureWrapMode wrapMode)
override;
43 uint32_t GetWidth()
const override {
return m_width; }
44 uint32_t GetHeight()
const override {
return m_height; }
45 TextureFormat GetFormat()
const override {
return TextureFormat::RGBA8; }
46 TextureType GetType()
const override {
return TextureType::TextureCube; }
48 ID3D12Resource* GetResource()
const {
return m_texture.Get(); }
51 void BindToCommandList(ID3D12GraphicsCommandList* cmdList,
52 UINT rootParameterIndex)
const;
55 void SetSharedSrvGPUHandle(D3D12_GPU_DESCRIPTOR_HANDLE handle) { m_srvGpuHandle = handle; m_usesSharedHeap =
true; }
57 void CreateSRVIntoHandle(D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle);
61 bool CreateCubemapFromFaces(
const std::vector<unsigned char*>& faceData,
66 ID3D12Device* m_device =
nullptr;
67 ID3D12CommandQueue* m_commandQueue =
nullptr;
69 Microsoft::WRL::ComPtr<ID3D12Resource> m_texture;
70 Microsoft::WRL::ComPtr<ID3D12Resource> m_uploadBuffer;
71 Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> m_srvHeap;
72 D3D12_GPU_DESCRIPTOR_HANDLE m_srvGpuHandle = {};
73 bool m_usesSharedHeap =
false;
76 uint32_t m_height = 0;
Backend-facing rendering layer shared by the four graphics backends.
Root namespace for everything the engine exposes.