23 lines
482 B
C++
23 lines
482 B
C++
//
|
|
// Created by lukas on 06.02.22.
|
|
//
|
|
|
|
#include <iostream>
|
|
#include "TextureLoader.h"
|
|
|
|
std::unordered_map<std::string, Texture> TextureLoader::texts;
|
|
|
|
Texture *TextureLoader::loadTexture(std::string path) {
|
|
if (texts.find(path) != texts.end()) {
|
|
return &texts[path];
|
|
} else {
|
|
std::cout << "Loading texture: " << path << std::endl;
|
|
auto *t = new Texture;
|
|
t->load(path);
|
|
t->Bind();
|
|
|
|
texts[path] = *t;
|
|
return t;
|
|
}
|
|
}
|