From cc0a4412a4ac7f1f78ef7e644a0c06c6dd6dd129 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 26 Aug 2008 17:42:30 +0000 Subject: improved dust rendering --- src/render/textures.cc | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src/render/textures.cc') diff --git a/src/render/textures.cc b/src/render/textures.cc index 6ceb7cd..a041c32 100644 --- a/src/render/textures.cc +++ b/src/render/textures.cc @@ -10,6 +10,7 @@ #include "render/textures.h" #include "render/tga.h" #include "render/pngfile.h" +#include "render/jpgfile.h" #include "sys/sys.h" #include "core/application.h" @@ -76,23 +77,32 @@ size_t Textures::load(std::string name, bool filter) std::string filename; Image *image = 0; - // try the png version - filename.assign(name); - filename.append(".png"); - image = PNG::load(filename.c_str()); + if (!image) { + // try the png version + filename.assign(name); + filename.append(".png"); + image = PNG::load(filename.c_str()); + } if (!image) { // try the tga version filename.assign(name); filename.append(".tga"); image = TGA::load(filename.c_str()); + } + + if (!image) { + // try the jpg version + filename.assign(name); + filename.append(".jpg"); + image = JPG::load(filename.c_str()); + } - if (!image) { - // add to the registry with id 0 (texture not found) - con_warn << "Could not open " << filename << std::endl; - registry[name] = 0; - return 0; - } + if (!image) { + // add to the registry with id 0 (texture not found) + con_warn << "Could not open " << filename << std::endl; + registry[name] = 0; + return 0; } size_t id = index; -- cgit v1.2.3