ComponentManager增加自动释放功能

This commit is contained in:
2025-06-15 00:49:23 +08:00
parent c1420e257d
commit cfda1fceb2
10 changed files with 70 additions and 48 deletions

View File

@@ -42,8 +42,6 @@ private:
Pipeline * pipeline =nullptr;
StaticMeshComponent *sm_component=nullptr;
private:
bool InitMaterial()
@@ -89,33 +87,16 @@ private:
{VAN::Color, COLOR_DATA_FORMAT, color_data}
});
return(mesh_triangle);
}
bool InitScene()
{
if(!mesh_triangle)
return(false);
SceneNode *scene_root=GetSceneRoot(); ///<取得场景根节点
sm_component=CreateComponent<StaticMeshComponent>(scene_root,mesh_triangle); //创建一个静态网格组件
if(!sm_component)
return(false);
return(true);
return CreateComponent<StaticMeshComponent>(GetSceneRoot(),mesh_triangle); //创建一个静态网格组件
}
public:
using WorkObject::WorkObject;
~TestApp()
{
SAFE_CLEAR(sm_component);
}
bool Init() override
{
if(!InitMaterial())
@@ -124,9 +105,6 @@ public:
if(!InitVBO())
return(false);
if(!InitScene())
return(false);
return(true);
}
};//class TestApp:public WorkObject