增加HGL_RAD系列宏

This commit is contained in:
hyzboy 2019-08-02 19:32:31 +08:00
parent 888c99376f
commit 5659a5a107
5 changed files with 17 additions and 6 deletions

View File

@ -24,4 +24,4 @@ CreateProject(09.Atomsphere Atomsphere.cpp)
CreateProject(10.Deferred Deferred.cpp TGATexture.cpp) CreateProject(10.Deferred Deferred.cpp TGATexture.cpp)
CreateProject(11.TextureFormat TextureFormat.cpp TGATexture.cpp) CreateProject(11.TextureFormat TextureFormat.cpp TGATexture.cpp)

View File

@ -87,13 +87,11 @@ private:
bool InitScene() 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(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[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[1]),rotate(HGL_RAD_90,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[2]),rotate(HGL_RAD_90,1,0,0));
render_root.RefreshMatrix(); render_root.RefreshMatrix();
render_root.ExpendToList(&render_list); render_root.ExpendToList(&render_list);

View File

@ -252,6 +252,19 @@ namespace hgl
constexpr double HGL_COS_ANG_270=0; constexpr double HGL_COS_ANG_270=0;
constexpr double HGL_COS_ANG_315=0.707106781187; 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_GOLDEN_RATIO =0.61803398874989484820458683436563811772030917980576;//黄金比例
constexpr double HGL_SILVER_RATIO =2.4142135623730950488; //白银比例 constexpr double HGL_SILVER_RATIO =2.4142135623730950488; //白银比例

BIN
res/image/Conical.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View File

@ -4,7 +4,7 @@ namespace hgl
{ {
namespace graph 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 }//namespace graph