diff --git a/CMCore b/CMCore index 25060b07..a3886669 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 25060b07d03d088b940f78ac1223f4888377f608 +Subproject commit a38866694c9b50b1b5fc1c01258469a19654d4cd diff --git a/CMPlatform b/CMPlatform index b6cf73de..bc5623e4 160000 --- a/CMPlatform +++ b/CMPlatform @@ -1 +1 @@ -Subproject commit b6cf73deca94d4de37567f8b5d1d1c2e78eb330e +Subproject commit bc5623e4621e2957a6458f599a97c228fbd83d9a diff --git a/example/Gizmo/Gizmo.h b/example/Gizmo/Gizmo.h index c7b0090f..6c11a4cc 100644 --- a/example/Gizmo/Gizmo.h +++ b/example/Gizmo/Gizmo.h @@ -35,7 +35,7 @@ enum class GizmoShape:uint bool InitGizmoResource(RenderFramework *); void FreeGizmoResource(); -ComponentDataPtr GetGizmoMeshComponentDataPtr(const GizmoShape &shape,const GizmoColor &color); +ComponentDataPtr GetGizmoMeshCDP(const GizmoShape &shape,const GizmoColor &color); SceneNode *GetGizmoMoveNode(); //SceneNode *GetGizmoScaleMesh(); diff --git a/example/Gizmo/Gizmo3DMove.cpp b/example/Gizmo/Gizmo3DMove.cpp index 8d4916e1..1d60ba85 100644 --- a/example/Gizmo/Gizmo3DMove.cpp +++ b/example/Gizmo/Gizmo3DMove.cpp @@ -58,124 +58,115 @@ namespace SceneNode * Duplication() const override { - GizmoMoveNode *new_gma=(GizmoMoveNode *)SceneNode::Duplication(); + GizmoMoveNode *new_gmn=(GizmoMoveNode *)SceneNode::Duplication(); - if(!new_gma) + if(!new_gmn) return(nullptr); - new_gma->sphere=sphere; - for(int i=0;i<3;i++) - { - new_gma->axis[i].cylinder =axis[i].cylinder; - new_gma->axis[i].cone =axis[i].cone; - new_gma->axis[i].square =axis[i].square; - } + new_gmn->sphere=sphere; + hgl_cpy(new_gmn->axis,axis); - return new_gma; + return new_gmn; } bool Init(RenderFramework *render_framework) { - ComponentDataPtr sphere=GetGizmoMeshComponentDataPtr(GizmoShape::Sphere,GizmoColor::White); + ComponentDataPtr sphere_ptr=GetGizmoMeshCDP(GizmoShape::Sphere,GizmoColor::White); - ComponentDataPtr cylinder[3] - { - GetGizmoMeshComponentDataPtr(GizmoShape::Cylinder,GizmoColor::Red), - GetGizmoMeshComponentDataPtr(GizmoShape::Cylinder,GizmoColor::Green), - GetGizmoMeshComponentDataPtr(GizmoShape::Cylinder,GizmoColor::Blue), + #define GET_GIZMO_MESH_CDP(shape) ComponentDataPtr shape##Ptr[3]{ \ + GetGizmoMeshCDP(GizmoShape::shape,GizmoColor::Red), \ + GetGizmoMeshCDP(GizmoShape::shape,GizmoColor::Green), \ + GetGizmoMeshCDP(GizmoShape::shape,GizmoColor::Blue) \ }; - ComponentDataPtr cone[3] - { - GetGizmoMeshComponentDataPtr(GizmoShape::Cone,GizmoColor::Red), - GetGizmoMeshComponentDataPtr(GizmoShape::Cone,GizmoColor::Green), - GetGizmoMeshComponentDataPtr(GizmoShape::Cone,GizmoColor::Blue), - }; + GET_GIZMO_MESH_CDP(Cylinder) + GET_GIZMO_MESH_CDP(Cone) + GET_GIZMO_MESH_CDP(Square) - ComponentDataPtr square[3]= - { - GetGizmoMeshComponentDataPtr(GizmoShape::Square,GizmoColor::Red), - GetGizmoMeshComponentDataPtr(GizmoShape::Square,GizmoColor::Green), - GetGizmoMeshComponentDataPtr(GizmoShape::Square,GizmoColor::Blue) - }; - - if(!sphere) + if(!sphere_ptr) return(false); for(int i=0;i<3;i++) { - if(!cylinder[i]) + if(!CylinderPtr[i]) return(false); - if(!cone[i]) + if(!ConePtr[i]) return(false); - if(!square[i]) + if(!SquarePtr[i]) return(false); } CreateComponentInfo cci(this); - render_framework->CreateComponent(&cci,sphere); + sphere=render_framework->CreateComponent(&cci,sphere_ptr); { Transform tm; + GizmoMoveAxis *gma; const Vector3f one_scale(1); const Vector3f square_scale(2); const Vector3f cylinder_scale(GIZMO_CYLINDER_RADIUS,GIZMO_CYLINDER_RADIUS,GIZMO_CYLINDER_HALF_LENGTH); { + gma=axis+size_t(AXIS::Z); + tm.SetScale(cylinder_scale); tm.SetTranslation(0,0,GIZMO_CYLINDER_OFFSET); cci.mat=tm; - render_framework->CreateComponent(&cci,cylinder[2]); //Z 向上圆柱 + gma->cylinder=render_framework->CreateComponent(&cci,CylinderPtr[2]); //Z 向上圆柱 tm.SetScale(one_scale); tm.SetTranslation(0,0,GIZMO_CONE_OFFSET); cci.mat=tm; - render_framework->CreateComponent(&cci,cone[2]); //Z 向上圆锥 + gma->cone=render_framework->CreateComponent(&cci,ConePtr[2]); //Z 向上圆锥 tm.SetScale(square_scale); tm.SetTranslation(GIZMO_TWO_AXIS_OFFSET,GIZMO_TWO_AXIS_OFFSET,0); cci.mat=tm; - render_framework->CreateComponent(&cci,square[2]); + gma->square=render_framework->CreateComponent(&cci,SquarePtr[2]); } { + gma=axis+size_t(AXIS::X); + tm.SetScale(cylinder_scale); tm.SetRotation(AxisVector::Y,90); tm.SetTranslation(GIZMO_CYLINDER_OFFSET,0,0); cci.mat=tm; - render_framework->CreateComponent(&cci,cylinder[0]); //X 向右圆柱 + gma->cylinder=render_framework->CreateComponent(&cci,CylinderPtr[0]); //X 向右圆柱 tm.SetScale(one_scale); tm.SetTranslation(GIZMO_CONE_OFFSET,0,0); cci.mat=tm; - render_framework->CreateComponent(&cci,cone[0]); //X 向右圆锥 + gma->cone=render_framework->CreateComponent(&cci,ConePtr[0]); //X 向右圆锥 tm.SetScale(square_scale); tm.SetTranslation(0,GIZMO_TWO_AXIS_OFFSET,GIZMO_TWO_AXIS_OFFSET); cci.mat=tm; - render_framework->CreateComponent(&cci,square[0]); + gma->square=render_framework->CreateComponent(&cci,SquarePtr[0]); } { + gma=axis+size_t(AXIS::Y); + tm.SetScale(cylinder_scale); tm.SetRotation(AxisVector::X,-90); tm.SetTranslation(0,GIZMO_CYLINDER_OFFSET,0); cci.mat=tm; - render_framework->CreateComponent(&cci,cylinder[1]); //Y 向前圆柱 + gma->cylinder=render_framework->CreateComponent(&cci,CylinderPtr[1]); //Y 向前圆柱 tm.SetScale(one_scale); tm.SetTranslation(0,GIZMO_CONE_OFFSET,0); cci.mat=tm; - render_framework->CreateComponent(&cci,cone[1]); //Y 向前圆锥 + gma->cone=render_framework->CreateComponent(&cci,ConePtr[1]); //Y 向前圆锥 tm.SetScale(square_scale); tm.SetTranslation(GIZMO_TWO_AXIS_OFFSET,0,GIZMO_TWO_AXIS_OFFSET); cci.mat=tm; - render_framework->CreateComponent(&cci,square[1]); + gma->square=render_framework->CreateComponent(&cci,SquarePtr[1]); } } diff --git a/example/Gizmo/GizmoResource.cpp b/example/Gizmo/GizmoResource.cpp index e876e34a..fe0b2860 100644 --- a/example/Gizmo/GizmoResource.cpp +++ b/example/Gizmo/GizmoResource.cpp @@ -338,7 +338,7 @@ void FreeGizmoResource() SAFE_CLEAR(gizmo_line.vdm); } -ComponentDataPtr GetGizmoMeshComponentDataPtr(const GizmoShape &shape,const GizmoColor &color) +ComponentDataPtr GetGizmoMeshCDP(const GizmoShape &shape,const GizmoColor &color) { if(!gizmo_rr) return(nullptr); diff --git a/inc/hgl/graph/module/GraphModuleManager.h b/inc/hgl/graph/module/GraphModuleManager.h index 9c923e01..d7865edf 100644 --- a/inc/hgl/graph/module/GraphModuleManager.h +++ b/inc/hgl/graph/module/GraphModuleManager.h @@ -23,7 +23,7 @@ public: public: RenderFramework * GetRenderFramework ()const{return render_framework;} ///<取得渲染框架 - VulkanDevice * GetDevice ()const; ///<取得GPU设备 + VulkanDevice * GetDevice ()const; ///<取得GPU设备 public: