Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 160 vs 168 for /trunk/Source Code/Hardware/Video/Textures/Headers/Texture.h

Diff revisions: vs.
  @@ -24,47 +24,29 @@
24 24 #define _TEXTURE_H
25 25
26 26 #include "core.h"
27 + #include "TextureDescriptor.h"
27 28 #include "Core/Resources/Headers/HardwareResource.h"
28 29 #include "Hardware/Video/Headers/RenderAPIEnums.h"
29 30
30 - class Texture : public HardwareResource{
31 + class SamplerDescriptor;
32 + class Texture : public HardwareResource {
31 33 /*Abstract interface*/
32 34 public:
33 35 virtual void Bind(U16 slot);
34 36 virtual void Unbind(U16 slot);
35 37 virtual void Destroy() = 0;
36 - virtual void LoadData(U32 target, U8* ptr, U16& w, U16& h, U8 d) = 0;
38 + virtual void loadData(U32 target, const U8* const ptr, const vec2<U16>& dimensions, U8 bpp, GFXImageFormat format) = 0;
39 + virtual void setMipMapRange(U32 base = 0, U32 max = 1000) = 0;
37 40 virtual ~Texture() {}
38 41
39 - protected:
40 - template<typename T>
41 - friend class ImplResourceLoader;
42 - virtual bool generateHWResource(const std::string& name) {return HardwareResource::generateHWResource(name);}
43 - virtual void Bind() const;
44 - virtual void Unbind() const;
45 -
46 42 public:
47 43 bool LoadFile(U32 target, const std::string& name);
48 44 void resize(U16 width, U16 height);
49 45
50 - inline U32 getTextureWrap(U32 index) {
51 - switch(index){
52 - default:
53 - case 0: return _wrapU;
54 - case 1: return _wrapV;
55 - case 2: return _wrapW;
56 - };
57 - }
58 -
59 - inline I32 getFilter(U8 index){
60 - switch(index){
61 - case 0: return static_cast<I32>(_minFilter);
62 - case 1: return static_cast<I32>(_magFilter);
63 - };
64 - return -1;
65 - }
46 + inline void setCurrentSampler(const SamplerDescriptor& descriptor) {_samplerDescriptor = descriptor;}
47 + inline const SamplerDescriptor& getCurrentSampler() const {return _samplerDescriptor;}
48 +
66 49
67 - inline U32 getAnisotrophy() const {return (U32)_maxAnisotrophy;}
68 50 inline U32 getHandle() const {return _handle;}
69 51 inline U16 getWidth() const {return _width;}
70 52 inline U16 getHeight() const {return _height;}
  @@ -72,11 +54,12 @@
72 54 inline bool isFlipped() const {return _flipped;}
73 55 inline bool hasTransparency() const {return _hasTransparency;}
74 56
75 - inline void enableGenerateMipmaps(const bool generateMipMaps) {_generateMipmaps=generateMipMaps;}
76 -
77 - inline void setAnisotrophyLevel(U8 anisoLevel) {_maxAnisotrophy = anisoLevel;}
78 - inline void setTextureWrap(U32 wrapU, U32 wrapV,U32 wrapW) {_wrapU = wrapU; _wrapV = wrapV; _wrapW = wrapW;}
79 - inline void setTextureFilters(U8 minFilter, U8 magFilter) {_minFilter = minFilter; _magFilter = magFilter;}
57 + protected:
58 + template<typename T>
59 + friend class ImplResourceLoader;
60 + virtual bool generateHWResource(const std::string& name) {return HardwareResource::generateHWResource(name);}
61 + virtual void Bind() const;
62 + virtual void Unbind() const;
80 63
81 64 protected:
82 65 Texture(const bool flipped = false);
  @@ -86,15 +69,11 @@
86 69 boost::atomic<U32> _handle;
87 70 U16 _width,_height;
88 71 U8 _bitDepth;
89 - U8 _numMipMaps;
90 72 bool _flipped;
91 73 bool _bound;
92 74 bool _hasTransparency;
93 - bool _generateMipmaps;
94 75 mat4<F32> _transformMatrix;
95 - U32 _wrapU, _wrapV, _wrapW;
96 - U8 _minFilter,_magFilter;
97 - U8 _maxAnisotrophy;
76 + SamplerDescriptor _samplerDescriptor;
98 77 static Unordered_map<U8/*slot*/, U32/*textureHandle*/> textureBoundMap;
99 78 };
100 79