From ada6a41fc6ce0ab827fcf7588281c25a0b7498a6 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 18 Mar 2025 01:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E7=AB=8BComponent,=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=E5=85=88=E5=B0=86Renderable=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=88=B0=E8=BF=99=E4=B8=8A=E9=9D=A2=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/component/Component.h | 21 +++++++++++++++++++++ inc/hgl/component/PrimitiveComponent.h | 0 inc/hgl/component/RenderComponent.h | 19 +++++++++++++++++++ inc/hgl/graph/SceneNode.h | 4 ++-- inc/hgl/graph/SceneWorld.h | 17 +++++++++++++---- src/SceneGraph/CMakeLists.txt | 10 ++++++++++ 6 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 inc/hgl/component/Component.h create mode 100644 inc/hgl/component/PrimitiveComponent.h create mode 100644 inc/hgl/component/RenderComponent.h diff --git a/inc/hgl/component/Component.h b/inc/hgl/component/Component.h new file mode 100644 index 00000000..847a83d9 --- /dev/null +++ b/inc/hgl/component/Component.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +namespace hgl::graph +{ + /** + * 基础组件
+ * 是一切组件的基类 + */ + class BaseComponent + { + public: + + virtual ~BaseComponent()=default; + + public: //序列化 + + + };//class BaseComponent +}//namespace hgl::graph diff --git a/inc/hgl/component/PrimitiveComponent.h b/inc/hgl/component/PrimitiveComponent.h new file mode 100644 index 00000000..e69de29b diff --git a/inc/hgl/component/RenderComponent.h b/inc/hgl/component/RenderComponent.h new file mode 100644 index 00000000..70cb9902 --- /dev/null +++ b/inc/hgl/component/RenderComponent.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +namespace hgl::graph +{ + /** + * 可渲染组件 + */ + class RenderComponent: public BaseComponent + { + public: + + RenderComponent()=default; + virtual ~RenderComponent()=default; + + virtual void Render()=0; + };//class RenderComponent +}//namespace hgl::graph diff --git a/inc/hgl/graph/SceneNode.h b/inc/hgl/graph/SceneNode.h index 78ff1fbf..358cbedb 100644 --- a/inc/hgl/graph/SceneNode.h +++ b/inc/hgl/graph/SceneNode.h @@ -34,14 +34,14 @@ namespace hgl protected: - ObjectList ChildNode; ///<子节点 + ObjectList ChildNode; ///<子节点 public: const SceneNodeID & GetNodeID ()const { return NodeID; } ///<取得节点ID const SceneNodeName & GetNodeName ()const { return NodeName; } ///<取得节点名称 - const ObjectList &GetChildNode()const { return ChildNode; } ///<取得子节点列表 + const ObjectList &GetChildNode()const { return ChildNode; } ///<取得子节点列表 public: diff --git a/inc/hgl/graph/SceneWorld.h b/inc/hgl/graph/SceneWorld.h index 092d2489..f78f4237 100644 --- a/inc/hgl/graph/SceneWorld.h +++ b/inc/hgl/graph/SceneWorld.h @@ -5,17 +5,26 @@ namespace hgl { namespace graph { + class CameraData + { + }; + + class CameraManager + { + public: + }; + /** - * 场景管理器
- * 管理一个场景中的所有资源与场景节点 + * 世界场景管理器
+ * 管理一个世界场景中的所有资源与场景节点 */ class SceneWorld { - SceneNode *root_node; + SceneNode *root_node; ///<世界根节点 public: - + public: diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index d19fe778..d288cc31 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -296,6 +296,14 @@ SET(VK_RENDERABLE_SOURCE ${SG_INCLUDE_PATH}/VKRenderable.h SOURCE_GROUP("Vulkan\\Renderable" FILES ${VK_RENDERABLE_SOURCE}) +set(COMPONENT_INCLUDE_PATH ${ROOT_INCLUDE_PATH}/hgl/component) + +SET(COMPONENT_FILES ${COMPONENT_INCLUDE_PATH}/Component.h + ${COMPONENT_INCLUDE_PATH}/RenderComponent.h + ${COMPONENT_INCLUDE_PATH}/PrimitiveComponent.h) + +SOURCE_GROUP("Component" FILES ${COMPONENT_FILES}) + IF(WIN32) OPTION(FORCE_DISCETE_GPU "Force Discrete GPU" OFF) @@ -374,6 +382,8 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_FILES} ${STATIC_MESH_HEADER_FILES} ${STATIC_MESH_SOURCE_FILES} + ${COMPONENT_FILES} + # ${FONT_MANAGE_SOURCE} # ${FONT_SOURCE} # ${FONT_SOURCE_OS}