MatrixStack.cpp 372 B

123456789101112131415161718192021222324252627
  1. #include <cassert>
  2. #include "client/math/MatrixStack.h"
  3. void MatrixStack::pop()
  4. {
  5. assert(index > 0);
  6. index--;
  7. }
  8. void MatrixStack::push()
  9. {
  10. assert(index < stack.size() - 1);
  11. index++;
  12. stack[index] = stack[index - 1];
  13. }
  14. Matrix& MatrixStack::get()
  15. {
  16. return stack[index];
  17. }
  18. void MatrixStack::clear()
  19. {
  20. index = 0;
  21. stack[0].setToIdentity();
  22. }