From 95ac4ba97337deb90330b3c00c58d3888fa46d40 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 30 Jul 2025 23:21:53 +0800 Subject: [PATCH] =?UTF-8?q?EventDispatcher=E6=B4=BE=E7=94=9F=E7=B1=BB?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BD=BF=E7=94=A8EventProcResult=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2bool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMCore | 2 +- CMSceneGraph | 2 +- example/Gizmo/Gizmo3DMove.cpp | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CMCore b/CMCore index 11838e9c..f1a36055 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 11838e9cc813395d57b6bfbc501e99b6526436c0 +Subproject commit f1a36055e430e110e3ac1ff643920715b9efeb2d diff --git a/CMSceneGraph b/CMSceneGraph index dc1cd8a2..eacccdde 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit dc1cd8a2d4a90ebdd50b4812014c3857a4caeb65 +Subproject commit eacccdde053fc33b5f1aaa0f20e4752ef1fb7c7d diff --git a/example/Gizmo/Gizmo3DMove.cpp b/example/Gizmo/Gizmo3DMove.cpp index 575e50a0..47367535 100644 --- a/example/Gizmo/Gizmo3DMove.cpp +++ b/example/Gizmo/Gizmo3DMove.cpp @@ -199,21 +199,22 @@ namespace return(true); } - bool OnPressed(const Vector2i &,io::MouseButton mb) override + io::EventProcResult OnPressed(const Vector2i &,io::MouseButton mb) override { - + return io::EventProcResult::Continue; } - bool OnReleased(const Vector2i &,io::MouseButton mb) override + io::EventProcResult OnReleased(const Vector2i &,io::MouseButton mb) override { + return io::EventProcResult::Continue; } - bool OnMove(const Vector2i &mouse_coord) override + io::EventProcResult OnMove(const Vector2i &mouse_coord) override { CameraControl *cc=GetCameraControl(); if(!cc) - return(false); + return io::EventProcResult::Continue; Ray ray; @@ -221,6 +222,7 @@ namespace Matrix4f l2w=GetLocalToWorldMatrix(); Vector3f center=TransformPosition(l2w,Vector3f(0,0,0)); + Vector3f axis_vector; Vector3f start; Vector3f end; Vector3f p_ray,p_ls; @@ -234,8 +236,10 @@ namespace for(int i=0;i<3;i++) { - start=TransformPosition(l2w,GetAxisVector(AXIS(i))*GIZMO_CENTER_SPHERE_RADIUS*center_ppu); //将轴的起点转换到世界坐标 - end=TransformPosition(l2w,GetAxisVector(AXIS(i))*(GIZMO_CENTER_SPHERE_RADIUS+GIZMO_CONE_LENGTH+GIZMO_CYLINDER_HALF_LENGTH)*center_ppu); + axis_vector=GetAxisVector(AXIS(i))*center_ppu; //取得轴向量 + + start =TransformPosition(l2w,axis_vector* GIZMO_CENTER_SPHERE_RADIUS); //将轴的起点转换到世界坐标 + end =TransformPosition(l2w,axis_vector*(GIZMO_CENTER_SPHERE_RADIUS+GIZMO_CONE_LENGTH+GIZMO_CYLINDER_HALF_LENGTH)); //求射线与线段的最近点 ray.ClosestPoint(p_ray, //射线上的点 @@ -267,7 +271,7 @@ namespace //std::cout<<"Distance: "<