diff --git a/inc/hgl/graph/Component.h b/inc/hgl/graph/Component.h index 589abdbf..a29a9917 100644 --- a/inc/hgl/graph/Component.h +++ b/inc/hgl/graph/Component.h @@ -15,25 +15,47 @@ class ComponentManager; class Component { + ComponentData *data; + + SceneNode *owner_node; + ComponentManager *manager; - SceneNode *owner; - -public: - - ComponentManager *GetManager()const{return manager;} - - SceneNode *GetOwner()const{return owner;} - - virtual const size_t GetTypeHash()=0; +public: + + virtual const size_t GetTypeHash()=0; ///<取得当前组件类型 + + SceneNode *GetOwnerNode()const{return owner_node;} ///<取得当前组件所属节点 + + ComponentManager *GetManager()const{return manager;} ///<取得当前组件所属管理器 public: + Component() + { + data=nullptr; + owner_node=nullptr; + manager=nullptr; + } + Component(SceneNode *sn,ComponentData *cd,ComponentManager *cm); + virtual ~Component()=default; + virtual void Update(const double delta_time){}; ///<更新组件 };//class Component class ComponentManager { + ObjectList component_list; + +public: + + virtual void Update(const double delta_time) + { + for(Component *c:component_list) + { + c->Update(delta_time); + } + } };//class ComponentManager VK_NAMESPACE_END diff --git a/inc/hgl/graph/component/StaticMeshComponent.h b/inc/hgl/graph/component/StaticMeshComponent.h new file mode 100644 index 00000000..ce35545f --- /dev/null +++ b/inc/hgl/graph/component/StaticMeshComponent.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include + +VK_NAMESPACE_BEGIN + +class StaticMeshComponentData:public ComponentData +{ + StaticMesh *static_mesh; +};//class StaticMeshComponentData:public ComponentData + +class StaticMeshComponent:public Component +{ + + +};//class StaticMeshComponent:public Component + +VK_NAMESPACE_END diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index 32cd2e4b..52b5a7fe 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -266,9 +266,13 @@ SOURCE_GROUP("Vulkan\\Renderable" FILES ${VK_RENDERABLE_SOURCE}) SET(SGC_HEADER_PATH ${SG_INCLUDE_PATH}/component) SET(SGC_SOURCE_PATH component) -SET(SG_COMPONENT_HEADER ${SG_INCLUDE_PATH}/Component.h) +SET(SG_COMPONENT_HEADER ${SG_INCLUDE_PATH}/Component.h + ${SGC_HEADER_PATH}/StaticMeshComponent.h) -SOURCE_GROUP("Scene Graph\\Component" FILES ${SG_COMPONENT_HEADER}) +SET(SG_COMPONENT_SOURCE ${SGC_SOURCE_PATH}/Component.cpp + ${SGC_SOURCE_PATH}/StaticMeshComponent.cpp) + +SOURCE_GROUP("Scene Graph\\Component" FILES ${SG_COMPONENT_HEADER} ${SG_COMPONENT_SOURCE}) #-RenderModue,RenderFramework------------------------------------------- @@ -334,8 +338,7 @@ SET(VULKAN_RENDER_SOURCE ${VK_RR_SOURCE} ${VK_RENDERABLE_SOURCE} ${VK_RENDER_DEVICE_SOURCE}) -add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER} - ${SCENE_GRAPH_SOURCE} +add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER} ${SCENE_GRAPH_SOURCE} ${SG_PRIMITIVE_SOURCE} ${GEOMETRY_FILES} ${LIGHT_FILES} @@ -344,10 +347,9 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER} ${TILE_SOURCE} ${SG_VDM_SOURCE} - ${SG_COMPONENT_HEADER} + ${STATIC_MESH_HEADER_FILES} ${STATIC_MESH_SOURCE_FILES} - ${STATIC_MESH_HEADER_FILES} - ${STATIC_MESH_SOURCE_FILES} + ${SG_COMPONENT_HEADER} ${SG_COMPONENT_SOURCE} # ${FONT_MANAGE_SOURCE} # ${FONT_SOURCE} diff --git a/src/SceneGraph/component/Component.cpp b/src/SceneGraph/component/Component.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/SceneGraph/component/StaticMeshComponent.cpp b/src/SceneGraph/component/StaticMeshComponent.cpp new file mode 100644 index 00000000..e69de29b