diff --git a/3rdpty/MathGeoLib b/3rdpty/MathGeoLib index 47599c77..2940b99b 160000 --- a/3rdpty/MathGeoLib +++ b/3rdpty/MathGeoLib @@ -1 +1 @@ -Subproject commit 47599c77c46034c1cd78dbb93ba5f5495c27b185 +Subproject commit 2940b99b99cfe575dd45103ef20f4019dee15b54 diff --git a/CMCMakeModule b/CMCMakeModule index e15c5ce0..4b71f19e 160000 --- a/CMCMakeModule +++ b/CMCMakeModule @@ -1 +1 @@ -Subproject commit e15c5ce039e72b8cc8140b3d4ea363754a4490d7 +Subproject commit 4b71f19e46167c9bb70bb11cf19b8f8c335d40b3 diff --git a/CMCore b/CMCore index 162a6ce2..d065f247 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 162a6ce2f2cc5d24a177acf9b3c2ce9a0055e1f5 +Subproject commit d065f24770fae3132012f11312495b3dc5ff3892 diff --git a/CMPlatform b/CMPlatform index 72b54414..ea2aaf31 160000 --- a/CMPlatform +++ b/CMPlatform @@ -1 +1 @@ -Subproject commit 72b54414ac9148fc0adb7606f15932f388901dc9 +Subproject commit ea2aaf3126ad6d64a4999c9b493c7dd560f79bc0 diff --git a/CMSceneGraph b/CMSceneGraph index aaf99835..275dce7c 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit aaf998351f639a3854b0d99340ccf68337d6f767 +Subproject commit 275dce7c49fd0d1b5ab61a51d18d356ddd2526d1 diff --git a/example/2dVector/line.cpp b/example/2dVector/line.cpp index 6ca581de..b062a14d 100644 --- a/example/2dVector/line.cpp +++ b/example/2dVector/line.cpp @@ -37,7 +37,7 @@ private: MaterialInstance * material_instance =nullptr; RenderableInstance *render_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; GPUBuffer * ubo_color_material =nullptr; GPUBuffer * ubo_line_config =nullptr; @@ -88,7 +88,7 @@ private: cam.Refresh(); - ubo_world_matrix =CreateUBO("world", sizeof(WorldMatrix), &cam.matrix); + ubo_camera_matrix =CreateUBO("camera", sizeof(CameraMatrix), &cam.matrix); ubo_color_material =CreateUBO("color_material",sizeof(Vector4f), &color); ubo_line_config =CreateUBO("line2d_config", sizeof(Line2DConfig), &line_2d_config); @@ -135,7 +135,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(render_instance); } diff --git a/example/Vulkan/Atomsphere.cpp b/example/Vulkan/Atomsphere.cpp index 57c218b0..46b80ec3 100644 --- a/example/Vulkan/Atomsphere.cpp +++ b/example/Vulkan/Atomsphere.cpp @@ -61,7 +61,7 @@ private: bool InitUBO() { - if(!material_instance->BindUBO("world",GetCameraMatrixBuffer())) + if(!material_instance->BindUBO("camera",GetCameraMatrixBuffer())) return(false); ubo_atomsphere=db->CreateUBO(sizeof(AtmosphereData),&atomsphere_data); diff --git a/example/Vulkan/DeferredModel.cpp b/example/Vulkan/DeferredModel.cpp index b73a6452..5073f306 100644 --- a/example/Vulkan/DeferredModel.cpp +++ b/example/Vulkan/DeferredModel.cpp @@ -193,12 +193,12 @@ private: sampler=db->CreateSampler(&sampler_create_info); - sp_gbuffer.material_instance->BindUBO("world",GetCameraMatrixBuffer()); + sp_gbuffer.material_instance->BindUBO("camera",GetCameraMatrixBuffer()); sp_gbuffer.material_instance->BindSampler("TexColor" ,texture.color, sampler); sp_gbuffer.material_instance->BindSampler("TexNormal" ,texture.normal, sampler); sp_gbuffer.material_instance->Update(); - sp_composition.material_instance->BindUBO("world",GetCameraMatrixBuffer()); + sp_composition.material_instance->BindUBO("camera",GetCameraMatrixBuffer()); sp_composition.material_instance->BindUBO("lights",ubo_lights); sp_composition.material_instance->BindSampler("GB_Color" ,gbuffer.rt->GetColorTexture((uint)GBufferAttachment::Color),sampler); sp_composition.material_instance->BindSampler("GB_Normal" ,gbuffer.rt->GetColorTexture((uint)GBufferAttachment::Normal),sampler); diff --git a/example/Vulkan/DrawText.cpp b/example/Vulkan/DrawText.cpp index 22686866..4076d0d3 100644 --- a/example/Vulkan/DrawText.cpp +++ b/example/Vulkan/DrawText.cpp @@ -28,7 +28,7 @@ private: Sampler * sampler =nullptr; MaterialInstance * material_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; GPUBuffer * ubo_color =nullptr; Pipeline * pipeline =nullptr; @@ -65,7 +65,7 @@ private: sampler=db->CreateSampler(); material_instance->BindSampler("lum_texture",tile_font->GetTexture(),sampler); - material_instance->BindUBO("world",ubo_world_matrix); + material_instance->BindUBO("camera",ubo_camera_matrix); material_instance->BindUBO("color_material",ubo_color); material_instance->Update(); @@ -81,9 +81,9 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); color.One(); @@ -181,7 +181,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(render_instance); } diff --git a/example/Vulkan/DrawTile.cpp b/example/Vulkan/DrawTile.cpp index 27e0b2df..59be091f 100644 --- a/example/Vulkan/DrawTile.cpp +++ b/example/Vulkan/DrawTile.cpp @@ -42,7 +42,7 @@ private: MaterialInstance * material_instance =nullptr; Renderable * render_obj =nullptr; RenderableInstance *render_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; @@ -155,7 +155,7 @@ private: sampler=db->CreateSampler(); material_instance->BindSampler("tex",tile_data->GetTexture(),sampler); - material_instance->BindUBO("world",ubo_world_matrix); + material_instance->BindUBO("camera",ubo_camera_matrix); material_instance->Update(); return(true); @@ -170,9 +170,9 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); return(true); @@ -227,7 +227,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(render_instance); } diff --git a/example/Vulkan/FragCoordTest.cpp b/example/Vulkan/FragCoordTest.cpp index 47bf8580..aad25bcb 100644 --- a/example/Vulkan/FragCoordTest.cpp +++ b/example/Vulkan/FragCoordTest.cpp @@ -28,7 +28,7 @@ private: MaterialInstance * material_instance =nullptr; RenderableInstance *renderable_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; @@ -58,13 +58,13 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); - if(!material_instance->BindUBO("world",ubo_world_matrix))return(false); - if(!material_instance->BindUBO("frag_world",ubo_world_matrix))return(false); + if(!material_instance->BindUBO("camera",ubo_camera_matrix))return(false); + if(!material_instance->BindUBO("frag_world",ubo_camera_matrix))return(false); material_instance->Update(); return(true); @@ -109,7 +109,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(renderable_instance); } diff --git a/example/Vulkan/Geometry2D.cpp b/example/Vulkan/Geometry2D.cpp index 75eb1599..9efc7c24 100644 --- a/example/Vulkan/Geometry2D.cpp +++ b/example/Vulkan/Geometry2D.cpp @@ -35,7 +35,7 @@ private: Renderable * ro_circle =nullptr; Renderable * ro_round_rectangle =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; GPUBuffer * ubo_color_material =nullptr; Pipeline * pipeline =nullptr; @@ -118,7 +118,7 @@ private: cam.Refresh(); - ubo_world_matrix =CreateUBO("world", sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix =CreateUBO("camera", sizeof(CameraMatrix),&cam.matrix); ubo_color_material =CreateUBO("color_material",sizeof(Vector4f),&color); material_instance->Update(); @@ -164,7 +164,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(&render_list); } diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index c093b64d..d72771f9 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -46,7 +46,7 @@ private: mdp->pipeline=CreatePipeline(mdp->material_instance,InlinePipeline::Solid3D,primitive); - if(!mdp->material_instance->BindUBO("world",GetCameraMatrixBuffer())) + if(!mdp->material_instance->BindUBO("camera",GetCameraMatrixBuffer())) return(false); mdp->material_instance->Update(); diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index b8651891..91db362e 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -204,14 +204,14 @@ private: material_instance->BindUBO("light",ubo_light); material_instance->BindUBO("phong",ubo_phong); - if(!material_instance->BindUBO("world",GetCameraMatrixBuffer())) + if(!material_instance->BindUBO("camera",GetCameraMatrixBuffer())) return(false); material_instance->BindUBO("fs_light",ubo_light); material_instance->Update(); - if(!axis_mi->BindUBO("world",GetCameraMatrixBuffer())) + if(!axis_mi->BindUBO("camera",GetCameraMatrixBuffer())) return(false); axis_mi->Update(); diff --git a/example/Vulkan/OffscreenRender.cpp b/example/Vulkan/OffscreenRender.cpp index 20755635..95019b20 100644 --- a/example/Vulkan/OffscreenRender.cpp +++ b/example/Vulkan/OffscreenRender.cpp @@ -16,7 +16,7 @@ class TestApp:public CameraAppFramework Camera cam; MaterialInstance * material_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; }; struct:public RenderObject @@ -65,12 +65,12 @@ public: ro->cam.Refresh(); - ro->ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&ro->cam.matrix); + ro->ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&ro->cam.matrix); - if(!ro->ubo_world_matrix) + if(!ro->ubo_camera_matrix) return(false); - ro->material_instance->BindUBO("world",ro->ubo_world_matrix); + ro->material_instance->BindUBO("camera",ro->ubo_camera_matrix); ro->material_instance->Update(); return(true); } @@ -131,7 +131,7 @@ public: if(!cube.sampler)return(false); cube.material_instance->BindSampler("tex",os.render_taget->GetColorTexture(),cube.sampler); - cube.material_instance->BindUBO("world",GetCameraMatrixBuffer()); + cube.material_instance->BindUBO("camera",GetCameraMatrixBuffer()); cube.material_instance->Update(); { @@ -148,7 +148,7 @@ public: cube.scene_root.RefreshMatrix(); cube.scene_root.ExpendToList(&cube.render_list); - camera.eye.Set(5,5,5,1.0); + camera->pos.Set(5,5,5,1.0); return(true); } diff --git a/example/Vulkan/RectanglePrimitive.cpp b/example/Vulkan/RectanglePrimitive.cpp index 02ba9571..94b85aae 100644 --- a/example/Vulkan/RectanglePrimitive.cpp +++ b/example/Vulkan/RectanglePrimitive.cpp @@ -41,7 +41,7 @@ private: MaterialInstance * material_instance =nullptr; Renderable * render_obj =nullptr; RenderableInstance *render_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; @@ -61,7 +61,7 @@ private: sampler=db->CreateSampler(); material_instance->BindSampler("tex",texture,sampler); - material_instance->BindUBO("world",ubo_world_matrix); + material_instance->BindUBO("camera",ubo_camera_matrix); material_instance->Update(); db->Add(texture); @@ -77,9 +77,9 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); return(true); @@ -127,7 +127,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(render_instance); } diff --git a/example/Vulkan/first_triangle.cpp b/example/Vulkan/first_triangle.cpp index 7f4effd3..b20865de 100644 --- a/example/Vulkan/first_triangle.cpp +++ b/example/Vulkan/first_triangle.cpp @@ -34,7 +34,7 @@ private: MaterialInstance * material_instance =nullptr; RenderableInstance *render_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; @@ -62,12 +62,12 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); - material_instance->BindUBO("world",ubo_world_matrix); + material_instance->BindUBO("camera",ubo_camera_matrix); material_instance->Update(); return(true); } @@ -113,7 +113,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(render_instance); } diff --git a/example/Vulkan/indices_rect.cpp b/example/Vulkan/indices_rect.cpp index 3f42b596..85264c8e 100644 --- a/example/Vulkan/indices_rect.cpp +++ b/example/Vulkan/indices_rect.cpp @@ -38,7 +38,7 @@ private: MaterialInstance * material_instance =nullptr; RenderableInstance *renderable_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; @@ -62,13 +62,13 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); - if(!material_instance->BindUBO("world",ubo_world_matrix))return(false); - if(!material_instance->BindUBO("frag_world",ubo_world_matrix))return(false); + if(!material_instance->BindUBO("camera",ubo_camera_matrix))return(false); + if(!material_instance->BindUBO("frag_world",ubo_camera_matrix))return(false); material_instance->Update(); return(true); @@ -115,7 +115,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(renderable_instance); } diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index fdce93ac..71c2da18 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -53,7 +53,7 @@ private: Sampler * sampler =nullptr; MaterialInstance * material_instance =nullptr; RenderableInstance *renderable_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; private: @@ -85,12 +85,12 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); - if(!material_instance->BindUBO("world",ubo_world_matrix))return(false); + if(!material_instance->BindUBO("camera",ubo_camera_matrix))return(false); material_instance->Update(); return(true); } @@ -137,7 +137,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(renderable_instance); } diff --git a/example/Vulkan/two_triangle.cpp b/example/Vulkan/two_triangle.cpp index a009b07c..5d89568e 100644 --- a/example/Vulkan/two_triangle.cpp +++ b/example/Vulkan/two_triangle.cpp @@ -37,7 +37,7 @@ private: MaterialInstance * material_instance =nullptr; RenderableInstance *render_instance =nullptr; - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; Pipeline * pipeline =nullptr; @@ -65,12 +65,12 @@ private: cam.Refresh(); - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&cam.matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&cam.matrix); - if(!ubo_world_matrix) + if(!ubo_camera_matrix) return(false); - material_instance->BindUBO("world",ubo_world_matrix); + material_instance->BindUBO("camera",ubo_camera_matrix); material_instance->Update(); return(true); } @@ -119,7 +119,7 @@ public: cam.Refresh(); - ubo_world_matrix->Write(&cam.matrix); + ubo_camera_matrix->Write(&cam.matrix); BuildCommandBuffer(&render_list); } diff --git a/example/common/VulkanAppFramework.h b/example/common/VulkanAppFramework.h index b1d92fea..7a400e36 100644 --- a/example/common/VulkanAppFramework.h +++ b/example/common/VulkanAppFramework.h @@ -300,7 +300,7 @@ class CameraAppFramework:public VulkanApplicationFramework { private: - GPUBuffer * ubo_world_matrix =nullptr; + GPUBuffer * ubo_camera_matrix =nullptr; protected: @@ -340,7 +340,7 @@ public: camera->Refresh(); //更新矩阵计算 - ubo_world_matrix=db->CreateUBO(sizeof(WorldMatrix),&camera->matrix); + ubo_camera_matrix=db->CreateUBO(sizeof(CameraMatrix),&camera->matrix); } void Resize(int w,int h)override @@ -351,7 +351,7 @@ public: GPUBuffer *GetCameraMatrixBuffer() { - return ubo_world_matrix; + return ubo_camera_matrix; } virtual void BuildCommandBuffer(uint32_t index)=0; @@ -359,7 +359,7 @@ public: virtual void Draw()override { camera->Refresh(); //更新相机矩阵 - ubo_world_matrix->Write(&camera->matrix); //写入缓冲区 + ubo_camera_matrix->Write(&camera->matrix); //写入缓冲区 const uint32_t index=AcquireNextImage(); diff --git a/inc/hgl/graph/shader/ShaderResource.h b/inc/hgl/graph/shader/ShaderResource.h index 7d791444..96a1bfa3 100644 --- a/inc/hgl/graph/shader/ShaderResource.h +++ b/inc/hgl/graph/shader/ShaderResource.h @@ -12,7 +12,7 @@ VK_NAMESPACE_BEGIN */ enum class ShaderDataSource { - Global=0, ///<由全局系统提供的数据(如WorldMatrix) + Global=0, ///<由全局系统提供的数据(如CameraMatrix) Private=1, ///<每种材质的私有数据 };//