2022-06-24 17:51:39 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
|
|
|
|
|
|
|
|
|
|
#include<hgl/type/Map.h>
|
|
|
|
|
#include<hgl/type/String.h>
|
2024-04-27 03:09:16 +08:00
|
|
|
|
#include<hgl/graph/AABB.h>
|
|
|
|
|
#include<hgl/graph/VK.h>
|
|
|
|
|
|
2022-06-24 17:51:39 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2024-04-27 03:09:16 +08:00
|
|
|
|
|
2022-06-24 17:51:39 +08:00
|
|
|
|
/**
|
|
|
|
|
* 单一图元数据
|
|
|
|
|
*/
|
|
|
|
|
class Primitive
|
|
|
|
|
{
|
2023-10-12 05:55:39 +08:00
|
|
|
|
GPUDevice *device;
|
|
|
|
|
AnsiString prim_name;
|
|
|
|
|
|
2022-06-24 17:51:39 +08:00
|
|
|
|
protected:
|
|
|
|
|
|
2024-04-27 01:07:44 +08:00
|
|
|
|
VkDeviceSize vertex_count;
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
2024-04-24 01:38:55 +08:00
|
|
|
|
VABAccessMap buffer_list;
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
2024-04-27 00:05:25 +08:00
|
|
|
|
IBAccess ib_access;
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
|
|
|
|
AABB BoundingBox;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2024-04-27 03:09:16 +08:00
|
|
|
|
bool SetVAB(const AnsiString &name,VAB *vb,VkDeviceSize start=0);
|
|
|
|
|
|
|
|
|
|
bool SetIndex(IndexBuffer *ib,VkDeviceSize start,const VkDeviceSize index_count);
|
|
|
|
|
|
|
|
|
|
void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;}
|
|
|
|
|
|
|
|
|
|
friend class PrimitiveCreater;
|
|
|
|
|
friend class RenderablePrimitiveCreater;
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2024-04-27 01:07:44 +08:00
|
|
|
|
Primitive(GPUDevice *dev,const AnsiString &n,const VkDeviceSize vc=0)
|
2023-10-12 05:55:39 +08:00
|
|
|
|
{
|
|
|
|
|
device=dev;
|
|
|
|
|
prim_name=n;
|
|
|
|
|
vertex_count=vc;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-24 17:51:39 +08:00
|
|
|
|
virtual ~Primitive()=default;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2024-04-27 03:09:16 +08:00
|
|
|
|
const VkDeviceSize GetVertexCount ()const{return vertex_count;}
|
|
|
|
|
const int GetVACount ()const{return buffer_list.GetCount();}
|
|
|
|
|
const bool GetVABAccess (const AnsiString &,VABAccess *);
|
|
|
|
|
const IBAccess * GetIBAccess ()const{return ib_access.buffer?&ib_access:nullptr;}
|
2024-04-27 02:19:01 +08:00
|
|
|
|
|
2024-04-27 03:09:16 +08:00
|
|
|
|
const AABB & GetBoundingBox ()const{return BoundingBox;}
|
2022-06-24 17:51:39 +08:00
|
|
|
|
};//class Primitive
|
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
|