diff --git a/build.gradle b/build.gradle index 8af48c8..8c95eae 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" compile 'com.github.kotlin-graphics:uno-sdk:fc67ccf36c7da5baffa41efab4c5911be41c9c77' - compile 'com.github.kotlin-graphics:assimp:0c7d00d227e8fd2fdb04bc6916dbee60df051026' + compile 'com.github.kotlin-graphics:assimp:c224cf47516bc91a848a4dea88bf82d5327074a0' implementation 'com.github.kotlin-graphics:imgui:b721ceaf260a47fa3623ab8d780ecfbe3510ec21' ext.spirvCrossVersion = "0.4.0" diff --git a/src/main/kotlin/vulkan/basics/02 Pipelines.kt b/src/main/kotlin/vulkan/basics/02 Pipelines.kt index 572153f..9ac8a94 100644 --- a/src/main/kotlin/vulkan/basics/02 Pipelines.kt +++ b/src/main/kotlin/vulkan/basics/02 Pipelines.kt @@ -49,20 +49,12 @@ private class Pipelines : VulkanExampleBase() { val uniformBuffer = Buffer() /** Same uniform buffer layout as shader */ - object uboVS { + object uboVS : Bufferizable() { var projection = Mat4() var modelView = Mat4() val lightPos = Vec4(0f, 2f, 1f, 0f) - fun pack() { - projection to buffer - modelView.to(buffer, Mat4.size) - lightPos.to(buffer, Mat4.size * 2) - } - - val size = Mat4.size * 2 + Vec4.size - val buffer = bufferBig(size) - val address = memAddress(buffer) + override val fieldOrder = arrayOf("projection", "modelView", "lightPos") } var pipelineLayout: VkPipelineLayout = NULL @@ -343,8 +335,7 @@ private class Pipelines : VulkanExampleBase() { .rotateAssign(rotation.y.rad, 0f, 1f, 0f) .rotateAssign(rotation.z.rad, 0f, 0f, 1f) - uboVS.pack() - memCopy(uboVS.address, uniformBuffer.mapped[0], uboVS.size.L) + uboVS to uniformBuffer.mapped[0] } fun draw() {