尝试制作StaticMeshComponent
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include<hgl/graph/PrimitiveCreater.h>
|
||||
#include<hgl/graph/mtl/Material2DCreateConfig.h>
|
||||
|
||||
#include<hgl/component/StaticMeshComponent.h>
|
||||
|
||||
using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
|
||||
@@ -40,6 +42,8 @@ private:
|
||||
|
||||
Pipeline * pipeline =nullptr;
|
||||
|
||||
StaticMeshComponent *sm_component=nullptr;
|
||||
|
||||
private:
|
||||
|
||||
bool InitMaterial()
|
||||
@@ -87,7 +91,11 @@ private:
|
||||
|
||||
SceneNode *scene_root=GetSceneRoot(); ///<取得场景根节点
|
||||
|
||||
auto manager=StaticMeshComponentManager::GetDefaultManager();
|
||||
|
||||
sm_component=manager->CreateStaticMeshComponent(mesh_triangle);
|
||||
|
||||
scene_root->AttachComponent(sm_component);
|
||||
|
||||
scene_root->Add(new SceneNode(mesh_triangle));
|
||||
|
||||
@@ -98,6 +106,11 @@ public:
|
||||
|
||||
using WorkObject::WorkObject;
|
||||
|
||||
~TestApp()
|
||||
{
|
||||
SAFE_CLEAR(sm_component);
|
||||
}
|
||||
|
||||
bool Init() override
|
||||
{
|
||||
if(!InitMaterial())
|
||||
|
Reference in New Issue
Block a user