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>
|
|
|
|
|
#include<hgl/math/Math.h>
|
2024-04-26 01:17:47 +08:00
|
|
|
|
#include<hgl/graph/VKPrimitiveData.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;
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
friend class RenderableNode;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2023-05-05 21:12:53 +08:00
|
|
|
|
void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;}
|
2022-06-24 17:51:39 +08:00
|
|
|
|
const AABB & GetBoundingBox()const {return BoundingBox;}
|
|
|
|
|
|
2024-04-27 01:07:44 +08:00
|
|
|
|
bool SetVAB(const AnsiString &name,VAB *vb,VkDeviceSize start=0);
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
2024-04-27 01:07:44 +08:00
|
|
|
|
bool SetIndex(IndexBuffer *ib,VkDeviceSize start,const VkDeviceSize index_count);
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2024-04-27 01:07:44 +08:00
|
|
|
|
const VkDeviceSize GetVertexCount ()const {return vertex_count;}
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
2024-04-24 01:44:01 +08:00
|
|
|
|
bool GetVABAccess (const AnsiString &,VABAccess *);
|
2023-05-05 21:12:53 +08:00
|
|
|
|
const int GetBufferCount ()const {return buffer_list.GetCount();}
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
2024-04-27 01:13:12 +08:00
|
|
|
|
const IBAccess * GetIBAccess ()const {return ib_access.buffer?&ib_access:nullptr;}
|
2022-06-24 17:51:39 +08:00
|
|
|
|
};//class Primitive
|
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
|