From bbbd8b06c2b1905a1510de03faa6fdb0f685f2e1 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 2 Sep 2024 00:32:30 +0800 Subject: [PATCH] move the white_torus to GizmoRotate --- CMSceneGraph | 2 +- example/Gizmo/Gizmo3DRotate.cpp | 13 +++++++++++++ example/Gizmo/GizmoTest.cpp | 18 ------------------ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/CMSceneGraph b/CMSceneGraph index ef1afa55..ae170b71 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit ef1afa55da2ede0b7d0b6c8efb424e3e11c1c366 +Subproject commit ae170b717e5960034a2a0e83ba4c00a05023491d diff --git a/example/Gizmo/Gizmo3DRotate.cpp b/example/Gizmo/Gizmo3DRotate.cpp index c3b57677..56c80b4a 100644 --- a/example/Gizmo/Gizmo3DRotate.cpp +++ b/example/Gizmo/Gizmo3DRotate.cpp @@ -1,6 +1,7 @@ #include"GizmoResource.h" #include #include +#include VK_NAMESPACE_BEGIN @@ -53,6 +54,18 @@ bool InitGizmoRotateStaticMesh() root_node->CreateSubNode(tm,torus[2]); } + { + 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); + } + sm_gizmo_rotate=CreateGizmoStaticMesh(root_node); } diff --git a/example/Gizmo/GizmoTest.cpp b/example/Gizmo/GizmoTest.cpp index 74b3ea5e..11186f7d 100644 --- a/example/Gizmo/GizmoTest.cpp +++ b/example/Gizmo/GizmoTest.cpp @@ -1,6 +1,5 @@ #include"VulkanAppFramework.h" #include"Gizmo.h" -#include #include using namespace hgl; @@ -56,14 +55,11 @@ const Vector3f GizmoPosition(0,0,0); class TestApp:public SceneAppFramework { SceneNode root; - SceneNode *rotate_white_torus=nullptr; StaticMesh *sm_move=nullptr; StaticMesh *sm_rotate=nullptr; StaticMesh *sm_scale=nullptr; - Renderable *face_torus=nullptr; - private: bool InitGizmo() @@ -75,8 +71,6 @@ private: sm_rotate =GetGizmoRotateStaticMesh(); sm_scale =GetGizmoScaleStaticMesh(); - face_torus =GetGizmoRenderable(GizmoShape::Torus,GizmoColor::White); - return(true); } @@ -91,18 +85,6 @@ private: root.CreateSubNode(sm_rotate->GetScene()); //root.CreateSubNode(sm_scale->GetScene()); - { - rotate_white_torus=new SceneNode(scale(13),face_torus); - - rotate_white_torus->SetLocalNormal(AxisVector::X); - - TransformFaceToCamera *rotate_white_torus_tfc=new TransformFaceToCamera(ci); - - rotate_white_torus->GetTransform().AddTransform(rotate_white_torus_tfc); - - root.AddSubNode(rotate_white_torus); - } - root.RefreshMatrix(); render_list->SetCamera(ci); render_list->Expend(&root);