diff --git a/ShaderLibrary/Std3D/BlinnPhongPureColor.mtl b/ShaderLibrary/Std3D/BlinnPhongPureColor.mtl index 358d6ab9..fa8f2412 100644 --- a/ShaderLibrary/Std3D/BlinnPhongPureColor.mtl +++ b/ShaderLibrary/Std3D/BlinnPhongPureColor.mtl @@ -23,9 +23,10 @@ Output Code { - - - gl_Position=GetPosition3D(); + void main() + { + gl_Position=GetPosition3D(); + } } #Fragment diff --git a/example/Gizmo/PlaneGrid3D.cpp b/example/Gizmo/PlaneGrid3D.cpp index 8f5ffd05..03c029b6 100644 --- a/example/Gizmo/PlaneGrid3D.cpp +++ b/example/Gizmo/PlaneGrid3D.cpp @@ -92,7 +92,7 @@ private: camera_control->SetTarget(Vector3f(0,0,0)); camera_control->Refresh(); - cmc->SetReserveDirection(true,true); //反转x,y + camera_control->SetReserveDirection(true,true); //反转x,y render_root.RefreshMatrix(); render_list->Expend(&render_root); diff --git a/inc/hgl/graph/VKMaterial.h b/inc/hgl/graph/VKMaterial.h index 78401aa5..a23f9f9f 100644 --- a/inc/hgl/graph/VKMaterial.h +++ b/inc/hgl/graph/VKMaterial.h @@ -81,6 +81,8 @@ public: bool BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false); bool BindImageSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler); + void Update(); + public: const bool HasMI ()const{return mi_data_bytes>0;} diff --git a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp index 7b6c0aa1..5cc9eed6 100644 --- a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp +++ b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp @@ -117,6 +117,8 @@ bool RenderCmdBuffer::BindDescriptorSets(Material *mtl) if(mp) { + mp->Update(); + ds[count]=mp->GetVkDescriptorSet(); ++count; } diff --git a/src/SceneGraph/Vulkan/VKMaterial.cpp b/src/SceneGraph/Vulkan/VKMaterial.cpp index 2a4e87cb..794f1fa6 100644 --- a/src/SceneGraph/Vulkan/VKMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKMaterial.cpp @@ -33,8 +33,8 @@ Material::~Material() SAFE_CLEAR(desc_manager); SAFE_CLEAR(pipeline_layout_data); - for(int i=0;iBindUBO(name,ubo,dynamic))return(false); - - mp->Update(); - return(true); + return mp->BindUBO(name,ubo,dynamic); } bool Material::BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic) @@ -87,10 +84,7 @@ bool Material::BindSSBO(const DescriptorSetType &type,const AnsiString &name,Dev if(!mp) return(false); - if(!mp->BindSSBO(name,ubo,dynamic))return(false); - - mp->Update(); - return(true); + return mp->BindSSBO(name,ubo,dynamic); } bool Material::BindImageSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler) @@ -100,9 +94,15 @@ bool Material::BindImageSampler(const DescriptorSetType &type,const AnsiString & if(!mp) return(false); - if(!mp->BindImageSampler(name,tex,sampler))return(false); + return mp->BindImageSampler(name,tex,sampler); +} - mp->Update(); - return(true); +void Material::Update() +{ + for(auto &mp:mp_array) + { + if(mp) + mp->Update(); + } } VK_NAMESPACE_END