func (ms *TransformStack) Unwind(n int) error {
	if n > len(*ms)-1 {
		return errors.New("Cannot unwind a matrix to below 1 value")
	}
	(*ms) = (*ms)[:len(*ms)-n]
	return nil
}
Unwind cuts down the matrix as if Pop had been called n times. If n would
bring the matrix down below 1 element, this does nothing and returns an
error.
package matstack
import (
	"errors"
	"fmt"
	"github.com/go-gl/mathgl/mgl32"
)
type TransformStack []mgl32.Mat4
func NewTransformStack() *TransformStack {
	ms := make(TransformStack, 1)
	ms[0] = mgl32.Ident4()
	return &ms
}
func (ms *TransformStack) Push(m mgl32.Mat4) {
	prev := (*ms)[len(*ms)-1]
	(*ms) = append(*ms, prev.Mul4(m))
}
func (ms *TransformStack) Pop() (mgl32.Mat4, error) {
	if len(*ms) == 1 {
		return mgl32.Mat4{}, errors.New("attempt to pop last element of the stack; Matrix Stack must have at least one element")
	}
	retVal := (*ms)[len(*ms)-1]
	(*ms) = (*ms)[:len(*ms)-1]
	return retVal, nil
}
func (ms *TransformStack) Peek() mgl32.Mat4 {
	return (*ms)[len(*ms)-1]
}
func (ms *TransformStack) Len() int {
	return len(*ms)
}