Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/Source Code/Hardware/Video/Textures/Texture.cpp

Diff revisions: vs.
  @@ -1,4 +1,5 @@
1 1 #include "Headers/Texture.h"
2 +
2 3 #include "Utility/Headers/ImageTools.h"
3 4 #include "Core/Headers/ParamHandler.h"
4 5
  @@ -6,11 +7,8 @@
6 7
7 8 Texture::Texture(const bool flipped) : HardwareResource(),
8 9 _flipped(flipped),
9 - _minFilter(TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR),
10 - _magFilter(TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR),
11 10 _handle(0),
12 11 _bound(false),
13 - _generateMipmaps(true),
14 12 _hasTransparency(false)
15 13 {
16 14 if(textureBoundMap.empty()){
  @@ -19,11 +17,6 @@
19 17 textureBoundMap.insert(std::make_pair(i,0));
20 18 }
21 19 }
22 - /// Defaults
23 - _wrapU = TEXTURE_REPEAT;
24 - _wrapV = TEXTURE_REPEAT;
25 - _wrapW = TEXTURE_REPEAT;
26 - setAnisotrophyLevel(ParamHandler::getInstance().getParam<U8>("rendering.anisotropicFilteringLevel",1));
27 20 }
28 21
29 22 /// Use DevIL to load a file intro a Texture Object
  @@ -32,27 +25,30 @@
32 25 // Create a new imageData object
33 26 ImageTools::ImageData img;
34 27 // Flip image if needed
35 - img._flip = _flipped;
28 + img.flip(_flipped);
36 29 // Save file contents in the "img" object
37 - ImageTools::OpenImage(name,img,_hasTransparency);
30 + img.create(name);
31 + _hasTransparency = img.alpha();
38 32 // validate data
39 - if(!img.data) {
33 + if(!img.data()) {
40 34 ERROR_FN(Locale::get("ERROR_TEXTURE_LOAD"), name.c_str());
41 35 ///Missing texture fallback
42 36 ParamHandler& par = ParamHandler::getInstance();
43 - ImageTools::OpenImage(par.getParam<std::string>("assetsLocation")+"/"+
44 - par.getParam<std::string>("defaultTextureLocation") +"/"+
45 - "missing_texture.jpg", img,_hasTransparency);
37 + img.flip(false);
38 + img.create(par.getParam<std::string>("assetsLocation")+"/"+
39 + par.getParam<std::string>("defaultTextureLocation") +"/"+
40 + "missing_texture.jpg");
46 41 }
47 42
48 43 // Get width
49 - _width = img.w;
44 + _width = img.dimensions().width;
50 45 // Get height
51 - _height = img.h;
46 + _height = img.dimensions().height;
52 47 // Get bitdepth
53 - _bitDepth = img.d;
48 + _bitDepth = img.bpp();
49 + GFXImageFormat texture_format = img.format();
54 50 // Create a new API-dependent texture object
55 - LoadData(target, img.data, _width, _height, _bitDepth);
51 + loadData(target, img.data(), img.dimensions(), _bitDepth, texture_format);
56 52 // Unload file data - ImageData destruction handles this
57 53 //img.Destroy();
58 54 return true;