diff options
Diffstat (limited to 'src/RenderBackend/OpenGL/Image.cpp')
-rw-r--r-- | src/RenderBackend/OpenGL/Image.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/RenderBackend/OpenGL/Image.cpp b/src/RenderBackend/OpenGL/Image.cpp deleted file mode 100644 index 128a580..0000000 --- a/src/RenderBackend/OpenGL/Image.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "../../../include/RenderBackend/OpenGL/Image.hpp" -#include <SOIL/SOIL.h> - -using namespace std; - -namespace amalgine -{ - Image::Image(unsigned char *_imageData, i32 _width, i32 _height) : imageData(_imageData), width(_width), height(_height) - { - - } - - Result<Image*> Image::loadFromFile(const char *filepath) - { - int width; - int height; - unsigned char *imageData = SOIL_load_image(filepath, &width, &height, 0, SOIL_LOAD_RGB); - if(!imageData) - { - string errMsg = "Failed to load image from file: "; - errMsg += filepath; - errMsg += "; SOIL error message: "; - errMsg += SOIL_last_result(); - return Result<Image*>::Err(errMsg); - } - return Result<Image*>::Ok(new Image(imageData, width, height)); - } - - const unsigned char* Image::getData() const - { - return imageData; - } - - i32 Image::getWidth() const - { - return width; - } - - i32 Image::getHeight() const - { - return height; - } - - Image::~Image() - { - SOIL_free_image_data(imageData); - } -} |