Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoTexture.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25#ifndef _SO_TEXTURE_
26#define _SO_TEXTURE_
27
38#include <SoDeprecationRules.h>
39#include <Inventor/SbEnums.h>
40#include <Inventor/renderer/RendererResourceMacro.h>
41
42class SoFieldSensor;
43class SoNodeSensor;
44class SbRasterImage;
45class SoGLTexture;
46
48namespace inventor {
49 namespace impl{
50 class SoExtTexture2Impl;
51 class SoIndexedTexture2Impl;
52 class SoRenderToTexturePropertyImpl;
53 };
54 namespace renderer{
55 class RendererContext;
56 }
57};
58
59namespace inventor {
60namespace renderer{
61 template<typename T> struct Resource;
62 class FixedPipelineShader;
63};
64};
67#ifndef GL_COMBINE
68#define GL_COMBINE 0x8570
69#endif
70#ifndef GL_CLAMP_TO_BORDER
71#define GL_CLAMP_TO_BORDER 0x812D
72#endif
73#ifndef GL_CLAMP_TO_EDGE
74#define GL_CLAMP_TO_EDGE 0x812F
75#endif
76#ifndef GL_MIRRORED_REPEAT
77#define GL_MIRRORED_REPEAT 0x8370
78#endif
79
81
82
83//
84// Class: SoTexture
85//
86// Texture node.
87//
89
155class SoTexture : public SoNode {
156
158
159 SO_PIMPL_BASE_PUBLIC_HEADER(SoTexture);
160 RENDERER_RESOURCE(SoTexture);
161public:
169 ALPHA_FORMAT,SoDEPRECATED ALPHA4,
179 LUMINANCE_FORMAT, SoDEPRECATED LUMINANCE4,
203 INTENSITY_FORMAT, SoDEPRECATED INTENSITY4,
353#ifndef HIDDEN_FROM_DOC
354 LAST_FORMAT
355#endif
356 };
357
359 enum Model {
363 MODULATE = SbEnums::TEX_MODEL_MODULATE,
364
374 DECAL = SbEnums::TEX_MODEL_DECAL,
375
379 BLEND = SbEnums::TEX_MODEL_BLEND,
380
386 REPLACE = SbEnums::TEX_MODEL_REPLACE,
387
393 ADD = SbEnums::TEX_MODEL_ADD,
394
402 COMBINE = SbEnums::TEX_MODEL_COMBINE
403
404 };
405
407 enum Wrap {
411 REPEAT = SbEnums::TEX_ADDRESS_REPEAT,
412
418 CLAMP = SbEnums::TEX_ADDRESS_CLAMP,
419
426 CLAMP_TO_BORDER = SbEnums::TEX_ADDRESS_CLAMP_BORDER,
427
434 CLAMP_TO_EDGE = SbEnums::TEX_ADDRESS_CLAMP_TO_EDGE,
435
442 MIRRORED_REPEAT = SbEnums::TEX_ADDRESS_MIRROR_REPEAT
443
444 };
445
452 {
454 AUTO = SbEnums::TEX_FILTER_AUTO,
456 NEAREST = SbEnums::TEX_FILTER_NEAREST,
458 LINEAR = SbEnums::TEX_FILTER_LINEAR,
460 NEAREST_MIPMAP_NEAREST = SbEnums::TEX_FILTER_NEAREST_MIPMAP_NEAREST,
462 NEAREST_MIPMAP_LINEAR = SbEnums::TEX_FILTER_NEAREST_MIPMAP_LINEAR,
464 LINEAR_MIPMAP_NEAREST = SbEnums::TEX_FILTER_LINEAR_MIPMAP_NEAREST,
466 LINEAR_MIPMAP_LINEAR = SbEnums::TEX_FILTER_LINEAR_MIPMAP_LINEAR
467 } ;
468
476 HW_NPOT = 0,
477
482
487
492
497
502
507
512
517
522
523#ifndef HIDDEN_FROM_DOC
524 HW_LAST
525#endif
526 };
527
538
553
560
566
571
579
587
600
618
639
674
685
690
699
704 inline virtual void setOverride(const SbBool state)
705 { override.setValue(state); }
706
710 inline virtual SbBool isOverride() const
711 { return override.getValue(); }
712
723 static SbRasterImage* readTexture( const SbString& filename, FileType filetype = UNKNOWN );
724
725private:
726 virtual void doAction(SoAction *action)=0;
727 virtual void GLRender(SoGLRenderAction *action)=0;
728 virtual void callback(SoCallbackAction *action);
729
730private:
731 static void initClass();
732 static void exitClass();
733
738 virtual bool affectsPath() const;
739
740 SoSFBool override;
741
747 SoSFBool forInternalShader;
748
749 enum SubImageCopyPolicy
750 {
751 SUBIMAGE_NO_COPY,
752 SUBIMAGE_COPY,
753 SUBIMAGE_NO_COPY_AND_DELETE,
754 };
755
757 void subImage(const std::vector<SoTextureImageElementBase::TextureDataConfiguration>& subTextures,
758 SubImageCopyPolicy copyPolicy = SUBIMAGE_COPY);
759
760private:
761 SoTexture();
762
763 virtual ~SoTexture();
764
765private:
766
767#if 1 SoDEPRECATED
769 SoSFBool useAutoMipmap;
770#endif
773 void commonConstructor();
774
775 friend class inventor::impl::SoExtTexture2Impl;
776 friend class inventor::impl::SoIndexedTexture2Impl;
777 friend class inventor::impl::SoRenderToTexturePropertyImpl;
778 friend struct inventor::renderer::Resource<SoTexture>;
779 friend class inventor::renderer::FixedPipelineShader;
780 friend class inventor::renderer::RendererContext;
781};
782
783#endif /* _SO_TEXTURE_ */
784
SO_PIMPL_BASE_PUBLIC_DECLARATION(SoImageDataAdapter)
#define SO_NODE_ABSTRACT_HEADER(className)
Definition SoSubNode.h:118
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class encapsulat...
Class for smart character strings.
Definition SbString.h:202
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Sensor class that can be attached to Open Inventor fields.
Renders a scene graph using Open Inventor's Render Engine.
Abstract base class for all database nodes.
Definition SoNode.h:145
Sensor class that can be attached to Open Inventor nodes.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an RGB color.
Definition SoSFColor.h:82
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a homogeneous three-dimensional vector.
Definition SoSFVec4f.h:80
Abstract base class for texture mapping nodes.
Definition SoTexture.h:155
SoSFBool enableBorder
Enables borders for textures.
Definition SoTexture.h:578
SoSFVec4f borderColor
Defines border color used for border texture filtering.
Definition SoTexture.h:586
FileType
File Type possible values.
Definition SoTexture.h:642
@ BMP
BMP.
Definition SoTexture.h:656
@ PNM
PNM.
Definition SoTexture.h:664
@ TIFF
TIFF.
Definition SoTexture.h:650
@ JPEG2000
JPEG2000.
Definition SoTexture.h:660
@ RAS
RAS.
Definition SoTexture.h:666
@ GIF
GIF.
Definition SoTexture.h:652
@ UNKNOWN
Unknown file.
Definition SoTexture.h:644
@ SGI
SGI.
Definition SoTexture.h:648
@ JPEG
JPEG.
Definition SoTexture.h:654
@ HDRI
HDRI.
Definition SoTexture.h:670
@ RGB
RGB.
Definition SoTexture.h:646
@ DDS
DDS.
Definition SoTexture.h:668
@ PNG
PNG.
Definition SoTexture.h:658
@ PGX
PGX.
Definition SoTexture.h:662
FileType getBitmapFileType(void)
Gets the texture file format.
virtual void setOverride(const SbBool state)
Set the state of the override field.
Definition SoTexture.h:704
SoSFEnum minFilter
Specifies the OpenGL minFilter.
Definition SoTexture.h:617
static SbBool isSupported(HW_Feature feature)
Returns information about hardware support for various texture features.
Wrap
Texture wrap type.
Definition SoTexture.h:407
Model
Texture Combiner Functions.
Definition SoTexture.h:359
virtual SbBool isOverride() const
Returns the state of the override field.
Definition SoTexture.h:710
SoSFEnum wrapS
Indicates what to do when texture coordinates in the S (horizontal) direction lie outside the range 0...
Definition SoTexture.h:559
void setBitmapFileType(FileType in_type)
Sets the texture file format.
SoSFEnum magFilter
Specifies the OpenGL magFilter.
Definition SoTexture.h:638
@ HW_MIRRORED_REPEAT
Check support for texture coordinates mirrored repeat.
Definition SoTexture.h:506
@ HW_FLOATFORMAT
Check support for floating point texture format.
Definition SoTexture.h:481
@ HW_COMPRESSION_LATC
Check support for texture_compression_latc.
Definition SoTexture.h:516
@ HW_AUTOMIPMAP
Check support for automatic mipmap generation.
Definition SoTexture.h:491
@ HW_COMPRESSION_RGTC
Check support for texture_compression_rgtc.
Definition SoTexture.h:521
@ HW_DEPTHFORMAT
Check support for depth textures.
Definition SoTexture.h:486
@ HW_EDGE_CLAMP
Check support for texture coordinates edge clamp.
Definition SoTexture.h:501
@ HW_COMPRESSION_S3TC
Check support for DDS support (S3TC)
Definition SoTexture.h:511
@ HW_BORDER_CLAMP
Check support for texture coordinates border clamp.
Definition SoTexture.h:496
SoSFFloat maxAnisotropy
Specifies on a per-texture object basis, the maximum degree of anisotropy to account for in texture f...
Definition SoTexture.h:599
Filter
Specifies the OpenGL filtering method for minification and magnification.
Definition SoTexture.h:452
InternalFormat
Texture internal storage format.
Definition SoTexture.h:165
@ RGB16
RGB16.
Definition SoTexture.h:229
@ COMPRESSED_LUMINANCE_LATC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:285
@ RGBA2
RGBA2.
Definition SoTexture.h:233
@ ALPHA_FORMAT
ALPHA_FORMAT.
Definition SoTexture.h:169
@ RGBA8
RGBA8.
Definition SoTexture.h:239
@ DEPTH_COMPONENT24
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 9....
Definition SoTexture.h:321
@ RGB_FORMAT
RGB_FORMAT.
Definition SoTexture.h:215
@ LUMINANCE12_ALPHA4
LUMINANCE12_ALPHA4.
Definition SoTexture.h:197
@ COMPRESSED_RGB
COMPRESSED_RGB.
Definition SoTexture.h:279
@ INTENSITY12
INTENSITY12.
Definition SoTexture.h:209
@ LUMINANCE6_ALPHA2
LUMINANCE6_ALPHA2.
Definition SoTexture.h:193
@ COMPRESSED_SIGNED_LUMINANCE_LATC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:289
@ RGBA4
RGBA4.
Definition SoTexture.h:235
@ COMPRESSED_LUMINANCE_ALPHA_LATC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:293
@ RGBA_FORMAT
RGBA_FORMAT.
Definition SoTexture.h:231
@ RGBA_FLOAT32
RGBA_FLOAT32.
Definition SoTexture.h:247
@ LUMINANCE_FORMAT
LUMINANCE_FORMAT.
Definition SoTexture.h:179
@ COMPRESSED_ALPHA
COMPRESSED_ALPHA.
Definition SoTexture.h:271
@ LUMINANCE_ALPHA_FLOAT32
LUMINANCE_ALPHA_FLOAT32.
Definition SoTexture.h:257
@ COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:297
@ INTENSITY_FLOAT32
INTENSITY_FLOAT32.
Definition SoTexture.h:253
@ LUMINANCE_ALPHA_FLOAT16
LUMINANCE_ALPHA_FLOAT16.
Definition SoTexture.h:269
@ RGB5
RGB5.
Definition SoTexture.h:219
@ RGB12
RGB12.
Definition SoTexture.h:227
@ AUTO_INTERNAL_FORMAT
Default.
Definition SoTexture.h:167
@ ALPHA_FLOAT16
ALPHA_FLOAT16.
Definition SoTexture.h:263
@ RGB5_ALPHA1
RGB5_ALPHA1.
Definition SoTexture.h:237
@ RGB4
RGB4.
Definition SoTexture.h:217
@ DEPTH24_STENCIL8
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 9....
Definition SoTexture.h:325
@ LUMINANCE4_ALPHA4
LUMINANCE4_ALPHA4.
Definition SoTexture.h:191
@ LUMINANCE12
LUMINANCE12.
Definition SoTexture.h:185
@ COMPRESSED_INTENSITY
COMPRESSED_INTENSITY.
Definition SoTexture.h:277
@ LUMINANCE8_ALPHA8
LUMINANCE8_ALPHA8.
Definition SoTexture.h:195
@ RGB10_ALPHA2
RGB10_ALPHA2.
Definition SoTexture.h:241
@ COMPRESSED_SIGNED_RED_RGTC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:305
@ COMPRESSED_LUMINANCE
COMPRESSED_LUMINANCE.
Definition SoTexture.h:273
@ RGB_FLOAT32
RGB_FLOAT32.
Definition SoTexture.h:249
@ LUMINANCE8
LUMINANCE8.
Definition SoTexture.h:183
@ RGBA12
RGBA12.
Definition SoTexture.h:243
@ RGBA16
RGBA16.
Definition SoTexture.h:245
@ ALPHA16
ALPHA16.
Definition SoTexture.h:177
@ LUMINANCE12_ALPHA12
LUMINANCE12_ALPHA12.
Definition SoTexture.h:199
@ LUMINANCE_ALPHA
LUMINANCE_ALPHA.
Definition SoTexture.h:189
@ RGB10
RGB10.
Definition SoTexture.h:225
@ INTENSITY16
INTENSITY16.
Definition SoTexture.h:211
@ LUMINANCE16
LUMINANCE16.
Definition SoTexture.h:187
@ ALPHA12
ALPHA12.
Definition SoTexture.h:175
@ R8I
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 10....
Definition SoTexture.h:329
@ RGBA_FLOAT16
RGBA_FLOAT16.
Definition SoTexture.h:259
@ COMPRESSED_SIGNED_RED_GREEN_RGTC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:313
@ RGB_FLOAT16
RGB_FLOAT16.
Definition SoTexture.h:261
@ DEPTH_COMPONENT16
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 9....
Definition SoTexture.h:317
@ COMPRESSED_RGBA
COMPRESSED_RGBA.
Definition SoTexture.h:281
@ COMPRESSED_LUMINANCE_ALPHA
COMPRESSED_LUMINANCE_ALPHA.
Definition SoTexture.h:275
@ INTENSITY_FORMAT
INTENSITY_FORMAT.
Definition SoTexture.h:203
@ COMPRESSED_RED_GREEN_RGTC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:309
@ LUMINANCE16_ALPHA16
LUMINANCE16_ALPHA16.
Definition SoTexture.h:201
@ LUMINANCE_FLOAT16
LUMINANCE_FLOAT16.
Definition SoTexture.h:267
@ ALPHA8
ALPHA8.
Definition SoTexture.h:173
@ RG8
RG8.
Definition SoTexture.h:221
@ INTENSITY8
INTENSITY8.
Definition SoTexture.h:207
@ LUMINANCE_FLOAT32
LUMINANCE_FLOAT32.
Definition SoTexture.h:255
@ COMPRESSED_RED_RGTC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:301
@ R3_G3_B2
R3_G3_B2.
Definition SoTexture.h:213
@ ALPHA_FLOAT32
ALPHA_FLOAT32.
Definition SoTexture.h:251
@ RGB8
RGB8.
Definition SoTexture.h:223
@ INTENSITY_FLOAT16
INTENSITY_FLOAT16.
Definition SoTexture.h:265
SoSFEnum internalFormat
Internal format for texture storage.
Definition SoTexture.h:537
SoSFEnum model
Specifies how to map texture onto surface.
Definition SoTexture.h:565
static SbRasterImage * readTexture(const SbString &filename, FileType filetype=UNKNOWN)
Convenience function that loads the image data from any texture file supported by Open Inventor and r...
SoSFColor blendColor
Color used for BLEND model.
Definition SoTexture.h:570
SoSFBool enableCompressedTexture
Enables storage of textures on the graphics board in compressed form.
Definition SoTexture.h:552
int SbBool
Boolean type.
Definition SbBase.h:87