[very strong] deleted class VertexAttribData
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include<hgl/graph/VKRenderResource.h>
|
||||
#include<hgl/graph/VertexAttribDataAccess.h>
|
||||
#include<hgl/graph/VKShaderModule.h>
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
@@ -16,16 +17,9 @@ namespace hgl
|
||||
struct PrimitiveVertexBuffer
|
||||
{
|
||||
AnsiString name;
|
||||
uint binding;
|
||||
VAD * vad =nullptr;
|
||||
VBO * vbo =nullptr;
|
||||
|
||||
public:
|
||||
|
||||
~PrimitiveVertexBuffer()
|
||||
{
|
||||
SAFE_CLEAR(vad);
|
||||
}
|
||||
int binding;
|
||||
VBO * vbo;
|
||||
void * map_data;
|
||||
};//struct PrimitiveVertexBuffer
|
||||
|
||||
using PVBMap=ObjectMap<AnsiString,PrimitiveVertexBuffer>;
|
||||
@@ -45,7 +39,9 @@ namespace hgl
|
||||
|
||||
protected:
|
||||
|
||||
VAD * CreateVAD(const AnsiString &name); ///<创建一个顶点属性缓冲区
|
||||
PrimitiveVertexBuffer *CreatePVB(const AnsiString &,const void *data); ///<创建一个顶点属性数据区
|
||||
|
||||
void ClearAllData();
|
||||
|
||||
public:
|
||||
|
||||
@@ -62,12 +58,12 @@ namespace hgl
|
||||
if(format!=T::GetVulkanFormat())
|
||||
return(nullptr);
|
||||
|
||||
VAD *vad=this->CreateVAD(name);
|
||||
PrimitiveVertexBuffer *pvb=this->CreatePVB(name,nullptr);
|
||||
|
||||
if(!vad)
|
||||
if(!pvb)
|
||||
return(nullptr);
|
||||
|
||||
T *access=T::Create(vad);
|
||||
T *access=T::Create(vertices_number,pvb->map_data);
|
||||
|
||||
access->Begin();
|
||||
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include<hgl/graph/VKDeviceAttribute.h>
|
||||
#include<hgl/graph/VKSwapchain.h>
|
||||
#include<hgl/graph/VKRenderTarget.h>
|
||||
#include<hgl/graph/VertexAttribData.h>
|
||||
#include<hgl/graph/VKShaderModuleMap.h>
|
||||
#include<hgl/graph/VKArrayBuffer.h>
|
||||
#include<hgl/graph/VKDescriptorSetType.h>
|
||||
@@ -117,7 +116,6 @@ public: //Buffer相关
|
||||
|
||||
VBO * CreateVBO (VkFormat format, uint32_t count,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
VBO * CreateVBO (VkFormat format, uint32_t count, SharingMode sm=SharingMode::Exclusive){return CreateVBO(format,count,nullptr,sm);}
|
||||
VBO * CreateVBO (const VAD *vad, SharingMode sm=SharingMode::Exclusive){return CreateVBO(vad->GetFormat(),vad->GetCount(),vad->GetData(),sm);}
|
||||
|
||||
IndexBuffer * CreateIBO (IndexType type, uint32_t count,const void * data, SharingMode sm=SharingMode::Exclusive);
|
||||
IndexBuffer * CreateIBO8 ( uint32_t count,const void * data, SharingMode sm=SharingMode::Exclusive){return CreateIBO(IndexType::U8, count,(void *)data,sm);}
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include<hgl/graph/VKTexture.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VertexAttribData.h>
|
||||
#include<hgl/graph/VKRenderable.h>
|
||||
#include<hgl/graph/font/TextPrimitive.h>
|
||||
#include<hgl/type/ObjectManage.h>
|
||||
@@ -106,7 +105,6 @@ public: // VBO/VAO
|
||||
|
||||
VBO *CreateVBO(VkFormat format,uint32_t count,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
VBO *CreateVBO(VkFormat format,uint32_t count, SharingMode sm=SharingMode::Exclusive){return CreateVBO(format, count, nullptr, sm);}
|
||||
VBO *CreateVBO(const VAD *vad, SharingMode sm=SharingMode::Exclusive){return CreateVBO(vad->GetFormat(), vad->GetCount(),vad->GetData(), sm);}
|
||||
|
||||
#define SCENE_DB_CREATE_FUNC(name) DeviceBuffer *Create##name(const AnsiString &buf_name,VkDeviceSize size,void *data,SharingMode sm=SharingMode::Exclusive); \
|
||||
DeviceBuffer *Create##name(const AnsiString &buf_name,VkDeviceSize size,SharingMode sm=SharingMode::Exclusive){return Create##name(buf_name,size,nullptr,sm);}
|
||||
|
@@ -1,49 +0,0 @@
|
||||
#ifndef HGL_GRAPH_VERTEX_ATTRIB_DATA_INCLUDE
|
||||
#define HGL_GRAPH_VERTEX_ATTRIB_DATA_INCLUDE
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
/**
|
||||
* 顶点属性数据
|
||||
*/
|
||||
class VertexAttribData ///顶点属性数据
|
||||
{
|
||||
void *mem_data; ///<内存中的数据
|
||||
|
||||
protected:
|
||||
|
||||
VkFormat format;
|
||||
|
||||
uint32_t count; ///<数据个数
|
||||
uint32_t total_bytes; ///<字节数
|
||||
|
||||
public:
|
||||
|
||||
VertexAttribData(uint32_t c,const VkFormat vf,const uint32_t t)
|
||||
{
|
||||
count=c;
|
||||
format=vf;
|
||||
total_bytes=t;
|
||||
|
||||
mem_data = hgl_malloc(total_bytes); //在很多情况下,hgl_malloc分配的内存是对齐的,这样有效率上的提升
|
||||
}
|
||||
|
||||
virtual ~VertexAttribData()
|
||||
{
|
||||
if(mem_data)
|
||||
hgl_free(mem_data);
|
||||
}
|
||||
|
||||
const VkFormat GetFormat ()const{return format;} ///<取得数据类型
|
||||
const uint32_t GetCount ()const{return count;} ///<取得数据数量
|
||||
void * GetData ()const{return mem_data;} ///<取得数据指针
|
||||
const uint32_t GetTotalBytes ()const{return total_bytes;} ///<取得数据字节数
|
||||
};//class VertexAttribData
|
||||
|
||||
using VAD=VertexAttribData;
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VERTEX_ATTRIB_DATA_INCLUDE
|
@@ -5,7 +5,6 @@
|
||||
#include<hgl/color/Color4f.h>
|
||||
#include<hgl/type/RectScope.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/graph/VertexAttribData.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
namespace hgl
|
||||
{
|
||||
@@ -130,14 +129,9 @@ namespace hgl
|
||||
|
||||
static VkFormat GetVulkanFormat(){return VKFMT;}
|
||||
|
||||
static VertexAttribDataAccess1<T,VKFMT> * Create(VAD *vad)
|
||||
static VertexAttribDataAccess1<T,VKFMT> * Create(const VkDeviceSize vertices_number,void *vbo_data)
|
||||
{
|
||||
if(!vad)return(nullptr);
|
||||
|
||||
if(vad->GetFormat()!=VKFMT)
|
||||
return(nullptr);
|
||||
|
||||
return(new VertexAttribDataAccess1<T,VKFMT>(vad->GetCount(),(T *)vad->GetData()));
|
||||
return(new VertexAttribDataAccess1<T,VKFMT>(vertices_number,(T *)vbo_data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,14 +217,9 @@ namespace hgl
|
||||
|
||||
static VkFormat GetVulkanFormat(){return VKFMT;}
|
||||
|
||||
static VertexAttribDataAccess2<T,VKFMT> * Create(VAD *vad)
|
||||
static VertexAttribDataAccess2<T,VKFMT> * Create(const VkDeviceSize vertices_number,void *vbo_data)
|
||||
{
|
||||
if(!vad)return(nullptr);
|
||||
|
||||
if(vad->GetFormat()!=VKFMT)
|
||||
return(nullptr);
|
||||
|
||||
return(new VertexAttribDataAccess2<T,VKFMT>(vad->GetCount(),(T *)vad->GetData()));
|
||||
return(new VertexAttribDataAccess2<T,VKFMT>(vertices_number,(T *)vbo_data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,14 +528,9 @@ namespace hgl
|
||||
|
||||
static VkFormat GetVulkanFormat(){return VKFMT;}
|
||||
|
||||
static VertexAttribDataAccess3<T,VKFMT> * Create(VAD *vad)
|
||||
static VertexAttribDataAccess3<T,VKFMT> * Create(const VkDeviceSize vertices_number,void *vbo_data)
|
||||
{
|
||||
if(!vad)return(nullptr);
|
||||
|
||||
if(vad->GetFormat()!=VKFMT)
|
||||
return(nullptr);
|
||||
|
||||
return(new VertexAttribDataAccess3<T,VKFMT>(vad->GetCount(),(T *)vad->GetData()));
|
||||
return(new VertexAttribDataAccess3<T,VKFMT>(vertices_number,(T *)vbo_data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -811,14 +795,9 @@ namespace hgl
|
||||
|
||||
static VkFormat GetVulkanFormat(){return VKFMT;}
|
||||
|
||||
static VertexAttribDataAccess4<T,VKFMT> * Create(VAD *vad)
|
||||
static VertexAttribDataAccess4<T,VKFMT> * Create(const VkDeviceSize vertices_number,void *vbo_data)
|
||||
{
|
||||
if(!vad)return(nullptr);
|
||||
|
||||
if(vad->GetFormat()!=VKFMT)
|
||||
return(nullptr);
|
||||
|
||||
return(new VertexAttribDataAccess4<T,VKFMT>(vad->GetCount(),(T *)vad->GetData()));
|
||||
return(new VertexAttribDataAccess4<T,VKFMT>(vertices_number,(T *)vbo_data));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user