From 6dba761a8017c277c66a3ecc21c6d3c78bf52f5f Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 26 Apr 2024 01:17:47 +0800 Subject: [PATCH] added VKPrimitiveData.h --- inc/hgl/graph/VKPrimitive.h | 25 +------------------------ inc/hgl/graph/VKPrimitiveData.h | 22 ++++++++++++++++++++++ src/SceneGraph/CMakeLists.txt | 19 ++++++++++++------- src/SceneGraph/PrimitiveCreater.cpp | 2 +- 4 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 inc/hgl/graph/VKPrimitiveData.h diff --git a/inc/hgl/graph/VKPrimitive.h b/inc/hgl/graph/VKPrimitive.h index 3c5041e1..5061f406 100644 --- a/inc/hgl/graph/VKPrimitive.h +++ b/inc/hgl/graph/VKPrimitive.h @@ -1,27 +1,11 @@ #ifndef HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE #define HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE -#include #include #include #include -#include -#include +#include VK_NAMESPACE_BEGIN - -struct PrimitiveData -{ - uint32_t vertex_count; - - uint32_t va_count; - - VABAccess *vab_list; - - IndexBufferAccess ib_access; - - AABB BoundingBox; -}; - /** * 单一图元数据 */ @@ -44,11 +28,6 @@ protected: friend class RenderableNode; - uint ref_count=0; - - uint RefInc(){return ++ref_count;} - uint RefDec(){return --ref_count;} - public: Primitive(GPUDevice *dev,const AnsiString &n,const uint32_t vc=0) @@ -60,8 +39,6 @@ public: virtual ~Primitive()=default; - const uint GetRefCount()const{return ref_count;} - void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;} const AABB & GetBoundingBox()const {return BoundingBox;} diff --git a/inc/hgl/graph/VKPrimitiveData.h b/inc/hgl/graph/VKPrimitiveData.h new file mode 100644 index 00000000..38b31008 --- /dev/null +++ b/inc/hgl/graph/VKPrimitiveData.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +VK_NAMESPACE_BEGIN + +struct PrimitiveData +{ + uint32_t vertex_count; + + uint32_t va_count; + + VABAccess *vab_list; + + IndexBufferAccess ib_access; + + AABB BoundingBox; +}; + +VK_NAMESPACE_END diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index db3a82c0..8657f669 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -13,6 +13,15 @@ SET(SG_VDM_SOURCE ${SG_INCLUDE_PATH}/VertexAttribDataAccess.h SOURCE_GROUP("VertexDataManager" FILES ${SG_VDM_SOURCE}) +SET(SG_PRIMITIVE_SOURCE ${SG_INCLUDE_PATH}/VKPrimitiveData.h + ${SG_INCLUDE_PATH}/VKPrimitive.h + Vulkan/VKPrimitive.cpp + ${SG_INCLUDE_PATH}/VKRenderablePrimitiveCreater.h + ${SG_INCLUDE_PATH}/PrimitiveCreater.h + PrimitiveCreater.cpp) + +SOURCE_GROUP("Primitive" FILES ${SG_PRIMITIVE_SOURCE}) + SET(TILE_SOURCE ${SG_INCLUDE_PATH}/TileData.h TileData.cpp) @@ -22,9 +31,7 @@ SET(GEOMETRY_FILES ${SG_INCLUDE_PATH}/InlineGeometry.h #${SG_INCLUDE_PATH}/Mesh.h #${SG_INCLUDE_PATH}/Spline.h InlineGeometry.cpp - #Mesh.cpp - ${SG_INCLUDE_PATH}/PrimitiveCreater.h - PrimitiveCreater.cpp + #Mesh.cpp ) SOURCE_GROUP("Geometry" FILES ${GEOMETRY_FILES}) @@ -86,7 +93,6 @@ IF(WIN32) ENDIF(WIN32) SET(VK_RR_SOURCE ${SG_INCLUDE_PATH}/VKRenderResource.h - ${SG_INCLUDE_PATH}/VKRenderablePrimitiveCreater.h Vulkan/VKRenderResource.cpp Vulkan/VKRenderResourceMaterial.cpp) @@ -235,9 +241,7 @@ SET(VK_CMD_BUFFER_SOURCE ${SG_INCLUDE_PATH}/VKCommandBuffer.h SOURCE_GROUP("Vulkan\\Command Buffer" FILES ${VK_CMD_BUFFER_SOURCE}) -SET(VK_RENDERABLE_SOURCE ${SG_INCLUDE_PATH}/VKPrimitive.h - ${SG_INCLUDE_PATH}/VKRenderable.h - Vulkan/VKPrimitive.cpp +SET(VK_RENDERABLE_SOURCE ${SG_INCLUDE_PATH}/VKRenderable.h Vulkan/VKRenderable.cpp Vulkan/VKTileData.cpp Vulkan/VKTileFont.cpp) @@ -297,6 +301,7 @@ SET(VULKAN_RENDER_SOURCE ${VK_RR_SOURCE} add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER} ${SCENE_GRAPH_SOURCE} + ${SG_PRIMITIVE_SOURCE} ${GEOMETRY_FILES} ${LIGHT_FILES} diff --git a/src/SceneGraph/PrimitiveCreater.cpp b/src/SceneGraph/PrimitiveCreater.cpp index 208545ba..8c39d615 100644 --- a/src/SceneGraph/PrimitiveCreater.cpp +++ b/src/SceneGraph/PrimitiveCreater.cpp @@ -136,7 +136,7 @@ namespace hgl if(vbo_map.GetCount()>0) { const auto *sp=vbo_map.GetDataList(); - for(uint i=0;ivalue.vab) {