From c69fe080dc7ede97eb1c44c43e297c145af83c43 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 23 Jun 2025 02:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMCore | 2 +- CMSceneGraph | 2 +- example/Gizmo/Gizmo3DMove.cpp | 20 +++++++++++++++- inc/hgl/component/CollisionComponent.h | 0 .../collision/BoxCollisionComponent.h | 0 .../collision/CapslueCollisionComponent.h | 0 .../collision/SphereCollisionComponent.h | 0 inc/hgl/graph/Mesh.h | 7 +++--- inc/hgl/graph/RenderNode.h | 15 +++++++----- src/SceneGraph/render/RenderNode.cpp | 23 +++++++++++++++++-- 10 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 inc/hgl/component/CollisionComponent.h create mode 100644 inc/hgl/component/collision/BoxCollisionComponent.h create mode 100644 inc/hgl/component/collision/CapslueCollisionComponent.h create mode 100644 inc/hgl/component/collision/SphereCollisionComponent.h diff --git a/CMCore b/CMCore index c5b37f98..71b459c0 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit c5b37f98353441520374011020dbe63c17796a4d +Subproject commit 71b459c0246d70d0bba5dd49662b5534c579251e diff --git a/CMSceneGraph b/CMSceneGraph index 74e33b49..1e7e4a02 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit 74e33b497274e51c35a5ee19a274b12dc86deecb +Subproject commit 1e7e4a025cdd03125144e167b62f70a8efdaf245 diff --git a/example/Gizmo/Gizmo3DMove.cpp b/example/Gizmo/Gizmo3DMove.cpp index 2878b337..c7255da4 100644 --- a/example/Gizmo/Gizmo3DMove.cpp +++ b/example/Gizmo/Gizmo3DMove.cpp @@ -32,6 +32,24 @@ VK_NAMESPACE_BEGIN namespace { + /** + * 移动 Gizmo 节点 + */ + class GizmoMoveNode:public SceneNode + { + MeshComponent *sphere=nullptr; + + struct GizmoMoveAxis + { + MeshComponent *cylinder =nullptr; //圆柱 + MeshComponent *cone =nullptr; //圆锥 + MeshComponent *square =nullptr; //双轴调节正方形 + }; + + public: + + + };//class GizmoMoveNode:public SceneNode static SceneNode *sn_gizmo_move=nullptr; }//namespace @@ -100,7 +118,7 @@ bool InitGizmoMoveNode(RenderFramework *render_framework) { tm.SetScale(cylinder_scale); tm.SetTranslation(0,0,GIZMO_CYLINDER_OFFSET); - render_framework->CreateComponent(tm.GetMatrix(),sn_gizmo_move,cylinder[2]); //Z 向上圆柱 + render_framework->CreateComponent(tm.GetMatrix(),sn_gizmo_move,cylinder[2]); //Z 向上圆柱 tm.SetScale(one_scale); tm.SetTranslation(0,0,GIZMO_CONE_OFFSET); diff --git a/inc/hgl/component/CollisionComponent.h b/inc/hgl/component/CollisionComponent.h new file mode 100644 index 00000000..e69de29b diff --git a/inc/hgl/component/collision/BoxCollisionComponent.h b/inc/hgl/component/collision/BoxCollisionComponent.h new file mode 100644 index 00000000..e69de29b diff --git a/inc/hgl/component/collision/CapslueCollisionComponent.h b/inc/hgl/component/collision/CapslueCollisionComponent.h new file mode 100644 index 00000000..e69de29b diff --git a/inc/hgl/component/collision/SphereCollisionComponent.h b/inc/hgl/component/collision/SphereCollisionComponent.h new file mode 100644 index 00000000..e69de29b diff --git a/inc/hgl/graph/Mesh.h b/inc/hgl/graph/Mesh.h index 999f7a47..7d1a8fbf 100644 --- a/inc/hgl/graph/Mesh.h +++ b/inc/hgl/graph/Mesh.h @@ -62,7 +62,8 @@ public: }; /** -* 网格体(网格中的最小渲染单位) +* 网格体(网格渲染中的最小渲染单位,只能是一个材质实例) +* 多材质的网格体使用StaticMesh,它内含多个Mesh */ class Mesh { @@ -98,8 +99,8 @@ public: Primitive * GetPrimitive (){return primitive;} const AABB & GetBoundingBox ()const{return primitive->GetBoundingBox();} - const MeshDataBuffer * GetDataBuffer ()const{return data_buffer;} - const MeshRenderData * GetRenderData ()const{return render_data;} + const MeshDataBuffer * GetDataBuffer ()const{return data_buffer;} + const MeshRenderData * GetRenderData ()const{return render_data;} public: diff --git a/inc/hgl/graph/RenderNode.h b/inc/hgl/graph/RenderNode.h index b1f37b42..56ff0606 100644 --- a/inc/hgl/graph/RenderNode.h +++ b/inc/hgl/graph/RenderNode.h @@ -13,15 +13,18 @@ namespace hgl struct RenderNode:public Comparator { - uint index; ///<在MaterialRenderList中的索引 + uint index; ///<在MaterialRenderList中的索引 - MeshComponent *sm_component; ///<静态网格组件 + MeshComponent * sm_component; ///<静态网格组件 - uint32 l2w_version; - uint32 l2w_index; + uint32 l2w_version; + uint32 l2w_index; - Vector3f world_position; - float to_camera_distance; + Vector3f world_position; + float to_camera_distance; + + //包围盒 + //屏幕空间Tile分布 public: diff --git a/src/SceneGraph/render/RenderNode.cpp b/src/SceneGraph/render/RenderNode.cpp index 22480ceb..143919f1 100644 --- a/src/SceneGraph/render/RenderNode.cpp +++ b/src/SceneGraph/render/RenderNode.cpp @@ -10,7 +10,9 @@ VK_NAMESPACE_BEGIN * for(material) * for(pipeline) * for(material_instance) -* for(vab) +* for(texture) +* for(screen_tile) +* for(vab) * * * 关于Indirect Command Buffer @@ -22,6 +24,8 @@ const int RenderNode::compare(const RenderNode &other)const { hgl::int64 off; + //RectScope2i screen_tile; + hgl::graph::Mesh *ri_one=other.sm_component->GetMesh(); hgl::graph::Mesh *ri_two=sm_component->GetMesh(); @@ -29,7 +33,6 @@ const int RenderNode::compare(const RenderNode &other)const auto *prim_two=ri_two->GetPrimitive(); //比较VDM - if(prim_one->GetVDM()) //有VDM { off=prim_one->GetVDM() @@ -38,6 +41,14 @@ const int RenderNode::compare(const RenderNode &other)const if(off) return off; + //比较纹理 + { + } + + //比较屏幕空间所占tile + { + } + //比较模型 { off=prim_one @@ -52,6 +63,14 @@ const int RenderNode::compare(const RenderNode &other)const } } + //比较纹理 + { + } + + //比较屏幕空间所占tile + { + } + //比较距离。。。。。。。。。。。。。。。。。。。。。还不知道这个是正了还是反了,等测出来确认后修改下面的返回值和这里的注释 float foff=other.to_camera_distance