Engine.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef ENGINE_H
  2. #define ENGINE_H
  3. #include <cmath>
  4. #include <cfloat>
  5. #include "common/utils/Types.h"
  6. #include "client/input/Keys.h"
  7. #include "client/input/MouseButtons.h"
  8. #include "client/math/Ray.h"
  9. #include "client/rendering/FontRenderer.h"
  10. #include "client/rendering/Mesh.h"
  11. #include "client/rendering/Framebuffers.h"
  12. #include "client/rendering/Shaders.h"
  13. #include "client/math/Camera.h"
  14. #include "client/math/Plane.h"
  15. #include "client/math/MatrixStack.h"
  16. #include "client/math/Frustum.h"
  17. #include "client/Game.h"
  18. #include "client/rendering/NoiseTexture.h"
  19. #include "client/utils/Clock.h"
  20. class Engine final {
  21. public:
  22. Engine(Shaders& shaders, Framebuffers& fb, const Keys& keys, const MouseButtons& buttons, Camera& camera,
  23. Ray& ray, const Clock& fps, const WindowSize& size);
  24. bool isRunning() const;
  25. void renderTick(float lag);
  26. void tick();
  27. static bool useSSAO;
  28. static float testRadius;
  29. static float testBias;
  30. static bool ortho;
  31. static Vector testOrthoCenter;
  32. Matrix worldProj;
  33. Matrix worldView;
  34. Matrix worldShadowProj;
  35. Matrix worldShadowView;
  36. Matrix worldShadowProjView;
  37. private:
  38. void renderShadow(float lag);
  39. void renderWorld(float lag);
  40. void renderSSAO();
  41. void renderPostWorld();
  42. void renderTextOverlay(float lag);
  43. void updateWorldProjection();
  44. void updateWorldView();
  45. Shaders& shaders;
  46. Framebuffers& fb;
  47. const Keys& keys;
  48. const MouseButtons& buttons;
  49. Game game;
  50. Camera& camera;
  51. Frustum frustum;
  52. MatrixStack model;
  53. FontRenderer fontRenderer;
  54. NoiseTexture ssaoNoise;
  55. Mesh rectangle;
  56. const Clock& fps;
  57. const WindowSize& size;
  58. bool running;
  59. };
  60. #endif