ULRE/inc/hgl/graph/VKPrimitive.h

71 lines
1.6 KiB
C
Raw Normal View History

2022-06-24 17:51:39 +08:00
#ifndef HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
#define HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
#include<hgl/graph/VKIndexBuffer.h>
#include<hgl/type/Map.h>
#include<hgl/type/String.h>
#include<hgl/math/Math.h>
#include<hgl/graph/AABB.h>
#include<hgl/graph/VKVertexAttribBuffer.h>
2022-06-24 17:51:39 +08:00
VK_NAMESPACE_BEGIN
/**
*
*/
class Primitive
{
2023-10-12 05:55:39 +08:00
GPUDevice *device;
AnsiString prim_name;
VBOAccessMap buffer_list;
2022-06-24 17:51:39 +08:00
protected:
uint32_t vertex_count;
2022-06-24 17:51:39 +08:00
IndexBufferData index_buffer_data;
2022-06-24 17:51:39 +08:00
protected:
AABB BoundingBox;
protected:
friend class RenderableNode;
uint ref_count=0;
uint RefInc(){return ++ref_count;}
uint RefDec(){return --ref_count;}
public:
2023-10-12 05:55:39 +08:00
Primitive(GPUDevice *dev,const AnsiString &n,const uint32_t vc=0)
{
device=dev;
prim_name=n;
vertex_count=vc;
}
2022-06-24 17:51:39 +08:00
virtual ~Primitive()=default;
const uint GetRefCount()const{return ref_count;}
void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;}
2022-06-24 17:51:39 +08:00
const AABB & GetBoundingBox()const {return BoundingBox;}
bool Set(const AnsiString &name,VBO *vb,VkDeviceSize offset=0);
2022-06-24 17:51:39 +08:00
2023-10-12 05:55:39 +08:00
bool Set(IndexBuffer *ib,VkDeviceSize offset=0);
2022-06-24 17:51:39 +08:00
public:
const uint32_t GetVertexCount ()const {return vertex_count;}
2022-06-24 17:51:39 +08:00
bool GetVBOAccessData (const AnsiString &,VBOAccessData *);
const int GetBufferCount ()const {return buffer_list.GetCount();}
2022-06-24 17:51:39 +08:00
const IndexBufferData * GetIndexBufferData ()const {return &index_buffer_data;}
2022-06-24 17:51:39 +08:00
};//class Primitive
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE