00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _SO_TEXTURE_
00026 #define _SO_TEXTURE_
00027
00028 #include <Inventor/fields/SoSFVec4f.h>
00029 #include <Inventor/fields/SoSFEnum.h>
00030 #include <Inventor/fields/SoSFImage.h>
00031 #include <Inventor/fields/SoSFString.h>
00032 #include <Inventor/fields/SoSFBool.h>
00033 #include <Inventor/fields/SoSFFloat.h>
00034 #include <Inventor/fields/SoSFColor.h>
00035 #include <Inventor/nodes/SoNode.h>
00036 #include <Inventor/sys/SoGLType.h>
00037 #include <Inventor/elements/SoTextureImageElement.h>
00038 #include <SoDeprecationRules.h>
00039 #include <Inventor/SbEnums.h>
00040 #include <Inventor/renderer/RendererResourceMacro.h>
00041
00042 class SoFieldSensor;
00043 class SoNodeSensor;
00044 class SbRasterImage;
00045 class SoGLTexture;
00046
00048 namespace inventor {
00049 namespace impl{
00050 class SoExtTexture2Impl;
00051 class SoIndexedTexture2Impl;
00052 class SoRenderToTexturePropertyImpl;
00053 };
00054 namespace renderer{
00055 class RendererContext;
00056 }
00057 };
00058
00059 namespace inventor {
00060 namespace renderer{
00061 template<typename T> struct Resource;
00062 class FixedPipelineShader;
00063 };
00064 };
00067 #ifndef GL_COMBINE
00068 #define GL_COMBINE 0x8570
00069 #endif
00070 #ifndef GL_CLAMP_TO_BORDER
00071 #define GL_CLAMP_TO_BORDER 0x812D
00072 #endif
00073 #ifndef GL_CLAMP_TO_EDGE
00074 #define GL_CLAMP_TO_EDGE 0x812F
00075 #endif
00076 #ifndef GL_MIRRORED_REPEAT
00077 #define GL_MIRRORED_REPEAT 0x8370
00078 #endif
00079
00080 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoTexture)
00081
00082
00083
00084
00085
00086
00087
00089
00155 class SoTexture : public SoNode {
00156
00157 SO_NODE_ABSTRACT_HEADER(SoTexture);
00158
00159 SO_PIMPL_BASE_PUBLIC_HEADER(SoTexture);
00160 RENDERER_RESOURCE(SoTexture);
00161 public:
00165 enum InternalFormat {
00167 AUTO_INTERNAL_FORMAT,
00169 ALPHA_FORMAT,SoDEPRECATED ALPHA4,
00173 ALPHA8,
00175 ALPHA12,
00177 ALPHA16,
00179 LUMINANCE_FORMAT, SoDEPRECATED LUMINANCE4,
00183 LUMINANCE8,
00185 LUMINANCE12,
00187 LUMINANCE16,
00189 LUMINANCE_ALPHA,
00191 LUMINANCE4_ALPHA4,
00193 LUMINANCE6_ALPHA2,
00195 LUMINANCE8_ALPHA8,
00197 LUMINANCE12_ALPHA4,
00199 LUMINANCE12_ALPHA12,
00201 LUMINANCE16_ALPHA16,
00203 INTENSITY_FORMAT, SoDEPRECATED INTENSITY4,
00207 INTENSITY8,
00209 INTENSITY12,
00211 INTENSITY16,
00213 R3_G3_B2,
00215 RGB_FORMAT,
00217 RGB4,
00219 RGB5,
00221 RG8,
00223 RGB8,
00225 RGB10,
00227 RGB12,
00229 RGB16,
00231 RGBA_FORMAT,
00233 RGBA2,
00235 RGBA4,
00237 RGB5_ALPHA1,
00239 RGBA8,
00241 RGB10_ALPHA2,
00243 RGBA12,
00245 RGBA16,
00247 RGBA_FLOAT32,
00249 RGB_FLOAT32,
00251 ALPHA_FLOAT32,
00253 INTENSITY_FLOAT32,
00255 LUMINANCE_FLOAT32,
00257 LUMINANCE_ALPHA_FLOAT32,
00259 RGBA_FLOAT16,
00261 RGB_FLOAT16,
00263 ALPHA_FLOAT16,
00265 INTENSITY_FLOAT16,
00267 LUMINANCE_FLOAT16,
00269 LUMINANCE_ALPHA_FLOAT16,
00271 COMPRESSED_ALPHA,
00273 COMPRESSED_LUMINANCE,
00275 COMPRESSED_LUMINANCE_ALPHA,
00277 COMPRESSED_INTENSITY,
00279 COMPRESSED_RGB,
00281 COMPRESSED_RGBA,
00285 COMPRESSED_LUMINANCE_LATC1,
00289 COMPRESSED_SIGNED_LUMINANCE_LATC1,
00293 COMPRESSED_LUMINANCE_ALPHA_LATC2,
00297 COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2,
00301 COMPRESSED_RED_RGTC1,
00305 COMPRESSED_SIGNED_RED_RGTC1,
00309 COMPRESSED_RED_GREEN_RGTC2,
00313 COMPRESSED_SIGNED_RED_GREEN_RGTC2,
00317 DEPTH_COMPONENT16,
00321 DEPTH_COMPONENT24,
00325 DEPTH24_STENCIL8,
00329 R8I,
00330 R8UI,
00331 R16I,
00332 R16UI,
00333 R32I,
00334 R32UI,
00335 RG8I,
00336 RG8UI,
00337 RG16I,
00338 RG16UI,
00339 RG32I,
00340 RG32UI,
00341 RGB8I,
00342 RGB8UI,
00343 RGB16I,
00344 RGB16UI,
00345 RGB32I,
00346 RGB32UI,
00347 RGBA8I,
00348 RGBA8UI,
00349 RGBA16I,
00350 RGBA16UI,
00351 RGBA32I,
00352 RGBA32UI,
00353 #ifndef HIDDEN_FROM_DOC
00354 LAST_FORMAT
00355 #endif
00356 };
00357
00359 enum Model {
00363 MODULATE = SbEnums::TEX_MODEL_MODULATE,
00364
00374 DECAL = SbEnums::TEX_MODEL_DECAL,
00375
00379 BLEND = SbEnums::TEX_MODEL_BLEND,
00380
00386 REPLACE = SbEnums::TEX_MODEL_REPLACE,
00387
00393 ADD = SbEnums::TEX_MODEL_ADD,
00394
00402 COMBINE = SbEnums::TEX_MODEL_COMBINE
00403
00404 };
00405
00407 enum Wrap {
00411 REPEAT = SbEnums::TEX_ADDRESS_REPEAT,
00412
00418 CLAMP = SbEnums::TEX_ADDRESS_CLAMP,
00419
00426 CLAMP_TO_BORDER = SbEnums::TEX_ADDRESS_CLAMP_BORDER,
00427
00434 CLAMP_TO_EDGE = SbEnums::TEX_ADDRESS_CLAMP_TO_EDGE,
00435
00442 MIRRORED_REPEAT = SbEnums::TEX_ADDRESS_MIRROR_REPEAT
00443
00444 };
00445
00451 enum Filter
00452 {
00454 AUTO = SbEnums::TEX_FILTER_AUTO,
00456 NEAREST = SbEnums::TEX_FILTER_NEAREST,
00458 LINEAR = SbEnums::TEX_FILTER_LINEAR,
00460 NEAREST_MIPMAP_NEAREST = SbEnums::TEX_FILTER_NEAREST_MIPMAP_NEAREST,
00462 NEAREST_MIPMAP_LINEAR = SbEnums::TEX_FILTER_NEAREST_MIPMAP_LINEAR,
00464 LINEAR_MIPMAP_NEAREST = SbEnums::TEX_FILTER_LINEAR_MIPMAP_NEAREST,
00466 LINEAR_MIPMAP_LINEAR = SbEnums::TEX_FILTER_LINEAR_MIPMAP_LINEAR
00467 } ;
00468
00472 enum HW_Feature {
00476 HW_NPOT = 0,
00477
00481 HW_FLOATFORMAT,
00482
00486 HW_DEPTHFORMAT,
00487
00491 HW_AUTOMIPMAP,
00492
00496 HW_BORDER_CLAMP,
00497
00501 HW_EDGE_CLAMP,
00502
00506 HW_MIRRORED_REPEAT,
00507
00511 HW_COMPRESSION_S3TC,
00512
00516 HW_COMPRESSION_LATC,
00517
00521 HW_COMPRESSION_RGTC,
00522
00523 #ifndef HIDDEN_FROM_DOC
00524 HW_LAST
00525 #endif
00526 };
00527
00537 SoSFEnum internalFormat;
00538
00552 SoSFBool enableCompressedTexture;
00553
00559 SoSFEnum wrapS;
00560
00565 SoSFEnum model;
00566
00570 SoSFColor blendColor;
00571
00578 SoSFBool enableBorder;
00579
00586 SoSFVec4f borderColor;
00587
00599 SoSFFloat maxAnisotropy;
00600
00617 SoSFEnum minFilter;
00618
00638 SoSFEnum magFilter;
00639
00641 enum FileType
00642 {
00644 UNKNOWN,
00646 RGB,
00648 SGI,
00650 TIFF,
00652 GIF,
00654 JPEG,
00656 BMP,
00658 PNG,
00660 JPEG2000,
00662 PGX,
00664 PNM,
00666 RAS,
00668 DDS,
00670 HDRI,
00672 NUM_FILETYPES
00673 };
00674
00684 void setBitmapFileType(FileType in_type);
00685
00689 FileType getBitmapFileType(void);
00690
00698 static SbBool isSupported(HW_Feature feature);
00699
00704 inline virtual void setOverride(const SbBool state)
00705 { override.setValue(state); }
00706
00710 inline virtual SbBool isOverride() const
00711 { return override.getValue(); }
00712
00723 static SbRasterImage* readTexture( const SbString& filename, FileType filetype = UNKNOWN );
00724
00725 private:
00726 virtual void doAction(SoAction *action)=0;
00727 virtual void GLRender(SoGLRenderAction *action)=0;
00728 virtual void callback(SoCallbackAction *action);
00729
00730 private:
00731 static void initClass();
00732 static void exitClass();
00733
00738 virtual bool affectsPath() const;
00739
00740 SoSFBool override;
00741
00747 SoSFBool forInternalShader;
00748
00750 void subImage(const std::vector<SoTextureImageElementBase::TextureDataConfiguration>& subTextures);
00751
00752 private:
00753 SoTexture();
00754
00755 virtual ~SoTexture();
00756
00757 private:
00758
00759 #if 1 SoDEPRECATED
00761 SoSFBool useAutoMipmap;
00762 #endif
00765 void commonConstructor();
00766
00767 friend class inventor::impl::SoExtTexture2Impl;
00768 friend class inventor::impl::SoIndexedTexture2Impl;
00769 friend class inventor::impl::SoRenderToTexturePropertyImpl;
00770 friend struct inventor::renderer::Resource<SoTexture>;
00771 friend class inventor::renderer::FixedPipelineShader;
00772 friend class inventor::renderer::RendererContext;
00773 };
00774
00775 #endif
00776
00777