Load resources from Json file

This commit is contained in:
2021-01-10 22:08:57 +01:00
parent 3ab8c89fc5
commit ad7ec85dce
16 changed files with 409 additions and 104 deletions

View File

@@ -3,12 +3,15 @@
#include <iostream>
#include <fstream>
Model::Model(const char *pathToModel)
{
std::string modelSource = pathToModel;
directory = modelSource.substr(0, modelSource.find_last_of('/'));
uint32_t Model::id_counter = 0;
loadModel(pathToModel);
Model::Model(std::string &modelName, std::string &modelPath) :
unique_name(modelName)
{
directory = modelPath.substr(0, modelPath.find_last_of('/'));
loadModel(modelPath);
id = id_counter++;
}
Model::~Model()
@@ -35,7 +38,7 @@ void Model::drawWithoutTextures()
}
}
void Model::loadModel(std::string pathToModel)
void Model::loadModel(std::string &pathToModel)
{
std::ifstream input(pathToModel, std::ios::in | std::ios::binary);