A WIP 3D game engine in C++ using OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.5 KiB

#include <vector>
#include <memory>
#include <unordered_map>
#include <optional>
#include <memory>
#include <nlohmann/json.hpp>
#include <unordered_map>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <fmt/core.h>
#include <fstream>
#include "stb_image.h"
using json = nlohmann::json;
#include "mesh.h"
#include "drawing.h"
#include "entity.h"
#include "errors.h"
#include "drawing.h"
#include "collision.h"
#pragma once
static const char * DATA_DIR = "data";
static const char * OBJ_DIR = "data/objects";
static const char * SHADER_DIR = "data/shaders";
static const char * SKYBOX_DIR = "data/objects/cubemaps";
// for convenience
class level {
void load_entities(json j);
void load_physics(json j);
std::optional<physics_model> physics_from_json(json) noexcept;
std::optional<entity> entity_from_json(json) noexcept;
public:
int id;
std::unordered_map<std::string, int> model_ids;
std::unordered_map<std::string, int> phys_ids;
Shader *shader;
std::string json_source_file;
std::vector<physics_model> phys_meshes;
std::vector<std::shared_ptr<Model>> models;
std::vector<Shader> shaders;
std::vector<entity> entities;
std::vector<int> sounds;
std::vector<int> lights;
// level();
level(const std::string &json);
void draw(const glm::mat4 view, const glm::mat4 projection);
void update();
void activate();
void deactivate();
~level() = default;
level(level &&) = default;
};