2024-07-30 23:54:25 +08:00
|
|
|
|
#include"GizmoResource.h"
|
|
|
|
|
#include<hgl/graph/VKRenderResource.h>
|
|
|
|
|
#include<hgl/graph/InlineGeometry.h>
|
2024-09-02 00:32:30 +08:00
|
|
|
|
#include<hgl/graph/TransformFaceToCamera.h>
|
2024-07-30 23:54:25 +08:00
|
|
|
|
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
static StaticMesh *sm_gizmo_rotate=nullptr;
|
|
|
|
|
}//namespace
|
|
|
|
|
|
|
|
|
|
StaticMesh *GetGizmoRotateStaticMesh()
|
|
|
|
|
{
|
|
|
|
|
return sm_gizmo_rotate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClearGizmoRotateStaticMesh()
|
|
|
|
|
{
|
|
|
|
|
SAFE_CLEAR(sm_gizmo_rotate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool InitGizmoRotateStaticMesh()
|
|
|
|
|
{
|
|
|
|
|
Renderable *torus[4]
|
|
|
|
|
{
|
|
|
|
|
GetGizmoRenderable(GizmoShape::Torus,GizmoColor::Red),
|
|
|
|
|
GetGizmoRenderable(GizmoShape::Torus,GizmoColor::Green),
|
|
|
|
|
GetGizmoRenderable(GizmoShape::Torus,GizmoColor::Blue),
|
|
|
|
|
|
|
|
|
|
GetGizmoRenderable(GizmoShape::Torus,GizmoColor::White),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<4;i++)
|
|
|
|
|
{
|
|
|
|
|
if(!torus[i])
|
|
|
|
|
return(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
SceneNode *root_node=new SceneNode();
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Transform tm;
|
|
|
|
|
|
2024-08-30 00:30:06 +08:00
|
|
|
|
tm.SetScale(GIZMO_ARROW_LENGTH);
|
2024-07-30 23:54:25 +08:00
|
|
|
|
|
|
|
|
|
root_node->CreateSubNode(tm,torus[0]);
|
|
|
|
|
|
2024-07-31 00:17:23 +08:00
|
|
|
|
tm.SetRotation(AXIS::Z,90);
|
2024-07-30 23:54:25 +08:00
|
|
|
|
root_node->CreateSubNode(tm,torus[1]);
|
|
|
|
|
|
2024-07-31 00:17:23 +08:00
|
|
|
|
tm.SetRotation(AXIS::Y,90);
|
2024-07-30 23:54:25 +08:00
|
|
|
|
root_node->CreateSubNode(tm,torus[2]);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-02 00:32:30 +08:00
|
|
|
|
{
|
|
|
|
|
SceneNode *white_torus=new SceneNode(scale(13),torus[3]);
|
|
|
|
|
|
|
|
|
|
white_torus->SetLocalNormal(AxisVector::X);
|
|
|
|
|
|
|
|
|
|
TransformFaceToCamera *rotate_white_torus_tfc=new TransformFaceToCamera();
|
|
|
|
|
|
|
|
|
|
white_torus->GetTransform().AddTransform(rotate_white_torus_tfc);
|
|
|
|
|
|
|
|
|
|
root_node->AddSubNode(white_torus);
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-30 23:54:25 +08:00
|
|
|
|
sm_gizmo_rotate=CreateGizmoStaticMesh(root_node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!sm_gizmo_rotate)
|
|
|
|
|
return(false);
|
|
|
|
|
|
|
|
|
|
return(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VK_NAMESPACE_END
|