package speiger.src.coreengine.math.vector.matrix;

import speiger.src.collections.objects.lists.ObjectArrayList;
import speiger.src.collections.utils.Stack;

public class Matrix4fStack extends Matrix4f {
	Stack<Matrix4f> stack = new ObjectArrayList<>();
	
	public Matrix4f push() {
		Matrix4f matrix = new Matrix4f(this);
		stack.push(matrix);
		return matrix;
	}
	
	public void pop() {
		load(stack.pop());
	}
	
	public void popRoot() {
		load(stack.peek(stack.size()-1));
		stack.clear();
	}
	
	public int size() {
		return stack.size();
	}
	
	public Matrix4f copyCurrent() {
		return new Matrix4f(this);
	}
}
