迁移auto_merge_material_instance,BillboardTest,PlaneGrid3D,RayPicking四个测试范例到新的Component结构
This commit is contained in:
parent
cfda1fceb2
commit
a180970eb6
@ -13,6 +13,7 @@
|
||||
#include<hgl/graph/VKVertexInputConfig.h>
|
||||
#include<hgl/graph/module/TextureManager.h>
|
||||
#include<hgl/graph/FirstPersonCameraControl.h>
|
||||
#include<hgl/component/StaticMeshComponent.h>
|
||||
|
||||
using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
@ -112,19 +113,6 @@ private:
|
||||
return(true);
|
||||
}
|
||||
|
||||
SceneNode *CreateSceneNode(Primitive *r,MaterialInstance *mi,Pipeline *p)
|
||||
{
|
||||
Mesh *ri=db->CreateMesh(r,mi,p);
|
||||
|
||||
if(!ri)
|
||||
{
|
||||
LOG_ERROR(OS_TEXT("Create Mesh failed."));
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
return(new SceneNode(ri));
|
||||
}
|
||||
|
||||
bool CreateRenderObject()
|
||||
{
|
||||
using namespace inline_geometry;
|
||||
@ -164,9 +152,8 @@ private:
|
||||
{
|
||||
SceneNode *scene_root=GetSceneRoot(); //取得缺省场景根节点
|
||||
|
||||
scene_root->Add(CreateSceneNode(prim_plane_grid,mi_plane_grid,pipeline_plane_grid));
|
||||
|
||||
scene_root->Add(new SceneNode(ro_billboard));
|
||||
CreateComponent<StaticMeshComponent>(scene_root,db->CreateMesh(prim_plane_grid,mi_plane_grid,pipeline_plane_grid));
|
||||
CreateComponent<StaticMeshComponent>(scene_root,ro_billboard);
|
||||
|
||||
CameraControl *camera_control=GetCameraControl();
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include<hgl/filesystem/FileSystem.h>
|
||||
#include<hgl/graph/mtl/Material2DCreateConfig.h>
|
||||
#include<hgl/color/Color.h>
|
||||
#include<hgl/component/StaticMeshComponent.h>
|
||||
|
||||
using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
@ -93,7 +94,7 @@ private:
|
||||
|
||||
mat=rotate(deg2rad<double>(TRI_ROTATE_ANGLE*i),AxisVector::Z);
|
||||
|
||||
scene_root->Add(new SceneNode(mat,render_obj[i].mesh));
|
||||
CreateComponent<StaticMeshComponent>(mat,scene_root,render_obj[i].mesh);
|
||||
}
|
||||
|
||||
return(true);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include<hgl/graph/VKVertexInputConfig.h>
|
||||
#include<hgl/graph/FirstPersonCameraControl.h>
|
||||
#include<hgl/color/Color.h>
|
||||
#include<hgl/component/StaticMeshComponent.h>
|
||||
|
||||
using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
@ -83,7 +84,7 @@ private:
|
||||
if(!ri)
|
||||
return;
|
||||
|
||||
parent_node->Add(new SceneNode(mat,ri));
|
||||
CreateComponent<StaticMeshComponent>(mat,parent_node,ri);
|
||||
}
|
||||
|
||||
bool InitScene()
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
||||
#include<hgl/graph/VertexDataManager.h>
|
||||
#include<hgl/graph/VKVertexInputConfig.h>
|
||||
#include<hgl/component/StaticMeshComponent.h>
|
||||
|
||||
using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
@ -100,7 +101,7 @@ private:
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
parent_node->Add(new SceneNode(ri));
|
||||
CreateComponent<StaticMeshComponent>(parent_node,ri);
|
||||
|
||||
return ri;
|
||||
}
|
||||
|
@ -156,6 +156,9 @@ namespace hgl
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果此处出现转换错误,请检查是否包含了对应的Component头文件。
|
||||
*/
|
||||
parent_node->AttachComponent(c); //将组件附加到父节点
|
||||
|
||||
return c;
|
||||
@ -178,6 +181,9 @@ namespace hgl
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果此处出现转换错误,请检查是否包含了对应的Component头文件。
|
||||
*/
|
||||
parent_node->AttachComponent(c); //将组件附加到父节点
|
||||
|
||||
c->graph::SceneOrient::SetLocalMatrix(mat);
|
||||
|
Loading…
x
Reference in New Issue
Block a user