diff --git a/inc/hgl/graph/vulkan/VK.h b/inc/hgl/graph/vulkan/VK.h index 9c27723f..6f463ff3 100644 --- a/inc/hgl/graph/vulkan/VK.h +++ b/inc/hgl/graph/vulkan/VK.h @@ -75,9 +75,6 @@ enum class ShaderStageBit struct PushConstant { Matrix4f local_to_world; - Matrix3f normal; - Vector3f object_position; - Vector3f object_size; }; constexpr uint32_t MAX_PUSH_CONSTANT_BYTES=sizeof(PushConstant); diff --git a/inc/hgl/graph/vulkan/VKCommandBuffer.h b/inc/hgl/graph/vulkan/VKCommandBuffer.h index 85f1679d..9e04ee99 100644 --- a/inc/hgl/graph/vulkan/VKCommandBuffer.h +++ b/inc/hgl/graph/vulkan/VKCommandBuffer.h @@ -120,7 +120,7 @@ public: vkCmdPushConstants(cmd_buf,pipeline_layout,(VkShaderStageFlagBits)shader_stage_bit,offset,size,pValues); } - void PushConstants(const PushConstant *pc){vkCmdPushConstants(cmd_buf,pipeline_layout,VK_SHADER_STAGE_VERTEX_BIT,0,sizeof(PushConstant),pc);} + void PushConstants(const void *data,const uint32_t size){vkCmdPushConstants(cmd_buf,pipeline_layout,VK_SHADER_STAGE_VERTEX_BIT,0,size,data);} bool Bind(Renderable *); diff --git a/src/SceneGraph/RenderList.cpp b/src/SceneGraph/RenderList.cpp index b6c3079c..de6d42c5 100644 --- a/src/SceneGraph/RenderList.cpp +++ b/src/SceneGraph/RenderList.cpp @@ -49,7 +49,7 @@ namespace hgl { last_pc=node->GetPushConstant(); - cmd_buf->PushConstants(last_pc); + cmd_buf->PushConstants(last_pc,sizeof(vulkan::PushConstant)); } //更新fin_mvp diff --git a/src/SceneGraph/SceneOrient.cpp b/src/SceneGraph/SceneOrient.cpp index cfbe59ff..80ea9230 100644 --- a/src/SceneGraph/SceneOrient.cpp +++ b/src/SceneGraph/SceneOrient.cpp @@ -12,8 +12,6 @@ namespace hgl LocalToWorldMatrix =Matrix4f::identity; InverseLocalMatrix =Matrix4f::identity; InverseLocalToWorldMatrix =Matrix4f::identity; - - pc.normal =Matrix3f::identity; } Matrix4f &SceneOrient::SetLocalMatrix(const Matrix4f &m) @@ -32,7 +30,6 @@ namespace hgl InverseLocalToWorldMatrix=inverse(LocalToWorldMatrix); pc.local_to_world =LocalToWorldMatrix; - pc.normal =pc.local_to_world.Float3x3Part(); // pc.object_position =; // pc.object_size =;