[WIP] StaticMesh and GizmoMove

This commit is contained in:
2024-07-28 23:34:04 +08:00
parent eef7f58575
commit f79410e434
11 changed files with 240 additions and 42 deletions

View File

@@ -22,17 +22,74 @@
*/
#include"GizmoResource.h"
#include<hgl/graph/VKRenderResource.h>
#include<hgl/graph/InlineGeometry.h>
VK_NAMESPACE_BEGIN
struct StaticMesh
{
};
namespace
{
static StaticMesh *sm_gizmo_move=nullptr;
bool InitGizmoMoveStaticMesh()
{
Renderable *sphere=GetGizmoRenderable(GizmoShape::Sphere,GizmoColor::White);
Renderable *cylinder[3]
{
GetGizmoRenderable(GizmoShape::Cylinder,GizmoColor::Red),
GetGizmoRenderable(GizmoShape::Cylinder,GizmoColor::Green),
GetGizmoRenderable(GizmoShape::Cylinder,GizmoColor::Blue),
};
Renderable *cone[3]
{
GetGizmoRenderable(GizmoShape::Cone,GizmoColor::Red),
GetGizmoRenderable(GizmoShape::Cone,GizmoColor::Green),
GetGizmoRenderable(GizmoShape::Cone,GizmoColor::Blue),
};
if(!sphere)
return(false);
for(int i=0;i<3;i++)
{
if(!cylinder[i])
return(false);
if(!cone[i])
return(false);
}
{
SceneNode *root_node=new SceneNode(scale(1),sphere);
root_node->CreateSubNode(scale(9,1,1),cylinder[0]);
{
TransformMatrix4f tm;
tm.SetTranslation(Vector3f(0,0,4.5f));
root_node->CreateSubNode(tm.GetMatrix(),cylinder[2]); //Z 向上
tm.SetRotation(Vector3f(0,0,1),90);
tm.SetTranslation(Vector3f(4.5f,0,0));
root_node->CreateSubNode(tm.GetMatrix(),cylinder[0]); //X 向右
tm.SetRotation(Vector3f(1,0,0),90);
tm.SetTranslation(Vector3f(0,4.5f,0));
root_node->CreateSubNode(tm.GetMatrix(),cylinder[1]); //Y 向前
}
sm_gizmo_move=CreateGizmoStaticMesh(root_node);
}
if(!sm_gizmo_move)
return(false);
return(true);
}
}//namespace
VK_NAMESPACE_END