few codes about TextureManager
This commit is contained in:
@@ -36,6 +36,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
~DebugUtils()=default;
|
||||
|
||||
void SetName(VkObjectType,uint64_t,const char *);
|
||||
|
@@ -102,7 +102,6 @@ public: //添加数据到管理器(如果指针为nullptr会返回-1)
|
||||
PrimitiveID Add(Primitive * p ){return rm_primitives.Add(p);}
|
||||
BufferID Add(DeviceBuffer * buf ){return rm_buffers.Add(buf);}
|
||||
SamplerID Add(Sampler * s ){return rm_samplers.Add(s);}
|
||||
// TextureID Add(Texture * t ){return rm_textures.Add(t);}
|
||||
RenderableID Add(Renderable * r ){return rm_renderables.Add(r);}
|
||||
StaticMeshID Add(StaticMesh * sm ){return rm_static_mesh.Add(sm);}
|
||||
|
||||
@@ -164,7 +163,6 @@ public: //Get
|
||||
Primitive * GetPrimitive (const PrimitiveID &id){return rm_primitives.Get(id);}
|
||||
DeviceBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
||||
Sampler * GetSampler (const SamplerID &id){return rm_samplers.Get(id);}
|
||||
// Texture * GetTexture (const TextureID &id){return rm_textures.Get(id);}
|
||||
Renderable * GetRenderable (const RenderableID &id){return rm_renderables.Get(id);}
|
||||
|
||||
StaticMesh * GetStaticMesh (const StaticMeshID &id){return rm_static_mesh.Get(id);}
|
||||
@@ -177,7 +175,6 @@ public: //Release
|
||||
void Release(Primitive * p ){rm_primitives.Release(p);}
|
||||
void Release(DeviceBuffer * buf ){rm_buffers.Release(buf);}
|
||||
void Release(Sampler * s ){rm_samplers.Release(s);}
|
||||
// void Release(Texture * t ){rm_textures.Release(t);}
|
||||
void Release(Renderable * r ){rm_renderables.Release(r);}
|
||||
|
||||
void Release(StaticMesh * sm ){rm_static_mesh.Release(sm);}
|
||||
|
@@ -11,11 +11,14 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
BitmapData *LoadBitmapFromFile(const OSString &filename);
|
||||
|
||||
using TextureID=int;
|
||||
|
||||
class Texture
|
||||
{
|
||||
protected:
|
||||
|
||||
TextureManager *manager;
|
||||
TextureID texture_id;
|
||||
|
||||
VkDevice device;
|
||||
TextureData *data;
|
||||
@@ -23,6 +26,7 @@ protected:
|
||||
public:
|
||||
|
||||
TextureManager * GetManager () {return manager;}
|
||||
const TextureID GetID ()const noexcept {return texture_id;}
|
||||
|
||||
TextureData * GetData () {return data;}
|
||||
|
||||
@@ -44,9 +48,10 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
Texture(TextureManager *tm,TextureData *td)
|
||||
Texture(TextureManager *tm,const TextureID &id,TextureData *td)
|
||||
{
|
||||
manager=tm;
|
||||
texture_id=id;
|
||||
data=td;
|
||||
}
|
||||
|
||||
|
@@ -17,10 +17,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
GraphManager(GPUDevice *dev)
|
||||
{
|
||||
device=dev;
|
||||
}
|
||||
GraphManager(GPUDevice *dev){device=dev;}
|
||||
virtual ~GraphManager()=default;
|
||||
};//class GraphManager
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -6,26 +6,38 @@
|
||||
#include<hgl/type/RectScope.h>
|
||||
#include<hgl/type/object/ObjectBaseInfo.h>
|
||||
#include<hgl/graph/ImageRegion.h>
|
||||
#include<hgl/graph/VKTexture.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
using TextureID =int;
|
||||
|
||||
class TextureManager:public GraphManager
|
||||
{
|
||||
DeviceQueue *texture_queue;
|
||||
TextureCmdBuffer *texture_cmd_buf;
|
||||
|
||||
private:
|
||||
|
||||
TextureID texture_serial;
|
||||
|
||||
const TextureID AcquireID(){return texture_serial++;} ///<取得一个新的纹理ID
|
||||
|
||||
private:
|
||||
|
||||
SortedSet<VkImage> image_set;
|
||||
SortedSet<Texture *> texture_set; ///<纹理合集
|
||||
|
||||
Map<TextureID,Texture *> texture_by_id;
|
||||
|
||||
Map<OSString,Texture *> texture_by_name;
|
||||
|
||||
private:
|
||||
|
||||
DeviceQueue *texture_queue;
|
||||
TextureCmdBuffer *texture_cmd_buf;
|
||||
const TextureID Add(Texture *);
|
||||
const TextureID Add(Texture *,const OSString &);
|
||||
|
||||
public:
|
||||
|
||||
TextureManager();
|
||||
TextureManager(GPUDevice *);
|
||||
virtual ~TextureManager();
|
||||
|
||||
public: //Buffer
|
||||
|
Reference in New Issue
Block a user