added Component.cpp/StaticMeshComponent.h/.cpp
This commit is contained in:
parent
83c1a067fe
commit
a0b0027663
@ -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> component_list;
|
||||
|
||||
public:
|
||||
|
||||
virtual void Update(const double delta_time)
|
||||
{
|
||||
for(Component *c:component_list)
|
||||
{
|
||||
c->Update(delta_time);
|
||||
}
|
||||
}
|
||||
};//class ComponentManager
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
19
inc/hgl/graph/component/StaticMeshComponent.h
Normal file
19
inc/hgl/graph/component/StaticMeshComponent.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/Component.h>
|
||||
#include<hgl/graph/mesh/StaticMesh.h>
|
||||
|
||||
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
|
@ -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}
|
||||
|
0
src/SceneGraph/component/Component.cpp
Normal file
0
src/SceneGraph/component/Component.cpp
Normal file
0
src/SceneGraph/component/StaticMeshComponent.cpp
Normal file
0
src/SceneGraph/component/StaticMeshComponent.cpp
Normal file
Loading…
x
Reference in New Issue
Block a user