建立最基础的SceneWorldManager

This commit is contained in:
2025-05-22 01:42:16 +08:00
parent 8a99a331c0
commit 75da8cabef
6 changed files with 68 additions and 17 deletions

View File

@@ -1,26 +1,28 @@
#pragma once
#include<hgl/graph/SceneNode.h>
#include<hgl/type/Pool.h>
namespace hgl::graph
{
class CameraData
{
};
class CameraManager
{
public:
};
/**
* 世界场景管理器<Br>
* 管理一个世界场景中的所有资源与场景节点
*/
class SceneWorld
{
U8String WorldName; ///<世界名称
ObjectList<SceneNode> 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

View File

@@ -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)

View File

@@ -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<typename T>
T * Get() {return((T *)Get(typeid(T).hash_code()));} ///<取得指定类型的模块