mirror of
https://github.com/ApfelTeeSaft/vb01.git
synced 2026-08-26 19:33:45 +00:00
24 lines
530 B
C++
24 lines
530 B
C++
#include "imageReader.h"
|
|
|
|
#include "stb_image.h"
|
|
|
|
using namespace std;
|
|
|
|
namespace vb01{
|
|
ImageReader *imageReader = nullptr;
|
|
|
|
ImageReader* ImageReader::getSingleton(){
|
|
if(!imageReader)
|
|
imageReader = new ImageReader();
|
|
|
|
return imageReader;
|
|
}
|
|
|
|
Asset* ImageReader::readAsset(string path){
|
|
stbi_set_flip_vertically_on_load(flip);
|
|
int width, height, numChannels;
|
|
u8 *data = stbi_load(path.c_str(), &width, &height, &numChannels, 0);
|
|
return new ImageAsset(path, data, width, height, numChannels);
|
|
}
|
|
}
|