Renderer.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "client/rendering/Renderer.h"
  2. Renderer::Renderer(Shader& shader, MatrixStack& stack) : shader(shader), stack(stack) {
  3. }
  4. void Renderer::pop() {
  5. stack.pop();
  6. }
  7. void Renderer::push() {
  8. stack.push();
  9. }
  10. Renderer& Renderer::update() {
  11. shader.setMatrix("model", stack.get().getValues());
  12. return *this;
  13. }
  14. Renderer& Renderer::scale(float sx, float sy, float sz) {
  15. stack.get().scale(sx, sy, sz);
  16. return *this;
  17. }
  18. Renderer& Renderer::scale(float s) {
  19. stack.get().scale(s);
  20. return *this;
  21. }
  22. Renderer& Renderer::translate(float tx, float ty, float tz) {
  23. stack.get().translate(tx, ty, tz);
  24. return *this;
  25. }
  26. Renderer& Renderer::translateX(float tx) {
  27. stack.get().translateX(tx);
  28. return *this;
  29. }
  30. Renderer& Renderer::translateY(float ty) {
  31. stack.get().translateY(ty);
  32. return *this;
  33. }
  34. Renderer& Renderer::translateZ(float tz) {
  35. stack.get().translateZ(tz);
  36. return *this;
  37. }
  38. Renderer& Renderer::translateTo(float tx, float ty, float tz) {
  39. stack.get().translateTo(tx, ty, tz);
  40. return *this;
  41. }
  42. Renderer& Renderer::rotateX(float degrees) {
  43. stack.get().rotateX(degrees);
  44. return *this;
  45. }
  46. Renderer& Renderer::rotateY(float degrees) {
  47. stack.get().rotateY(degrees);
  48. return *this;
  49. }
  50. Renderer& Renderer::rotateZ(float degrees) {
  51. stack.get().rotateZ(degrees);
  52. return *this;
  53. }