From ba2d479f053846a6fd0954061bcba4d0e513c8ff Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Thu, 2 Nov 2023 18:51:02 +0800 Subject: [PATCH] improved Gizmo3DMove.cpp --- CMCore | 2 +- CMSceneGraph | 2 +- example/Gizmo/CMakeLists.txt | 2 +- example/Gizmo/Gizmo.cpp | 0 example/Gizmo/Gizmo.h | 16 ++++++++++++++++ example/Gizmo/Gizmo3DMove.cpp | 16 ++++++---------- 6 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 example/Gizmo/Gizmo.cpp create mode 100644 example/Gizmo/Gizmo.h diff --git a/CMCore b/CMCore index b5c66fe2..1141f37c 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit b5c66fe2cd440d15db54219404a2b4b44ce1018f +Subproject commit 1141f37cc4ae98441e0e75809a8757851c836408 diff --git a/CMSceneGraph b/CMSceneGraph index 95ebf98d..5a12a0ca 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit 95ebf98ddb0c1f48859e84830e2bcd44965f04f5 +Subproject commit 5a12a0cac7e4a5b935bd7112f3ec70179c5216b4 diff --git a/example/Gizmo/CMakeLists.txt b/example/Gizmo/CMakeLists.txt index 9f0ef8ae..36803e1a 100644 --- a/example/Gizmo/CMakeLists.txt +++ b/example/Gizmo/CMakeLists.txt @@ -14,6 +14,6 @@ CreateProject(01_PlaneGrid3D PlaneGrid3D.cpp) CreateProject(02_RayPicking RayPicking.cpp) CreateProject(03_MetricCellsGrid MetricCellsGrid.cpp) -CreateProject(04_Gizmo3DMove Gizmo3DMove.cpp) +CreateProject(04_Gizmo3DMove Gizmo3DMove.cpp Gizmo.h Gizmo.cpp) #CreateProject(03_BlenderAxis BlenderAxis.cpp) diff --git a/example/Gizmo/Gizmo.cpp b/example/Gizmo/Gizmo.cpp new file mode 100644 index 00000000..e69de29b diff --git a/example/Gizmo/Gizmo.h b/example/Gizmo/Gizmo.h new file mode 100644 index 00000000..acaf3bb7 --- /dev/null +++ b/example/Gizmo/Gizmo.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +VK_NAMESPACE_BEGIN + +class Gizmo +{ + Material * material; + MaterialInstance * mi; + Pipeline * pipeline; + Primitive * primitive; + +};//class Gizmo + +VK_NAMESPACE_END diff --git a/example/Gizmo/Gizmo3DMove.cpp b/example/Gizmo/Gizmo3DMove.cpp index 745f1363..c24cd446 100644 --- a/example/Gizmo/Gizmo3DMove.cpp +++ b/example/Gizmo/Gizmo3DMove.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include @@ -34,10 +33,6 @@ private: Pipeline * pipeline_vtx_color =nullptr; Primitive * ro_line =nullptr; - VBO * vbo_pos =nullptr; - - Ray ray; - private: bool InitMaterialAndPipeline() @@ -169,9 +164,10 @@ private: } { - constexpr const uint AXIS_MAX_LINES =7; + constexpr const uint AXIS_MAX_LINES =7; + constexpr const uint AXIS_MAX_VERTICES =AXIS_MAX_LINES*2*3; - ro_line=db->CreatePrimitive("Line",AXIS_MAX_LINES*2*3); + ro_line=db->CreatePrimitive("Line",AXIS_MAX_VERTICES); if(!ro_line)return(false); Vector3f position_data[3][AXIS_MAX_LINES*2]; @@ -186,8 +182,8 @@ private: for(Color4f &c:color_data[1])c=Color4f(0,1,0,1); for(Color4f &c:color_data[2])c=Color4f(0,0,1,1); - if(!ro_line->Set(VAN::Position, vbo_pos= db->CreateVBO(VF_V3F,AXIS_MAX_LINES*2*3,position_data)))return(false); - if(!ro_line->Set(VAN::Color, db->CreateVBO(VF_V4F,AXIS_MAX_LINES*2*3,color_data )))return(false); + if(!ro_line->Set(VAN::Position, db->CreateVBO(VF_V3F,AXIS_MAX_VERTICES,position_data)))return(false); + if(!ro_line->Set(VAN::Color, db->CreateVBO(VF_V4F,AXIS_MAX_VERTICES,color_data )))return(false); } return(true); @@ -195,7 +191,7 @@ private: bool InitScene() { - //Add(ro_plane_grid,mi_plane_grid,pipeline_vtx_lum); + Add(ro_plane_grid,mi_plane_grid,pipeline_vtx_lum); Add(ro_line,mi_line,pipeline_vtx_color); camera->pos=Vector3f(32,32,32);