go-gl / mathgl

A pure Go 3D math library.
BSD 3-Clause "New" or "Revised" License
554 stars 65 forks source link

MatStack.LeftMul performs same process as Mat.Stack.RightMul #37

Closed beaubrueggemann closed 9 years ago

beaubrueggemann commented 9 years ago

Both mgl32 and mgl64 versions of matstack.MatStack contain a peculiar LeftMul method:

// Left multiplies the current top of the matrix by the
// argument.
func (ms *MatStack) LeftMul(m mgl32.Mat4) {
        (*ms)[len(*ms)-1] = (*ms)[len(*ms)-1].Mul4(m)
}

This incorrectly performs a right multiply (it matches exactly the RightMul implementation). The operands to Mul4 need to be swapped.

dmitshur commented 9 years ago

That does look like an issue, thanks for reporting!

Would you like to make a PR that fixes it? I think it'd have a good chance of being merged.