diff --git a/CMSceneGraph b/CMSceneGraph index 5c88829f..3fdd97bc 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit 5c88829fc7945c24c824c0aceaabb913df2d3a1d +Subproject commit 3fdd97bcf5ec3ef4cc703562a35cebfb84c7484a diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 82144b4e..5c7d4feb 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -79,7 +79,7 @@ private: light.position.Set(1000,1000,1000,1.0); phong.BaseColor.Set(1,1,1,1); - phong.ambient=0.05; + phong.ambient=0.5; phong.specular.Set(0.3,0.3,0.3,32); { @@ -141,7 +141,7 @@ private: ro_cube=CreateRenderableCube(db,material,&cci); } - { + { ro_sphere=CreateRenderableSphere(db,material,64); } @@ -190,8 +190,7 @@ private: if(!material_instance->BindUBO("world",GetCameraMatrixBuffer())) return(false); - if(!material_instance->BindUBO("fs_light",ubo_light)) - return(false); + material_instance->BindUBO("fs_light",ubo_light); material_instance->Update(); @@ -219,7 +218,7 @@ private: bool InitScene() { render_root.Add(db->CreateRenderableInstance(ro_axis,axis_mi,axis_pipeline)); - Add(ro_torus ,pipeline_solid);//,rotate(90,Vector3f(1,0,0))); + Add(ro_torus ,pipeline_solid); Add(ro_cube ,pipeline_solid,translate(-10, 0, 5)*scale(10,10,10)); Add(ro_sphere ,pipeline_solid,translate( 10, 0, 5)*scale(10,10,10)); Add(ro_cylinder ,pipeline_solid,translate( 0, 16, 0)); diff --git a/src/SceneGraph/InlineGeometry.cpp b/src/SceneGraph/InlineGeometry.cpp index 7c54db6f..094924ed 100644 --- a/src/SceneGraph/InlineGeometry.cpp +++ b/src/SceneGraph/InlineGeometry.cpp @@ -255,10 +255,10 @@ namespace hgl /* /| /| */ -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f, +0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, +0.5f, /* 0/ | 1/ | */ -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, -0.5f, +0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f }; /* *--+---------* | */ // Normals of a cube. - /* | | | | */ const float normals[]={ +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, - /* | 7| | 6| */ +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, - /* | *---------+--* */ +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, - /* | / | / */ -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f }; + /* | | | | */ const float normals[]={ +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, + /* | 7| | 6| */ +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, + /* | *---------+--* */ +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, -1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f, + /* | / | / */ -1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f }; /* |/ 2|/ */ // The associated indices. /* 3*------------* */ const uint16 indices[]={ 0, 2, 1, 0, 3, 2, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 15, 14, 12, 14, 13, 16, 17, 18, 16, 18, 19, 20, 23, 22, 20, 22, 21 }; @@ -469,9 +469,9 @@ namespace hgl if(np) { - *np=x;++np; - *np=y;++np; - *np=z;++np; + *np=+x;++np; + *np=-y;++np; + *np=+z;++np; } if(tcp) @@ -695,9 +695,9 @@ namespace hgl // generate normal and stores it in the right position // NOTE: cos (2PIx) = cos (x) and sin (2PIx) = sin (x) so, we can use this formula // normal = {cos(2PIs)cos(2PIt) , sin(2PIs)cos(2PIt) ,sin(2PIt)} - *np = cos2PIs * cos2PIt; ++np; - *np = sin2PIt; ++np; - *np = sin2PIs * cos2PIt; ++np; + *np = +cos2PIs * cos2PIt; ++np; + *np = -sin2PIt; ++np; + *np = +sin2PIs * cos2PIt; ++np; } if(tcp) @@ -927,7 +927,7 @@ namespace hgl if(np) { *np = cos(currentAngle); ++np; - *np = -sin(currentAngle); ++np; + *np = sin(currentAngle); ++np; *np = 0.0f; ++np; } @@ -1096,7 +1096,7 @@ namespace hgl if(np) { *np = h / l * cos(currentAngle); ++np; - *np = h / l * -sin(currentAngle); ++np; + *np = h / l * sin(currentAngle); ++np; *np = r / l; ++np; }