Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
00001 /**************************************************************************************/ 00002 /* */ 00003 /* Visualization Library */ 00004 /* http://visualizationlibrary.org */ 00005 /* */ 00006 /* Copyright (c) 2005-2010, Michele Bosi */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without modification, */ 00010 /* are permitted provided that the following conditions are met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, this */ 00013 /* list of conditions and the following disclaimer. */ 00014 /* */ 00015 /* - Redistributions in binary form must reproduce the above copyright notice, this */ 00016 /* list of conditions and the following disclaimer in the documentation and/or */ 00017 /* other materials provided with the distribution. */ 00018 /* */ 00019 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */ 00020 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */ 00021 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ 00022 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */ 00023 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */ 00024 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ 00025 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */ 00026 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ 00027 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ 00028 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00029 /* */ 00030 /**************************************************************************************/ 00031 00032 #ifndef Texture_INCUDE_DEFINE 00033 #define Texture_INCUDE_DEFINE 00034 00035 #include <vlCore/String.hpp> 00036 #include <vlCore/Vector4.hpp> 00037 #include <vlCore/Image.hpp> 00038 #include <vlGraphics/BufferObject.hpp> 00039 00040 namespace vl 00041 { 00042 class OpenGLContext; 00043 00044 //------------------------------------------------------------------------------ 00045 // TexParameter 00046 //------------------------------------------------------------------------------ 00062 class VLGRAPHICS_EXPORT TexParameter: public Object 00063 { 00064 VL_INSTRUMENT_CLASS(vl::TexParameter, Object) 00065 friend class Texture; 00066 00067 public: 00068 TexParameter(); 00069 00070 void apply(ETextureDimension dimension, OpenGLContext* gl) const; 00071 00072 ETexParamFilter minFilter() const { return mMinFilter; } 00073 ETexParamFilter magFilter() const { return mMagfilter; } 00074 ETexParamWrap wrapS() const { return mWrapS; } 00075 ETexParamWrap wrapT() const { return mWrapT; } 00076 ETexParamWrap wrapR() const { return mWrapR; } 00077 fvec4 borderColor() const { return mBorderColor; } 00078 float anisotropy() const { return mAnisotropy; } 00079 bool generateMipmap() const { return mGenerateMipmap; } 00080 ETexCompareMode compareMode() const { return mCompareMode; } 00081 ETexCompareFunc compareFunc() const { return mCompareFunc; } 00082 EDepthTextureMode depthTextureMode() const { return mDepthTextureMode; } 00083 00084 void setMinFilter(ETexParamFilter minfilter) { mDirty = true; mMinFilter = minfilter; } 00085 void setMagFilter(ETexParamFilter magfilter); 00086 void setWrapS(ETexParamWrap texturewrap) { mDirty = true; mWrapS = texturewrap; } 00087 void setWrapT(ETexParamWrap texturewrap) { mDirty = true; mWrapT = texturewrap; } 00088 void setWrapR(ETexParamWrap texturewrap) { mDirty = true; mWrapR = texturewrap; } 00089 void setBorderColor(fvec4 bordercolor) { mDirty = true; mBorderColor = bordercolor; } 00090 void setAnisotropy(float anisotropy) { mDirty = true; mAnisotropy = anisotropy; } 00091 void setGenerateMipmap(bool generate_mipmap) { mDirty = true; mGenerateMipmap = generate_mipmap; } 00092 void setCompareMode(ETexCompareMode mode) { mDirty = true; mCompareMode = mode; } 00093 void setCompareFunc(ETexCompareFunc func) { mDirty = true; mCompareFunc = func; } 00094 void setDepthTextureMode(EDepthTextureMode mode) { mDirty = true; mDepthTextureMode = mode; } 00095 00096 void setDirty(bool dirty) const { mDirty = dirty; } 00097 00098 bool dirty() const { return mDirty; } 00099 00100 protected: 00101 ETexParamFilter mMinFilter; 00102 ETexParamFilter mMagfilter; 00103 ETexParamWrap mWrapS; 00104 ETexParamWrap mWrapT; 00105 ETexParamWrap mWrapR; 00106 ETexCompareMode mCompareMode; 00107 ETexCompareFunc mCompareFunc; 00108 EDepthTextureMode mDepthTextureMode; 00109 fvec4 mBorderColor; 00110 float mAnisotropy; 00111 bool mGenerateMipmap; 00112 00113 mutable bool mDirty; 00114 }; 00115 //------------------------------------------------------------------------------ 00116 class TextureSampler; 00117 //------------------------------------------------------------------------------ 00118 // Texture 00119 //------------------------------------------------------------------------------ 00142 class VLGRAPHICS_EXPORT Texture: public Object 00143 { 00144 VL_INSTRUMENT_CLASS(vl::Texture, Object) 00145 friend class TextureSampler; 00146 00147 public: 00153 class SetupParams: public Object 00154 { 00155 public: 00156 SetupParams() 00157 { 00158 mDimension = TD_TEXTURE_2D; 00159 mFormat = TF_RGBA; 00160 mBorder = false; 00161 mGenMipmaps = false; 00162 mWidth = mHeight = mDepth = 0; 00163 mSamples = 0; 00164 mFixedSamplesLocation = true; 00165 } 00166 00167 void setImagePath(const String& path) { mImagePath = path; } 00168 const String& imagePath() const { return mImagePath; } 00169 00170 void setImage(const Image* image) { mImage = image; } 00171 const Image* image() const { return mImage.get(); } 00172 00173 const BufferObject* bufferObject() const { return mBufferObject.get(); } 00174 BufferObject* bufferObject() { return mBufferObject.get(); } 00175 void setBufferObject(BufferObject* bo) { mBufferObject = bo; } 00176 00177 void setDimension(ETextureDimension dimension) { mDimension = dimension; } 00178 ETextureDimension dimension() const { return mDimension; } 00179 00180 void setFormat(ETextureFormat format) { mFormat = format; } 00181 ETextureFormat format() const { return mFormat; } 00182 00183 void setBorder(bool on) { mBorder = on; } 00184 bool border() const { return mBorder; } 00185 00186 void setGenMipmaps(bool on) { mGenMipmaps = on; } 00187 bool genMipmaps() const { return mGenMipmaps; } 00188 00189 void setWidth(int w) { mWidth = w; } 00190 int width() const { return mWidth; } 00191 00192 void setHeight(int h) { mHeight = h; } 00193 int height() const { return mHeight; } 00194 00195 void setDepth(int d) { mDepth = d; } 00196 int depth() const { return mDepth; } 00197 00198 int samples() const { return mSamples; } 00199 void setSamples(int samples) { mSamples = samples; } 00200 00201 bool fixedSamplesLocations() const { return mFixedSamplesLocation; } 00202 void setFixedSamplesLocations(bool fixed) { mFixedSamplesLocation = fixed; } 00203 00204 protected: 00205 String mImagePath; 00206 ref<BufferObject> mBufferObject; 00207 ref<Image> mImage; 00208 ETextureDimension mDimension; 00209 ETextureFormat mFormat; 00210 int mWidth, mHeight, mDepth; // used when no image is specified. 00211 int mSamples; 00212 bool mBorder; 00213 bool mGenMipmaps; 00214 bool mFixedSamplesLocation; 00215 }; 00216 00217 public: 00220 Texture(const String& image_path, ETextureFormat format = TF_RGBA, bool mipmaps = true, bool border=false); 00221 00224 Texture(const Image* image, ETextureFormat format = TF_RGBA, bool mipmaps = true, bool border=false); 00225 00228 Texture(int width, ETextureFormat format = TF_RGBA, bool border=false); 00229 00232 Texture(int width, int height, ETextureFormat format = TF_RGBA, bool border=false); 00233 00236 Texture(int width, int height, int depth, ETextureFormat format = TF_RGBA, bool border=false); 00237 00239 Texture(); 00240 00242 ~Texture(); 00243 00245 TexParameter* getTexParameter() { return mTexParameter.get(); } 00246 00248 const TexParameter* getTexParameter() const { return mTexParameter.get(); } 00249 00251 const TexParameter* getTexParameterOverride() const { return mTexParameterOverride.get(); } 00252 00254 BufferObject* bufferObject() { return mBufferObject.get(); } 00255 00257 const BufferObject* bufferObject() const { return mBufferObject.get(); } 00258 00260 void destroyTexture(); 00261 00265 bool createTexture(); 00266 00269 bool createTexture(ETextureDimension tex_dimension, ETextureFormat tex_format, int w, int h, int d, bool border, BufferObject* bo, int samples, bool fixedsamplelocations); 00270 00278 bool setMipLevel(int mip_level, const Image* img, bool gen_mipmaps); 00279 00281 void prepareTexture1D(int width, ETextureFormat format, bool border=false) 00282 { 00283 prepareTexture1D(NULL, format, false, border); 00284 mSetupParams->setWidth(width); 00285 } 00286 00288 bool createTexture1D(int width, ETextureFormat format, bool border=false) 00289 { 00290 prepareTexture1D(width, format, border); 00291 return createTexture(); 00292 } 00293 00295 void prepareTexture1D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00296 { 00297 prepareTexture1D(NULL, format, mipmaps, border); 00298 mSetupParams->setImagePath(image_path); 00299 } 00300 00302 bool createTexture1D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00303 { 00304 prepareTexture1D(image_path, format, mipmaps, border); 00305 return createTexture(); 00306 } 00307 00309 void prepareTexture1D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00310 { 00311 mSetupParams = new SetupParams; 00312 mSetupParams->setImage(image); 00313 mSetupParams->setDimension(TD_TEXTURE_1D); 00314 mSetupParams->setFormat(format); 00315 mSetupParams->setGenMipmaps(mipmaps); 00316 mSetupParams->setBorder(border); 00317 } 00318 00320 bool createTexture1D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00321 { 00322 prepareTexture1D(image, format, mipmaps, border); 00323 return createTexture(); 00324 } 00325 00327 void prepareTexture2D(int width, int height, ETextureFormat format, bool border=false) 00328 { 00329 prepareTexture2D(NULL, format, false, border); 00330 mSetupParams->setWidth(width); 00331 mSetupParams->setHeight(height); 00332 } 00333 00335 bool createTexture2D(int width, int height, ETextureFormat format, bool border=false) 00336 { 00337 prepareTexture2D(width, height, format, border); 00338 return createTexture(); 00339 } 00340 00342 void prepareTexture2D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00343 { 00344 prepareTexture2D(NULL, format, mipmaps, border); 00345 mSetupParams->setImagePath(image_path); 00346 } 00347 00349 bool createTexture2D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00350 { 00351 prepareTexture2D(image_path, format, mipmaps, border); 00352 return createTexture(); 00353 } 00354 00356 void prepareTexture2D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00357 { 00358 mSetupParams = new SetupParams; 00359 mSetupParams->setImage(image); 00360 mSetupParams->setDimension(TD_TEXTURE_2D); 00361 mSetupParams->setFormat(format); 00362 mSetupParams->setGenMipmaps(mipmaps); 00363 mSetupParams->setBorder(border); 00364 } 00365 00367 bool createTexture2D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00368 { 00369 prepareTexture2D(image, format, mipmaps, border); 00370 return createTexture(); 00371 } 00372 00374 void prepareTexture3D(int width, int height, int depth, ETextureFormat format, bool border=false) 00375 { 00376 prepareTexture3D(NULL, format, false, border); 00377 mSetupParams->setWidth(width); 00378 mSetupParams->setHeight(height); 00379 mSetupParams->setDepth(depth); 00380 } 00381 00383 bool createTexture3D(int width, int height, int depth, ETextureFormat format, bool border=false) 00384 { 00385 prepareTexture3D(width, height, depth, format, border); 00386 return createTexture(); 00387 } 00388 00390 void prepareTexture3D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00391 { 00392 prepareTexture3D(NULL, format, mipmaps, border); 00393 mSetupParams->setImagePath(image_path); 00394 } 00395 00397 bool createTexture3D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00398 { 00399 prepareTexture3D(image_path, format, mipmaps, border); 00400 return createTexture(); 00401 } 00402 00404 void prepareTexture3D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00405 { 00406 mSetupParams = new SetupParams; 00407 mSetupParams->setImage(image); 00408 mSetupParams->setDimension(TD_TEXTURE_3D); 00409 mSetupParams->setFormat(format); 00410 mSetupParams->setGenMipmaps(mipmaps); 00411 mSetupParams->setBorder(border); 00412 } 00413 00415 bool createTexture3D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00416 { 00417 prepareTexture3D(image, format, mipmaps, border); 00418 return createTexture(); 00419 } 00420 00422 void prepareTextureCubemap(int width, int height, ETextureFormat format, bool border=false) 00423 { 00424 prepareTextureCubemap(NULL, format, false, border); 00425 mSetupParams->setWidth(width); 00426 mSetupParams->setHeight(height); 00427 } 00428 00430 bool createTextureCubemap(int width, int height, ETextureFormat format, bool border=false) 00431 { 00432 prepareTextureCubemap(width, height, format, border); 00433 return createTexture(); 00434 } 00435 00437 void prepareTextureCubemap(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00438 { 00439 prepareTextureCubemap(NULL, format, mipmaps, border); 00440 mSetupParams->setImagePath(image_path); 00441 } 00442 00444 bool createTextureCubemap(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false) 00445 { 00446 prepareTextureCubemap(image_path, format, mipmaps, border); 00447 return createTexture(); 00448 } 00449 00451 void prepareTextureCubemap(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00452 { 00453 mSetupParams = new SetupParams; 00454 mSetupParams->setImage(image); 00455 mSetupParams->setDimension(TD_TEXTURE_CUBE_MAP); 00456 mSetupParams->setFormat(format); 00457 mSetupParams->setGenMipmaps(mipmaps); 00458 mSetupParams->setBorder(border); 00459 } 00460 00462 bool createTextureCubemap(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false) 00463 { 00464 prepareTextureCubemap(image, format, mipmaps, border); 00465 return createTexture(); 00466 } 00467 00469 void prepareTexture1DArray(int width, int count, ETextureFormat format) 00470 { 00471 prepareTexture1DArray(NULL, format, false); 00472 mSetupParams->setWidth(width); 00473 mSetupParams->setHeight(count); 00474 } 00475 00477 bool createTexture1DArray(int width, int count, ETextureFormat format) 00478 { 00479 prepareTexture1DArray(width, count, format); 00480 return createTexture(); 00481 } 00482 00484 void prepareTexture1DArray(const String& image_path, ETextureFormat format, bool mipmaps=true) 00485 { 00486 prepareTexture1DArray(NULL, format, mipmaps); 00487 mSetupParams->setImagePath(image_path); 00488 } 00489 00491 bool createTexture1DArray(const String& image_path, ETextureFormat format, bool mipmaps=true) 00492 { 00493 prepareTexture1DArray(image_path, format, mipmaps); 00494 return createTexture(); 00495 } 00496 00498 void prepareTexture1DArray(const Image* image, ETextureFormat format, bool mipmaps=true) 00499 { 00500 mSetupParams = new SetupParams; 00501 mSetupParams->setImage(image); 00502 mSetupParams->setDimension(TD_TEXTURE_1D_ARRAY); 00503 mSetupParams->setFormat(format); 00504 mSetupParams->setGenMipmaps(mipmaps); 00505 mSetupParams->setBorder(false); 00506 } 00507 00509 bool createTexture1DArray(const Image* image, ETextureFormat format, bool mipmaps=true) 00510 { 00511 prepareTexture1DArray(image, format, mipmaps); 00512 return createTexture(); 00513 } 00514 00516 void prepareTexture2DArray(int width, int height, int count, ETextureFormat format) 00517 { 00518 prepareTexture2DArray(NULL, format, false); 00519 mSetupParams->setWidth(width); 00520 mSetupParams->setHeight(height); 00521 mSetupParams->setDepth(count); 00522 } 00523 00525 bool createTexture2DArray(int width, int height, int count, ETextureFormat format) 00526 { 00527 prepareTexture2DArray(width, height, count, format); 00528 return createTexture(); 00529 } 00530 00532 void prepareTexture2DArray(const String& image_path, ETextureFormat format, bool mipmaps=true) 00533 { 00534 prepareTexture2DArray(NULL, format, mipmaps); 00535 mSetupParams->setImagePath(image_path); 00536 } 00537 00539 bool createTexture2DArray(const String& image_path, ETextureFormat format, bool mipmaps=true) 00540 { 00541 prepareTexture2DArray(image_path, format, mipmaps); 00542 return createTexture(); 00543 } 00544 00546 void prepareTexture2DArray(const Image* image, ETextureFormat format, bool mipmaps=true) 00547 { 00548 mSetupParams = new SetupParams; 00549 mSetupParams->setImage(image); 00550 mSetupParams->setDimension(TD_TEXTURE_2D_ARRAY); 00551 mSetupParams->setFormat(format); 00552 mSetupParams->setGenMipmaps(mipmaps); 00553 mSetupParams->setBorder(false); 00554 } 00555 00557 bool createTexture2DArray(const Image* image, ETextureFormat format, bool mipmaps=true) 00558 { 00559 prepareTexture2DArray(image, format, mipmaps); 00560 return createTexture(); 00561 } 00562 00564 void prepareTextureRectangle(int width, int height, ETextureFormat format) 00565 { 00566 prepareTextureRectangle(NULL, format); 00567 mSetupParams->setWidth(width); 00568 mSetupParams->setHeight(height); 00569 } 00570 00572 bool createTextureRectangle(int width, int height, ETextureFormat format) 00573 { 00574 prepareTextureRectangle(width, height, format); 00575 return createTexture(); 00576 } 00577 00579 void prepareTextureRectangle(const String& image_path, ETextureFormat format) 00580 { 00581 prepareTextureRectangle(NULL, format); 00582 mSetupParams->setImagePath(image_path); 00583 } 00584 00586 bool createTextureRectangle(const String& image_path, ETextureFormat format) 00587 { 00588 prepareTextureRectangle(image_path, format); 00589 return createTexture(); 00590 } 00591 00593 void prepareTextureRectangle(const Image* image, ETextureFormat format) 00594 { 00595 mSetupParams = new SetupParams; 00596 mSetupParams->setImage(image); 00597 mSetupParams->setDimension(TD_TEXTURE_RECTANGLE); 00598 mSetupParams->setFormat(format); 00599 mSetupParams->setGenMipmaps(false); 00600 mSetupParams->setBorder(false); 00601 } 00602 00604 bool createTextureRectangle(const Image* image, ETextureFormat format) 00605 { 00606 prepareTextureRectangle(image, format); 00607 return createTexture(); 00608 } 00609 00611 void prepareTextureBuffer(vl::ETextureFormat format, BufferObject* bo) 00612 { 00613 mSetupParams = new SetupParams; 00614 mSetupParams->setDimension(TD_TEXTURE_BUFFER); 00615 mSetupParams->setFormat(format); 00616 mSetupParams->setBufferObject(bo); 00617 mSetupParams->setGenMipmaps(false); 00618 mSetupParams->setBorder(false); 00619 } 00620 00622 bool createTextureBuffer(vl::ETextureFormat format, BufferObject* bo) 00623 { 00624 prepareTextureBuffer(format, bo); 00625 return createTexture(); 00626 } 00627 00629 void prepareTexture2DMultisample(int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations) 00630 { 00631 mSetupParams = new SetupParams; 00632 mSetupParams->setDimension(TD_TEXTURE_2D_MULTISAMPLE); 00633 mSetupParams->setWidth(width); 00634 mSetupParams->setHeight(height); 00635 mSetupParams->setFormat(format); 00636 mSetupParams->setSamples(samples); 00637 mSetupParams->setFixedSamplesLocations(fixedsamplelocations); 00638 mSetupParams->setGenMipmaps(false); 00639 mSetupParams->setBorder(false); 00640 } 00641 00643 bool createTexture2DMultisample(int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations) 00644 { 00645 prepareTexture2DMultisample(width, height, format, samples, fixedsamplelocations); 00646 return createTexture(); 00647 } 00648 00650 void prepareTexture2DMultisampleArray(int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations) 00651 { 00652 mSetupParams = new SetupParams; 00653 mSetupParams->setDimension(TD_TEXTURE_2D_MULTISAMPLE_ARRAY); 00654 mSetupParams->setWidth(width); 00655 mSetupParams->setHeight(height); 00656 mSetupParams->setDepth(depth); 00657 mSetupParams->setFormat(format); 00658 mSetupParams->setSamples(samples); 00659 mSetupParams->setFixedSamplesLocations(fixedsamplelocations); 00660 mSetupParams->setGenMipmaps(false); 00661 mSetupParams->setBorder(false); 00662 } 00663 00665 bool createTexture2DMultisampleArray(int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations) 00666 { 00667 prepareTexture2DMultisampleArray(width, height, depth, format, samples, fixedsamplelocations); 00668 return createTexture(); 00669 } 00670 00672 void setHandle(unsigned int id) { mHandle = id; } 00674 unsigned int handle() const { return mHandle; } 00675 00677 void setDimension(ETextureDimension dimension) { mDimension = dimension; } 00679 ETextureDimension dimension() const { return mDimension; } 00680 00682 void setInternalFormat(ETextureFormat format) { mFormat = format; } 00684 ETextureFormat internalFormat() const { return mFormat; } 00685 00687 void setWidth(int x) { mWidth = x; } 00689 int width() const { return mWidth; } 00690 00692 void setHeight(int y) { mHeight = y; } 00694 int height() const { return mHeight; } 00695 00697 void setDepth(int z) { mDepth = z; } 00699 int depth() const { return mDepth; } 00700 00702 void setBorder(bool border) { mBorder = border; } 00704 bool border() const { return mBorder; } 00705 00707 void setSamples(int samples) { mSamples = samples; } 00709 int samples() const { return mSamples; } 00710 00712 void setFixedSamplesLocation(bool fixed) { mFixedSamplesLocation = fixed; } 00714 bool fixedSamplesLocation() const { return mFixedSamplesLocation; } 00715 00717 void setSetupParams(SetupParams* setup_params) { mSetupParams = setup_params; } 00718 00720 const SetupParams* setupParams() const { return mSetupParams.get(); } 00721 00723 SetupParams* setupParams() { return mSetupParams.get(); } 00724 00726 bool isValid() const; 00727 00729 bool isDepthTexture() const; 00730 00733 void clone(const Texture& other); 00734 00736 static bool supports(ETextureDimension tex_dimension, ETextureFormat tex_format, int mip_level, EImageDimension img_dimension, int w, int h, int d, bool border, int samples, bool fixedsamplelocations, bool verbose); 00737 00739 static bool isCompressedFormat(int format); 00740 00741 private: 00742 Texture(const Texture& other): Object(other) {} 00743 void operator=(const Texture&) {} 00744 void reset(); 00745 00746 protected: 00747 unsigned int mHandle; 00748 ref<TexParameter> mTexParameter; 00749 mutable ref<TexParameter> mTexParameterOverride; 00750 ref<SetupParams> mSetupParams; 00751 ref<BufferObject> mBufferObject; 00752 ETextureFormat mFormat; 00753 ETextureDimension mDimension; 00754 int mWidth; 00755 int mHeight; 00756 int mDepth; 00757 int mSamples; 00758 bool mBorder; 00759 bool mFixedSamplesLocation; 00760 }; 00761 } 00762 00763 #endif