diff --git a/CMCore b/CMCore index 511dd86c..f1a6f0b9 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 511dd86c56383bc14078602f5e5baab1a3109ae5 +Subproject commit f1a6f0b90eb7766be90afb7e62ec539dfa30f746 diff --git a/CMUtil b/CMUtil index 6173c16b..48383e5f 160000 --- a/CMUtil +++ b/CMUtil @@ -1 +1 @@ -Subproject commit 6173c16bf1744eb15472aa198d3a2a5c4513e78e +Subproject commit 48383e5f63928bab43320c406219365850507246 diff --git a/inc/hgl/graph/SceneWorld.h b/inc/hgl/graph/SceneWorld.h index 74dd2a9a..5a593cd1 100644 --- a/inc/hgl/graph/SceneWorld.h +++ b/inc/hgl/graph/SceneWorld.h @@ -1,26 +1,28 @@ #pragma once #include +#include namespace hgl::graph { - class CameraData - { - }; - - class CameraManager - { - public: - }; - /** * 世界场景管理器
* 管理一个世界场景中的所有资源与场景节点 */ class SceneWorld { + U8String WorldName; ///<世界名称 + + ObjectList SceneNodePool; ///<场景节点池 + SceneNode *root_node; ///<世界根节点 + public: + + const U8String & GetWorldName()const{return WorldName;} ///<获取世界名称 + + SceneNode * GetRootNode (){return root_node;} ///<获取世界根节点 + public: SceneWorld() @@ -32,7 +34,17 @@ namespace hgl::graph { SAFE_CLEAR(root_node); } - - SceneNode *GetRootNode(){return root_node;} };//class SceneWorld + + bool RegistrySceneWorld(SceneWorld *sw); ///<注册场景世界 + bool UnregistrySceneWorld(const U8String &world_name); ///<注销场景世界 + + inline bool UnregistrySceneWorld(SceneWorld *sw) ///<注销场景世界 + { + if(!sw)return(false); + + return UnregistrySceneWorld(sw->GetWorldName()); + } + + SceneWorld *GetSceneWorld(const U8String &world_name); ///<获取指定名称的场景世界 }//namespace hgl::graph diff --git a/inc/hgl/graph/VKDescriptorBindingManage.h b/inc/hgl/graph/VKDescriptorBindingManage.h index 863373a3..edff0efc 100644 --- a/inc/hgl/graph/VKDescriptorBindingManage.h +++ b/inc/hgl/graph/VKDescriptorBindingManage.h @@ -43,7 +43,7 @@ public: { if(name.IsEmpty())return(nullptr); - return GetObjectFromList(ubo_map,name); + return GetObjectFromMap(ubo_map,name); } void RemoveUBO(DeviceBuffer *buf) @@ -65,7 +65,7 @@ public: { if(name.IsEmpty())return(nullptr); - return GetObjectFromList(ssbo_map,name); + return GetObjectFromMap(ssbo_map,name); } void RemoveSSBO(DeviceBuffer *buf) @@ -87,7 +87,7 @@ public: { if(name.IsEmpty())return(nullptr); - return GetObjectFromList(texture_map,name); + return GetObjectFromMap(texture_map,name); } void RemoveTexture(Texture *tex) diff --git a/inc/hgl/graph/module/GraphModuleManager.h b/inc/hgl/graph/module/GraphModuleManager.h index be5fba6e..47fec703 100644 --- a/inc/hgl/graph/module/GraphModuleManager.h +++ b/inc/hgl/graph/module/GraphModuleManager.h @@ -27,7 +27,7 @@ public: public: - GraphModule * Get(const size_t type_hash) {return GetObjectFromList(module_map,type_hash);} ///<取得指定类型的模块 + GraphModule * Get(const size_t type_hash) {return GetObjectFromMap(module_map,type_hash);} ///<取得指定类型的模块 template T * Get() {return((T *)Get(typeid(T).hash_code()));} ///<取得指定类型的模块 diff --git a/src/SceneGraph/scene/SceneWorld.cpp b/src/SceneGraph/scene/SceneWorld.cpp index e69de29b..f6a9424b 100644 --- a/src/SceneGraph/scene/SceneWorld.cpp +++ b/src/SceneGraph/scene/SceneWorld.cpp @@ -0,0 +1,39 @@ +#include +#include + +namespace hgl::graph +{ + namespace + { + Map scene_world_map;///<场景世界列表 + }//namespace + + bool RegistrySceneWorld(SceneWorld *sw) + { + if(!sw)return(false); + + const U8String &world_name=sw->GetWorldName(); + + if(scene_world_map.Find(world_name)) + return false;///<已经注册过了 + + scene_world_map.Add(world_name,sw); + return true; + } + + SceneWorld *GetSceneWorld(const U8String &world_name) + { + if(world_name.IsEmpty()) + return(nullptr); + + return GetObjectFromMap(scene_world_map,world_name); + } + + bool UnregistrySceneWorld(const U8String &world_name) + { + if(world_name.IsEmpty()) + return(false); + + return scene_world_map.DeleteByKey(world_name); + } +}//namespace hgl::graph