Hi,
In Chapter 23 (Animation), once all the transform stuff was implemented, in ./Game/Render
ing.swift, the your sample code contains:
for mesh in meshes {
let currentLocalTransform =
mesh.transform?.currentTransform ?? .identity
uniforms.modelMatrix =
transform.modelMatrix * currentLocalTransform
uniforms.normalMatrix = uniforms.modelMatrix.upperLeft
encoder.setVertexBytes(
&uniforms,
length: MemoryLayout<Uniforms>.stride,
index: UniformsBuffer.index)
So, as I was going through the tutorial, I fat fingered the assignment of uniforms.modelMatrix and, in my code, I had:
uniforms.modelMatrix =
currentLocalTransform
Initially, I fixed this by adding the code (to the previous line)
let currentLocalTransform =
mesh.transform?.currentTransform ?? transform.modelMatrix
And this “fixed” my typo.
I did go back to your code and found my mis-type.
My question: I’m “pretty sure” (for varying degrees of “pretty sure”) that the code is
equivalent, but can you see any situation where it wouldn’t be? I’m trying to make sure I didn’t “miss” any potential problem.
Thanks for your patience