renamed to CreateTexture from GetTexture in TextureLoader<>

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-09-25 19:49:06 +08:00
parent 7d9192051a
commit 65c3d5cad1
6 changed files with 17 additions and 11 deletions

View File

@ -21,7 +21,7 @@ namespace hgl
~Bitmap2DLoader();
void *OnBegin(uint32 total_bytes) override;
void OnEnd() override {}
bool OnEnd() override {return(false);}
BitmapData *GetBitmap();
};//class Bitmap2DLoader

View File

@ -86,7 +86,7 @@ namespace hgl
protected:
virtual void *OnBegin(uint32)=0;
virtual void OnEnd()=0;
virtual bool OnEnd()=0;
virtual void OnError(){}
public:

View File

@ -22,6 +22,6 @@ Texture2DArray *CreateTexture2DArrayFromFile(GPUDevice *device,const OSString &f
if(!loader.Load(filename))
return(nullptr);
return loader.GetTexture();
return loader.CreateTexture();
}
VK_NAMESPACE_END

View File

@ -22,6 +22,6 @@ Texture2D *CreateTexture2DFromFile(GPUDevice *device,const OSString &filename,bo
if(!loader.Load(filename))
return(nullptr);
return loader.GetTexture();
return loader.CreateTexture();
}
VK_NAMESPACE_END

View File

@ -22,6 +22,6 @@ TextureCube *CreateTextureCubeFromFile(GPUDevice *device,const OSString &filenam
if(!loader.Load(filename))
return(nullptr);
return loader.GetTexture();
return loader.CreateTexture();
}
VK_NAMESPACE_END

View File

@ -48,12 +48,19 @@ public:
}
void OnExtent(VkExtent3D &extent);
T *OnCreateTexture(TextureCreateInfo *);
void OnEnd() override
bool OnEnd() override
{
if(!buf)return(false);
buf->Unmap();
return(true);
}
T *CreateTexture()
{
TextureCreateInfo *tci=new TextureCreateInfo(format);
VkExtent3D extent;
@ -82,12 +89,11 @@ public:
SAFE_CLEAR(tex);
tex=OnCreateTexture(tci);
if(tex)
buf=nullptr;
}
if(!tex)
return nullptr;
buf=nullptr;
T *GetTexture()
{
T *result=tex;
tex=nullptr;
return result;