~haggai-eran/nux/rtl-rebased

« back to all changes in this revision

Viewing changes to NuxGraphics/IOpenGLBaseTexture.h

  • Committer: Jay Taoko
  • Date: 2011-10-21 23:49:15 UTC
  • mfrom: (508.1.2 nux-20)
  • Revision ID: jay.taoko@canonical.com-20111021234915-hnzakb5ndebica8i
* Removed custom Nux types: t_u32, t_s32, t_bool, ...

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
  class IOpenGLResource;
35
35
  class IOpenGLBaseTexture;
36
36
 
37
 
  t_s32 GetTextureSize(IOpenGLBaseTexture *pTexture);
 
37
  int GetTextureSize(IOpenGLBaseTexture *pTexture);
38
38
 
39
39
// todo: It should not be possible to create an object of type IOpenGLBaseTexture directly.
40
40
  class IOpenGLBaseTexture: public IOpenGLResource
44
44
  public:
45
45
 
46
46
    IOpenGLBaseTexture(OpenGLResourceType ResourceType,
47
 
                        t_u32 Width,
48
 
                        t_u32 Height,
49
 
                        t_u32 Depth,
50
 
                        t_u32 NumMipLevel,
 
47
                        unsigned int Width,
 
48
                        unsigned int Height,
 
49
                        unsigned int Depth,
 
50
                        unsigned int NumMipLevel,
51
51
                        BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO);
52
52
 
53
53
    virtual ~IOpenGLBaseTexture();
56
56
    {
57
57
      return _PixelFormat;
58
58
    }
59
 
    t_s32 GetNumMipLevel() const
 
59
    int GetNumMipLevel() const
60
60
    {
61
61
      return _NumMipLevel;
62
62
    }
65
65
      return _IsPOT;
66
66
    }
67
67
 
68
 
    t_s32 GetWidth() const
69
 
    {
70
 
      if (_ResourceType == RTTEXTURE)
71
 
        return _Width;
72
 
 
73
 
      if (_ResourceType == RTTEXTURERECTANGLE)
74
 
        return _Width;
75
 
 
76
 
      if (_ResourceType == RTCUBETEXTURE)
77
 
        return _Width;
78
 
 
79
 
      return 0;
80
 
    }
81
 
 
82
 
    t_s32 GetHeight() const
83
 
    {
84
 
      if (_ResourceType == RTTEXTURE)
85
 
        return _Height;
86
 
 
87
 
      if (_ResourceType == RTTEXTURERECTANGLE)
88
 
        return _Height;
89
 
 
90
 
      if (_ResourceType == RTCUBETEXTURE)
91
 
        return _Width;
92
 
 
93
 
      return 0;
94
 
    }
95
 
 
96
 
    t_s32 GetDepth() const
 
68
    int GetWidth() const
 
69
    {
 
70
      if (_ResourceType == RTTEXTURE)
 
71
        return _Width;
 
72
 
 
73
      if (_ResourceType == RTTEXTURERECTANGLE)
 
74
        return _Width;
 
75
 
 
76
      if (_ResourceType == RTCUBETEXTURE)
 
77
        return _Width;
 
78
 
 
79
      return 0;
 
80
    }
 
81
 
 
82
    int GetHeight() const
 
83
    {
 
84
      if (_ResourceType == RTTEXTURE)
 
85
        return _Height;
 
86
 
 
87
      if (_ResourceType == RTTEXTURERECTANGLE)
 
88
        return _Height;
 
89
 
 
90
      if (_ResourceType == RTCUBETEXTURE)
 
91
        return _Width;
 
92
 
 
93
      return 0;
 
94
    }
 
95
 
 
96
    int GetDepth() const
97
97
    {
98
98
      if (_ResourceType == RTTEXTURE)
99
99
        return 1;
120
120
    //GLTextureStates& GetTextureStates() {return _TextureStates;}
121
121
 
122
122
    void SetRenderStates();
123
 
    void SetFiltering(t_u32 MIN = GL_NEAREST, t_u32 MAG = GL_NEAREST/*, t_u32 MIP = GL_NEAREST*/);
124
 
    void SetWrap(t_u32 U = GL_REPEAT, t_u32 V = GL_REPEAT, t_u32 W = GL_REPEAT);
 
123
    void SetFiltering(unsigned int MIN = GL_NEAREST, unsigned int MAG = GL_NEAREST/*, unsigned int MIP = GL_NEAREST*/);
 
124
    void SetWrap(unsigned int U = GL_REPEAT, unsigned int V = GL_REPEAT, unsigned int W = GL_REPEAT);
125
125
    void SetLOD(float MinLod = -1000.0f, float MaxLod = +1000.0f);
126
 
    void SetMipLevel(t_u32 MinMip = 0, t_u32 MaxMip = 1000);
 
126
    void SetMipLevel(unsigned int MinMip = 0, unsigned int MaxMip = 1000);
127
127
    void SetBorderColor(float R, float G, float B, float A);
128
128
 
129
129
    int BindTexture();
146
146
  protected:
147
147
    GLTextureStates _TextureStates;
148
148
    bool            _IsPOT;             // is power of two?
149
 
    t_s32           _NumMipLevel;
 
149
    int           _NumMipLevel;
150
150
    BitmapFormat    _PixelFormat;
151
151
 
152
152
    // These parameters are scalable across textures, cube textures and volume textures.
153
153
    // For texture and cube texture _Depth is equal to 1.
154
154
    // For cube texture, _Width = _Height
155
 
    t_s32        _Width;
156
 
    t_s32        _Height;
 
155
    int        _Width;
 
156
    int        _Height;
157
157
    int         _Depth;
158
158
    int         _RowMemoryAlignment;
159
159
 
161
161
    friend class IOpenGLVolume;
162
162
    friend void GetTextureDesc(
163
163
      IOpenGLBaseTexture *pTexture,
164
 
      t_u32 Level,
 
164
      unsigned int Level,
165
165
      TEXTURE_DESC *pDesc
166
166
    );
167
 
    friend t_s32 GetTextureSize(IOpenGLBaseTexture *pTexture);
 
167
    friend int GetTextureSize(IOpenGLBaseTexture *pTexture);
168
168
  };
169
169
 
170
170
}