Improve compatability

This commit is contained in:
2024-01-25 06:18:36 -05:00
parent fff327b55d
commit 59b7fedb86
4 changed files with 11 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <filesystem>
#include <cstdint>
#include <cstring>
#include <iostream>
@@ -17,6 +18,7 @@ enum class GAMESTATE: uint8_t {
class Engine {
public:
std::string workingDir = std::filesystem::current_path().string();
RWindow* window;
World* world;
//GAMESTATE gameState = GAMESTATE::NORMAL;

View File

@@ -58,7 +58,8 @@ GLuint Player::getTextureID() {
void Player::loadTexture() {
Texture texture;
texture.name = "player";
texture.load("assets/textures/cube.png");
std::string path = engine->workingDir + "/assets/textures/cube.png";
texture.load(path.c_str());
engine->world->textureList.push_back(texture);
}
@@ -75,7 +76,8 @@ VertexArray *Player::getGeometry() {
void Player::loadGeometry() {
VertexArray geometry;
geometry.name = "player";
geometry.load("assets/models/cube.obj");
std::string path = engine->workingDir + "/assets/models/cube.obj";
geometry.load(path);
engine->world->geometryList.push_back(geometry);
}

View File

@@ -36,7 +36,8 @@ GLuint Skybox::getTextureID() {
void Skybox::loadTexture() {
Texture texture;
texture.name = "skybox";
texture.load("assets/textures/skybox.png");
std::string path = engine->workingDir + "/assets/textures/skybox.png";
texture.load(path.c_str());
engine->world->textureList.push_back(texture);
setScale(engine->farPlane);
}
@@ -54,6 +55,7 @@ VertexArray* Skybox::getGeometry() {
void Skybox::loadGeometry() {
VertexArray geometry;
geometry.name = "skybox";
geometry.load("assets/models/sphere_vlo.obj");
std::string path = engine->workingDir + "/assets/models/sphere_vlo.obj";
geometry.load(path);
engine->world->geometryList.push_back(geometry);
}

View File

@@ -1,13 +1,11 @@
#include <engine/engine.h>
#include <types/vertex.h>
#include <cmath>
#include <J3ML/LinearAlgebra/EulerAngle.h>
#include <J3ML/LinearAlgebra/Quaternion.h>
void VertexArray::load (const std::string& filename) {
std::ifstream file(filename);
if (!file.is_open()) {
std::cerr << "File not found: " << filename << std::endl;
std::cerr << "Couldn't Load Model: " << filename << std::endl;
engine->quit();
}
std::vector<LinearAlgebra::Vector3> positions;