81 lines
1.9 KiB
C++
81 lines
1.9 KiB
C++
#ifndef ENGINE_H
|
|
#define ENGINE_H
|
|
|
|
#include <GL/glew.h>
|
|
#include <GLFW/glfw3.h>
|
|
#include "Camera.h"
|
|
#include "ShaderProgram.h"
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
#include "Mesh3D.h"
|
|
#include "Lighting.h"
|
|
#include "Skybox.h"
|
|
#include <GL/glew.h>
|
|
#include <GLFW/glfw3.h>
|
|
#include <glm/glm.hpp>
|
|
#include <glm/gtc/matrix_transform.hpp>
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
|
|
#define NBCALLBACKS 1
|
|
|
|
typedef void (*KeyCallback)(GLFWwindow* window, int key, int scancode, int action, int mods);
|
|
|
|
typedef std::map<std::string,std::unique_ptr<djalim::Mesh3D>> Objects3D;
|
|
|
|
static bool gWireframe = false;
|
|
|
|
namespace djalim {
|
|
|
|
class OpenGlEngine{
|
|
|
|
public:
|
|
|
|
void start();
|
|
OpenGlEngine();
|
|
OpenGlEngine( const char* title, int width, int height);
|
|
~OpenGlEngine();
|
|
|
|
GLFWwindow* window;
|
|
|
|
int windowWidth;
|
|
int windowHeight;
|
|
|
|
const double ZOOM_SENSITIVITY = -3.0;
|
|
const float MOVE_SPEED = 20.0; // units per second
|
|
const float MOUSE_SENSITIVITY = 0.1f;
|
|
|
|
double previousSeconds = 0.0;
|
|
double elapsedSeconds;
|
|
int frameCount = 0;
|
|
ShaderProgram shaderProgram;
|
|
ShaderProgram skyboxShaderProgram;
|
|
FPSCamera Camera = FPSCamera();
|
|
glm::mat4 projection;
|
|
Lighting lighting;
|
|
Skybox* skybox;
|
|
|
|
Objects3D objects;
|
|
|
|
unsigned int VBO;
|
|
unsigned int VAO;
|
|
|
|
bool gWireframe = false;
|
|
|
|
void onUpdate();
|
|
void loadHints();
|
|
void cameraUpdate();
|
|
void createObject(std::string name, std::string textures, std::string filepath,bool flip = false);
|
|
void createObject(std::string name, std::string textures, std::string filepath, glm::vec3 position, glm::vec3 rotation, glm::vec3 scale,bool flip = false);
|
|
void loadCallbacks();
|
|
void showFps();
|
|
void onCreate();
|
|
void onDestroy();
|
|
void draw(Mesh3D* object);
|
|
};
|
|
}
|
|
|
|
|
|
|
|
#endif // ENGINE_H
|