--- /dev/null
+#pragma once
+
+/* Set this to WINDOWS for Windows, UNIX for Linux, BSD, etc. */
+#define UNIX
+
+/* This is needed to allow fopen, fread, etc. */
+#ifdef WINDOWS
+#define _CRT_SECURE_NO_WARNINGS
+#define M_PI 3.141592653
+typedef __int64 ssize_t;
+#endif
+
+/* General-purpose C includes */
+#include<stdio.h>
+#include<stdlib.h>
+
+/* General-purpose C++ includes */
+#include<thread>
+#include<chrono>
+#include<iostream>
+
+/* Data Structures */
+#include<vector>
+#include<unordered_map>
+
+/* OpenGL Loader */
+#ifdef UNIX
+#include<GL/glew.h> // glad on Windows
+#else
+#include <glad/glad.h>
+#endif
+
+/* OpenGL Includes */
+#include<GLFW/glfw3.h>
+#include<glm/glm.hpp>
+#include<glm/gtc/matrix_transform.hpp>
+#include<glm/gtc/type_ptr.hpp>
+
+/* Tiny obj loader - loads Wavefront .obj files */
+#include "tiny_obj_loader.h"
+
+/* Provides stbi_image to load textures */
+#include "stb_image.h"
+
+using namespace std;
+using namespace glm;
+
+struct globals {
+ float height = 800;
+ float width = 1280;
+ float gravity = 0.02f;
+ float jump_speed = 0.7f;
+ bool shutdown = false;
+ vec3 player_position;
+ float heading = 0.0;
+ float elevation = 0.0;
+ float vertical_speed = 0.0;
+ float player_height = 1.5;
+ float move_margin = 0.4f;
+ float runspeed = 0.8f;
+ float walkspeed = 0.2f;
+ bool forward = false;
+ bool backward = false;
+ bool left = false;
+ bool right = false;
+ bool run = false;
+ bool release_cursor = false;
+ int on_count = 0;
+};
+
+vec3 get_lookat_point(int direction = 0, float r = 0.0);
+char* get_source(const char *filename);
+
+class GameObject {
+ public:
+ /* Identifiers for OpenGL resources */
+ unsigned int v_attrib;
+ unsigned int tc_attrib;
+ unsigned int vp_uniform;
+ unsigned int program;
+ unsigned int vbuf;
+ unsigned int ebuf;
+ unsigned int tex;
+ unsigned int element_count;
+ unsigned int models_buffer;
+
+ /* Properties related to initialization. Set these when initializing an object */
+ string object_file, texture_file, vertex_shader, fragment_shader;
+ bool flip_yz = false;
+ string name;
+ bool moving = false;
+
+ GameObject() {
+ object_file = "objects/cube.obj";
+ vertex_shader = "shaders/vertex_shader.glsl";
+ fragment_shader = "shaders/fragment_shader.glsl";
+ }
+
+ /* Properties not related to OpenGL */
+ vector<mat4> models;
+ bool visible = true;
+
+ void add_location(vec3 location);
+ bool init();
+ void draw(mat4 vp);
+ virtual void movement(float) {}; // takes the number of milliseconds since the last run
+ virtual void trigger_action(size_t instance, int action) {}
+
+ /* Required for collision detection */
+ virtual float fast_check_distance(size_t instance) {return 0;}
+ virtual vec3 closest_point(vec3 other, size_t instance) {return vec3(0, 0, 0);}
+ virtual vec3 get_center(size_t instance) {return vec3(0, 0, 0);}
+ virtual void report_collision(GameObject *other, size_t other_instance, size_t our_instance) {};
+};
+
+class SolidObject : public GameObject {
+public:
+
+ /* Stuff we actually used */
+ virtual ssize_t is_inside(vec3 point, float margin) {return false;}
+ virtual float get_top(size_t instance);
+ virtual float get_bottom(size_t instance);
+ virtual float get_topbottom(size_t instance, bool);
+
+ /* Stuff we haven't used yet */
+ bool collision = false;
+ bool blocks_player = false;
+ void collided(GameObject& other, size_t our_instance, size_t other_instance);
+ //some_format get_hit_box();
+ bool is_over();
+ /* Vector of sizes of instance? Or are all the instances the same size? */
+ /* Something for bouncing? */
+
+};
+
+#ifdef MAIN
+globals g;
+vector<GameObject*> game_objects;
+vector<SolidObject*> solid_objects;
+map<string, unsigned int> gl_resources;
+#else
+extern globals g;
+extern vector<GameObject*> game_objects;
+extern vector<SolidObject*> solid_objects;
+extern map<string, unsigned int> gl_resources;
+#endif
+
+struct vertex {
+ float x, y, z, u, v;
+};
+bool operator==(const vertex& a, const vertex& o);
+
+ostream& operator<<(ostream& out, vec3 v);
+
+#define PLAYER_ON_OBJECT 1
+#define ACTIVATE 2
+
+/* Other objects that aren't base classes go next */
+#include "misc_objects.h"
+#include "water_tank.h"
+#include "projectile.h"
+GameObject* add_object(GameObject *new_object, string name, bool solid = false);
+void load_level();