diff --git a/example/Vulkan/CMakeLists.txt b/example/Vulkan/CMakeLists.txt index e2a39a76..b053000c 100644 --- a/example/Vulkan/CMakeLists.txt +++ b/example/Vulkan/CMakeLists.txt @@ -24,4 +24,4 @@ CreateProject(09.Atomsphere Atomsphere.cpp) CreateProject(10.Deferred Deferred.cpp TGATexture.cpp) -CreateProject(11.TextureFormat TextureFormat.cpp TGATexture.cpp) \ No newline at end of file +CreateProject(11.TextureFormat TextureFormat.cpp TGATexture.cpp) diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index db2520eb..6e0daaca 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -87,13 +87,11 @@ private: bool InitScene() { - const float rad90=hgl_ang2rad(90); - render_root.Add(db->CreateRenderableInstance(m2d.pipeline,m2d.descriptor_sets,ro_round_rectangle)); render_root.Add(db->CreateRenderableInstance(m3d.pipeline,m3d.descriptor_sets,ro_plane_grid[0])); - render_root.Add(db->CreateRenderableInstance(m3d.pipeline,m3d.descriptor_sets,ro_plane_grid[1]),rotate(rad90,0,1,0)); - render_root.Add(db->CreateRenderableInstance(m3d.pipeline,m3d.descriptor_sets,ro_plane_grid[2]),rotate(rad90,1,0,0)); + render_root.Add(db->CreateRenderableInstance(m3d.pipeline,m3d.descriptor_sets,ro_plane_grid[1]),rotate(HGL_RAD_90,0,1,0)); + render_root.Add(db->CreateRenderableInstance(m3d.pipeline,m3d.descriptor_sets,ro_plane_grid[2]),rotate(HGL_RAD_90,1,0,0)); render_root.RefreshMatrix(); render_root.ExpendToList(&render_list); diff --git a/inc/hgl/TypeFunc.h b/inc/hgl/TypeFunc.h index cf4596ad..a2ed72ff 100644 --- a/inc/hgl/TypeFunc.h +++ b/inc/hgl/TypeFunc.h @@ -252,6 +252,19 @@ namespace hgl constexpr double HGL_COS_ANG_270=0; constexpr double HGL_COS_ANG_315=0.707106781187; + #define HGL_DEF_ANG2RAD(ang) constexpr double HGL_RAD_##ang=double(ang)*(HGL_PI/180.0f); + + HGL_DEF_ANG2RAD(0) + HGL_DEF_ANG2RAD(45) + HGL_DEF_ANG2RAD(90) + HGL_DEF_ANG2RAD(135) + HGL_DEF_ANG2RAD(180) + HGL_DEF_ANG2RAD(225) + HGL_DEF_ANG2RAD(270) + HGL_DEF_ANG2RAD(315) + + #undef HGL_DEF_ANG2RAD + constexpr double HGL_GOLDEN_RATIO =0.61803398874989484820458683436563811772030917980576;//黄金比例 constexpr double HGL_SILVER_RATIO =2.4142135623730950488; //白银比例 diff --git a/res/image/Conical.tga b/res/image/Conical.tga new file mode 100644 index 00000000..df5fe9e3 Binary files /dev/null and b/res/image/Conical.tga differ diff --git a/src/SceneGraph/Coordinate.cpp b/src/SceneGraph/Coordinate.cpp index 872b9792..1bf5ef60 100644 --- a/src/SceneGraph/Coordinate.cpp +++ b/src/SceneGraph/Coordinate.cpp @@ -4,7 +4,7 @@ namespace hgl { namespace graph { - Matrix4f MATRIX_FROM_OPENGL_COORDINATE=scale(1,-1,1)*rotate(hgl_ang2rad(90),Vector3f(1,0,0)); + Matrix4f MATRIX_FROM_OPENGL_COORDINATE=scale(1,-1,1)*rotate(HGL_RAD_90,Vector3f(1,0,0)); }//namespace graph