From 91460aba5a67ff6b6738b7da2ad4ecaea2b828d0 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 24 Sep 2021 20:49:20 +0800 Subject: [PATCH] updated to GLM...but only ortho matrix is OK. --- CMCMakeModule | 2 +- CMCore | 2 +- CMSceneGraph | 2 +- CMakeLists.txt | 3 +-- example/Vulkan/Geometry3D.cpp | 20 ++++++++++---------- example/Vulkan/InlineGeometryScene.cpp | 10 +++++----- example/common/VulkanAppFramework.h | 2 +- inc/hgl/graph/InlineGeometry.h | 4 ++-- res | 2 +- src/SceneGraph/InlineGeometry.cpp | 20 ++++++++++---------- src/SceneGraph/SceneOrient.cpp | 12 ++++++------ 11 files changed, 39 insertions(+), 40 deletions(-) diff --git a/CMCMakeModule b/CMCMakeModule index dd86bf63..e78ebebe 160000 --- a/CMCMakeModule +++ b/CMCMakeModule @@ -1 +1 @@ -Subproject commit dd86bf63150b0f50dcc4a53b79df6cba63b04851 +Subproject commit e78ebebee1c373346ab6da0ee1a174090825f29a diff --git a/CMCore b/CMCore index e4690417..34b70f1b 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit e469041733b2446bad783c5176a1480622f78a0e +Subproject commit 34b70f1b42c97602253a74d1769e60d340729682 diff --git a/CMSceneGraph b/CMSceneGraph index c8141fd2..a7c3577c 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit c8141fd275ce2ac9f4087c446eb04ba1be3a93b3 +Subproject commit a7c3577cba0ec9cff2181cd506c1c33bc0423f4a diff --git a/CMakeLists.txt b/CMakeLists.txt index 9528eb67..5872eff6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ set(ULRE_3RDPTY_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdpty) include(vulkan) include(math) -#use_mgl(${ULRE_3RDPTY_ROOT_PATH}/MathGeoLib) use_glm(${ULRE_3RDPTY_ROOT_PATH}/glm) include(use_cm_module) @@ -38,7 +37,7 @@ SET(ULRE CMCore CMUtil ULRE.Util ULRE.SceneGraph - MathGeoLib + GLM ${RENDER_LIBRARY} ${Vulkan_LIBRARIES}) diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index 4a2a2019..e0db4688 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -71,16 +71,16 @@ private: { struct PlaneGridCreateInfo pgci; - pgci.coord[0].Set(-100,-100,0); - pgci.coord[1].Set( 100,-100,0); - pgci.coord[2].Set( 100, 100,0); - pgci.coord[3].Set(-100, 100,0); + pgci.coord[0]=Vector3f(-100,-100,0); + pgci.coord[1]=Vector3f( 100,-100,0); + pgci.coord[2]=Vector3f( 100, 100,0); + pgci.coord[3]=Vector3f(-100, 100,0); - pgci.step.u=20; - pgci.step.v=20; + pgci.step.x=20; + pgci.step.y=20; - pgci.side_step.u=10; - pgci.side_step.v=10; + pgci.side_step.x=10; + pgci.side_step.y=10; pgci.color.Set(0.5,0,0,1); pgci.side_color.Set(1,0,0,1); @@ -96,12 +96,12 @@ private: pgci.side_color.Set(0,0,1,1); ro_plane_grid[2]=CreateRenderablePlaneGrid(db,material,&pgci); - camera->pos.Set(200,200,200,1.0); + camera->pos=Vector4f(200,200,200,1.0); } bool InitScene() { - Add(ro_plane_grid[0],Matrix4f::identity); + Add(ro_plane_grid[0],Matrix4f()); Add(ro_plane_grid[1],rotate(HGL_RAD_90,0,1,0)); Add(ro_plane_grid[2],rotate(HGL_RAD_90,1,0,0)); diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 37e57b59..42751c9c 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -71,12 +71,12 @@ private: bool InitMaterial() { - light.color.Set(1,1,1,1); - light.position.Set(1000,1000,1000,1.0); + light.color=Vector4f(1,1,1,1); + light.position=Vector4f(1000,1000,1000,1.0); - phong.BaseColor.Set(1,1,1,1); + phong.BaseColor=Vector4f(1,1,1,1); phong.ambient=0.5; - phong.specular.Set(0.3,0.3,0.3,32); + phong.specular=Vector4f(0.3,0.3,0.3,32); { axis_material=db->CreateMaterial(OS_TEXT("res/material/VertexColor3D")); @@ -162,7 +162,7 @@ private: { struct CubeCreateInfo cci; cci.has_color=true; - cci.color.Set(1,1,1,1); + cci.color=Vector4f(1,1,1,1); ro_cube=CreateRenderableCube(db,material,&cci); } diff --git a/example/common/VulkanAppFramework.h b/example/common/VulkanAppFramework.h index fc820373..900a9c78 100644 --- a/example/common/VulkanAppFramework.h +++ b/example/common/VulkanAppFramework.h @@ -42,7 +42,7 @@ protected: void OnMousePressed (int,int,uint mk){mouse_key=mk;MousePressed(mk);} void OnMouseReleased(int,int,uint mk){mouse_key=0;MouseReleased(mk);} - void OnMouseMove (int x,int y){mouse_pos.Set(x,y);MouseMove();} + void OnMouseMove (int x,int y){mouse_pos.x=x;mouse_pos.y=y;MouseMove();} void OnMouseWheel (int v,int h,uint mk){MouseWheel(v,h,mk);} protected: diff --git a/inc/hgl/graph/InlineGeometry.h b/inc/hgl/graph/InlineGeometry.h index f865a699..89eb7127 100644 --- a/inc/hgl/graph/InlineGeometry.h +++ b/inc/hgl/graph/InlineGeometry.h @@ -62,9 +62,9 @@ namespace hgl struct PlaneGridCreateInfo { Vector3f coord[4]; - vec2 step; + Vector2u step; - vec2 side_step; //到边界的步数 + Vector2u side_step; //到边界的步数 Color4f color; //一般线条颜色 Color4f side_color; //边界线条颜色 diff --git a/res b/res index 9385c782..8dbe22e4 160000 --- a/res +++ b/res @@ -1 +1 @@ -Subproject commit 9385c782cc857a87f579d2a022d18918e3526147 +Subproject commit 8dbe22e45adc11317f5d38be04b359655f4dffac diff --git a/src/SceneGraph/InlineGeometry.cpp b/src/SceneGraph/InlineGeometry.cpp index d1a2710c..862d7bec 100644 --- a/src/SceneGraph/InlineGeometry.cpp +++ b/src/SceneGraph/InlineGeometry.cpp @@ -63,7 +63,7 @@ namespace hgl AutoDelete vertex=rc.CreateVADA(VAN::Position); - vec2 *coord=new vec2[rci->round_per]; + Vector2f *coord=new Vector2f[rci->round_per]; float l=rci->scope.GetLeft(), r=rci->scope.GetRight(), @@ -164,21 +164,21 @@ namespace hgl { RenderableCreater rc(db,mtl); - if(!rc.Init(((pgci->step.u+1)+(pgci->step.v+1))*2)) + if(!rc.Init(((pgci->step.x+1)+(pgci->step.y+1))*2)) return(nullptr); AutoDelete vertex=rc.CreateVADA(VAN::Position); - for(uint row=0;row<=pgci->step.u;row++) + for(uint row=0;row<=pgci->step.x;row++) { - float pos=float(row)/float(pgci->step.u); + float pos=float(row)/float(pgci->step.x); vertex->WriteLine( to(pgci->coord[0],pgci->coord[1],pos), to(pgci->coord[3],pgci->coord[2],pos)); } - for(uint col=0;col<=pgci->step.v;col++) + for(uint col=0;col<=pgci->step.y;col++) { - float pos=float(col)/float(pgci->step.v); + float pos=float(col)/float(pgci->step.y); vertex->WriteLine(to(pgci->coord[1],pgci->coord[2],pos), to(pgci->coord[0],pgci->coord[3],pos)); @@ -187,17 +187,17 @@ namespace hgl AutoDelete color=rc.CreateVADA(VAN::Color); if(color) { - for(uint row=0;row<=pgci->step.u;row++) + for(uint row=0;row<=pgci->step.x;row++) { - if((row%pgci->side_step.u)==0) + if((row%pgci->side_step.x)==0) color->Fill(pgci->side_color,2); else color->Fill(pgci->color,2); } - for(uint col=0;col<=pgci->step.v;col++) + for(uint col=0;col<=pgci->step.y;col++) { - if((col%pgci->side_step.v)==0) + if((col%pgci->side_step.y)==0) color->Fill(pgci->side_color,2); else color->Fill(pgci->color,2); diff --git a/src/SceneGraph/SceneOrient.cpp b/src/SceneGraph/SceneOrient.cpp index 6e43aeb9..c651f9de 100644 --- a/src/SceneGraph/SceneOrient.cpp +++ b/src/SceneGraph/SceneOrient.cpp @@ -5,18 +5,18 @@ namespace hgl { SceneOrient::SceneOrient() { - LocalMatrix =Matrix4f::identity; - LocalToWorldMatrix =Matrix4f::identity; - InverseLocalMatrix =Matrix4f::identity; - InverseLocalToWorldMatrix =Matrix4f::identity; + //LocalMatrix =Matrix4f::identity; + //LocalToWorldMatrix =Matrix4f::identity; + //InverseLocalMatrix =Matrix4f::identity; + //InverseLocalToWorldMatrix =Matrix4f::identity; } SceneOrient::SceneOrient(const Matrix4f &mat) { SetLocalMatrix(mat); - LocalToWorldMatrix =Matrix4f::identity; - InverseLocalToWorldMatrix =Matrix4f::identity; + //LocalToWorldMatrix =Matrix4f::identity; + //InverseLocalToWorldMatrix =Matrix4f::identity; } Matrix4f &SceneOrient::SetLocalMatrix(const Matrix4f &m)