| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 | 
							- #ifndef WRAPPER_H
 
- #define WRAPPER_H
 
- #include <GL/glew.h>
 
- #include <GLFW/glfw3.h>
 
- #include <iostream>
 
- #include "client/engine/shader/ShaderProgram.h"
 
- #include "client/math/Vector3D.h"
 
- #include "client/math/Matrix3D.h"
 
- #include "client/engine/shader/WorldShader.h"
 
- #include "client/engine/shader/SSAOShader.h"
 
- #include "client/engine/shader/SSAOBlurShader.h"
 
- #include "client/engine/shader/FramebufferRectangle.h"
 
- #include "client/engine/shader/WorldPostShader.h"
 
- #include "client/engine/shader/OverlayShader.h"
 
- #include "client/engine/Mesh.h"
 
- #include "client/engine/Shader.h"
 
- using namespace std;
 
- class IClient
 
- {
 
- public:
 
-     virtual ~IClient() = default;
 
-     virtual void tick() = 0;
 
-     virtual void render3DTick(float lag) = 0;
 
-     virtual void render2DTick(float lag) = 0;
 
-     virtual void onKeyEvent(int key, int scancode, int action, int mods) = 0;
 
-     virtual void onMouseMove(double x, double y) = 0;
 
-     virtual void onMouseClick(int button, int action, int mods) = 0;
 
- };
 
- class DummyClient : public IClient
 
- {
 
- public:
 
-     static DummyClient dummy;
 
-     
 
-     void tick() override { cout << "Dummy tick" << endl; };
 
-     void render3DTick(float lag) override { cout << "Dummy render3DTick" << endl; };
 
-     void render2DTick(float lag) override { cout << "Dummy render3DTick" << endl; };
 
-     void onKeyEvent(int key, int scancode, int action, int mods) override { cout << "Dummy onKeyEvent" << endl; };
 
-     void onMouseMove(double x, double y) override { cout << "Dummy onMouseMove" << endl; };
 
-     void onMouseClick(int button, int action, int mods) override { cout << "Dummy onMouseClick" << endl; };
 
- private:
 
-     DummyClient() {};
 
- };
 
- class Engine
 
- {
 
- public:
 
-     static bool init(int width, int height, const char* name);
 
-     static void start(IClient* client);
 
-     static void stop();
 
-     
 
-     static void printError();
 
-     
 
-     static int getScale();
 
-     static int getWidth();
 
-     static int getHeight();
 
-     static float getScaledWidth();
 
-     static float getScaledHeight();
 
-     
 
-     static float getFieldOfView();
 
-     static float getNearClip();
 
-     static float getFarClip();
 
-     
 
-     static void setMouseTrapped(bool mode);
 
-     
 
-     static void setMixMode();
 
-     static void setColorMode();
 
-     static void setTextureMode();
 
- private:
 
-     friend void Shader::updateModelMatrix();
 
-     
 
-     static const uint64_t NANOS_PER_FRAME = 1000000000 / 60;
 
-     static const uint64_t NANOS_PER_TICK = 50000000;
 
-     static const int MAX_TICKS_PER_FRAME = 1;
 
-     
 
-     static void sleep(uint64_t nanos);
 
-     static bool initOverlayShader();   
 
-     
 
-     static void onRenderTick(float lag);
 
-     
 
-     static void onKeyEvent(GLFWwindow* w, int key, int scancode, int action, int mods);
 
-     static void onMouseMove(GLFWwindow* w, double x, double y);
 
-     static void onMouseClick(GLFWwindow* w, int button, int action, int mods);
 
-     static void onWindowResize(GLFWwindow* w, int width, int height);
 
-     
 
-     static void setViewMatrix(const float* data);
 
-     static void setModelMatrix(const float* data);
 
-     static void updateScale();
 
-     
 
-     static IClient* client;    
 
-     
 
-     // window data
 
-     static GLFWwindow* window;  
 
-     static int scale;
 
-     static int width;
 
-     static int height;
 
-     static int resizeTicks;
 
-     
 
-     // projection data
 
-     static float fovY;
 
-     static float nearClip;
 
-     static float farClip;
 
-     static Matrix3D projMatrix;
 
-     
 
-     // rectangle for framebuffer drawing
 
-     static FramebufferRectangle rectangle;
 
-     
 
-     static int stage;
 
-     // shader stage 1 - world
 
-     static WorldShader worldShader;
 
-     // shader stage 2 - world ssao
 
-     static SSAOShader ssaoShader;
 
-     // shader stage 3 - world ssao blur
 
-     static SSAOBlurShader ssaoBlurShader;
 
-     // shader stage 4 - world post
 
-     static WorldPostShader worldPostShader;
 
-     // shader stage 5 - 2D overlay
 
-     static OverlayShader overlayShader;
 
- };
 
- #endif
 
 
  |