~ubuntu-branches/debian/wheezy/gource/wheezy

« back to all changes in this revision

Viewing changes to src/core/texture.h

  • Committer: Package Import Robot
  • Author(s): Andrew Caudwell
  • Date: 2012-04-24 11:25:45 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20120424112545-18fbnycu9xrsl4s5
Tags: 0.38-1
* New upstream release (closes: #667189)
* New build dependencies on libglm-dev and libboost-filesystem-dev. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "SDL_image.h"
32
32
 
33
33
#include "resource.h"
34
 
#include "display.h"
 
34
#include "gl.h"
35
35
 
36
36
class TextureException : public ResourceException {
37
37
public:
39
39
};
40
40
 
41
41
class TextureResource : public Resource {
42
 
    int colourFormat(SDL_Surface* surface);
43
 
    void loadTexture(std::string file, bool mipmaps, bool clamp, bool trilinear, bool external_file);
 
42
    bool mipmaps;
 
43
    GLint wrap;
 
44
    GLint min_filter;
 
45
    GLint mag_filter;
 
46
    std::string filename;
 
47
 
 
48
    GLenum colourFormat(SDL_Surface* surface);
44
49
public:
45
 
        int w, h;
 
50
    int w, h;
 
51
    GLenum target;
 
52
    GLenum format;
46
53
    GLuint textureid;
47
 
    TextureResource(std::string name, bool mipmaps, bool clamp, bool trilinear, bool external_file);
 
54
    GLubyte* data;
 
55
 
 
56
    TextureResource();
 
57
    TextureResource(int width, int height,  bool mipmaps, GLint wrap, GLenum format, GLubyte* data = 0);
 
58
    TextureResource(const std::string& filename, bool mipmaps, GLint wrap, bool external);
 
59
 
 
60
    void setWrapStyle(GLint wrap);
 
61
 
 
62
    void setFiltering(GLint min_filter, GLint mag_filter);
 
63
    void setDefaultFiltering();
 
64
 
 
65
    void bind();
 
66
 
 
67
    void createTexture();
 
68
 
 
69
    void reload();
 
70
 
 
71
    void load(bool reload = false);
 
72
 
 
73
    void unload();
 
74
 
48
75
    ~TextureResource();
49
76
};
50
77
 
51
78
class TextureManager : public ResourceManager {
 
79
    int  resource_seq;
 
80
 
 
81
    void addResource(TextureResource* r);
52
82
public:
 
83
    bool trilinear;
 
84
 
53
85
    TextureManager();
54
 
    TextureResource* grabFile(std::string name, bool mipmaps=true, bool clamp=true, bool trilinear=false);
55
 
    TextureResource* grab(std::string file, bool mipmaps=true, bool clamp=true, bool trilinear=false, bool external_file = false);
 
86
 
 
87
    TextureResource* grabFile(const std::string& filename, bool mipmaps = true, GLint wrap = GL_CLAMP_TO_EDGE);
 
88
    TextureResource*     grab(const std::string& filename, bool mipmaps = true, GLint wrap = GL_CLAMP_TO_EDGE, bool external_file = false);
 
89
 
 
90
    TextureResource* create(int width, int height, bool mipmaps, GLint wrap, GLenum format, GLubyte* data  = 0);
 
91
    TextureResource* create(GLenum target = GL_TEXTURE_2D);
 
92
 
 
93
    void unload();
 
94
    void reload();
56
95
};
57
96
 
58
97
extern TextureManager texturemanager;