diff --git a/CMCore b/CMCore index 3c047a68..e4eae3ee 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 3c047a6803801c9f76be5774cf2ea7622751dc77 +Subproject commit e4eae3eef65cd5be96198aac3c2ab08dd4070252 diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index 81aaa372..4491578f 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -86,7 +86,6 @@ private: pgci.color.Set(0,0,0.5,1); pgci.side_color.Set(0,0,1,1); ro_plane_grid[2]=CreateRenderablePlaneGrid(db,vab,&pgci); - } bool InitScene() diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 8c1be6cd..94fa31e7 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -159,9 +159,9 @@ private: { struct CubeCreateInfo cci; - cci.has_normal=true; - cci.has_tangent=true; - cci.has_tex_coord=true; + cci.normal=true; + cci.tangent=true; + cci.tex_coord=true; cci.color_type=CubeCreateInfo::ColorType::SameColor; cci.color[0]=Vector4f(1,1,1,1); ro_cube=CreateRenderableCube(db,vab,&cci); diff --git a/inc/hgl/graph/InlineGeometry.h b/inc/hgl/graph/InlineGeometry.h index decc97bb..14a0e929 100644 --- a/inc/hgl/graph/InlineGeometry.h +++ b/inc/hgl/graph/InlineGeometry.h @@ -95,9 +95,9 @@ namespace hgl struct CubeCreateInfo { - bool has_normal; - bool has_tangent; - bool has_tex_coord; + bool normal; + bool tangent; + bool tex_coord; enum class ColorType { @@ -116,9 +116,9 @@ namespace hgl CubeCreateInfo() { - has_normal=false; - has_tangent=false; - has_tex_coord=false; + normal=false; + tangent=false; + tex_coord=false; color_type=ColorType::NoColor; } @@ -131,7 +131,7 @@ namespace hgl struct BoundingBoxCreateInfo { - bool has_normal; + bool normal; enum class ColorType { @@ -149,7 +149,7 @@ namespace hgl BoundingBoxCreateInfo() { - has_normal=false; + normal=false; color_type=ColorType::NoColor; } diff --git a/src/SceneGraph/InlineGeometry.cpp b/src/SceneGraph/InlineGeometry.cpp index ea887d5a..79d936a2 100644 --- a/src/SceneGraph/InlineGeometry.cpp +++ b/src/SceneGraph/InlineGeometry.cpp @@ -241,7 +241,7 @@ namespace hgl xy_tex_coord[2]=xy_tex_coord[4]=pci->tile.x; xy_tex_coord[5]=xy_tex_coord[7]=pci->tile.y; - tex_coord->GPUBufferData(xy_tex_coord); + tex_coord->Write(xy_tex_coord); } } @@ -266,21 +266,19 @@ namespace hgl * 注:cubemap纹理坐标系依然遵循OpenGL时代定下的坐标系,所以这里的position虽然使用vulkan坐标系,但在shader中当做cubemap纹理坐标使用时,需要在shader中转换为opengl坐标系(交换yz即可) */ - // Points of a cube. - constexpr float points[]={ -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.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.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.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}; + constexpr float positions[]={ -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.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.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.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. - constexpr 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, +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}; + constexpr 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, +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}; constexpr float tangents[] = { +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, @@ -308,15 +306,15 @@ namespace hgl if(!rc.Init(24)) return(nullptr); - rc.WriteVAD(VAN::Position,points,sizeof(points)); + rc.WriteVAD(VAN::Position,positions,sizeof(positions)); - if(cci->has_normal) + if(cci->normal) rc.WriteVAD(VAN::Normal,normals,sizeof(normals)); - if(cci->has_tangent) + if(cci->tangent) rc.WriteVAD(VAN::Tangent,tangents,sizeof(tangents)); - if(cci->has_tex_coord) + if(cci->tex_coord) rc.WriteVAD(VAN::TexCoord,tex_coords,sizeof(tex_coords)); if(cci->color_type!=CubeCreateInfo::ColorType::NoColor)