added little codes of texture 2d array, but can't run.

This commit is contained in:
2023-09-25 16:38:02 +08:00
parent f901708b6c
commit 5230fbc27f
9 changed files with 53 additions and 13 deletions

View File

@@ -0,0 +1,27 @@
#include"VKTextureLoader.h"
#include<hgl/io/FileInputStream.h>
#include<hgl/log/LogInfo.h>
VK_NAMESPACE_BEGIN
template<> void VkTextureLoader<Texture2DArray,Texture2DArrayLoader>::OnExtent(VkExtent3D &extent)
{
extent.width =file_header.width;
extent.height =file_header.height;
extent.depth =file_header.layers;
}
template<> Texture2DArray *VkTextureLoader<Texture2DArray,Texture2DArrayLoader>::OnCreateTexture(TextureCreateInfo *tci)
{
return device->CreateTexture2DArray(tci);
}
Texture2DArray *CreateTexture2DArrayFromFile(GPUDevice *device,const OSString &filename,bool auto_mipmaps)
{
VkTextureLoader<Texture2DArray,Texture2DArrayLoader> loader(device,auto_mipmaps);
if(!loader.Load(filename))
return(nullptr);
return loader.GetTexture();
}
VK_NAMESPACE_END