Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoTexture.h
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-2024 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
28#include <Inventor/fields/SoSFVec4f.h>
29#include <Inventor/fields/SoSFEnum.h>
30#include <Inventor/fields/SoSFImage.h>
31#include <Inventor/fields/SoSFString.h>
32#include <Inventor/fields/SoSFBool.h>
33#include <Inventor/fields/SoSFFloat.h>
34#include <Inventor/fields/SoSFColor.h>
35#include <Inventor/fields/SoSFInt32.h>
36#include <Inventor/nodes/SoNode.h>
37#include <Inventor/sys/SoGLType.h>
38#include <Inventor/elements/SoTextureImageElement.h>
39#include <SoDeprecationRules.h>
40#include <Inventor/SbEnums.h>
41#include <Inventor/renderer/RendererResourceMacro.h>
42
43class SoFieldSensor;
44class SoNodeSensor;
45class SbRasterImage;
46class SoGLTexture;
47
49namespace inventor {
50 namespace impl{
51 class SoExtTexture2Impl;
52 class SoIndexedTexture2Impl;
53 class SoRenderToTexturePropertyImpl;
54 };
55 namespace renderer{
56 class RendererContext;
57 }
58};
59
60namespace inventor {
61namespace renderer{
62 template<typename T> struct Resource;
63 class FixedPipelineShader;
64};
65};
68#ifndef GL_COMBINE
69#define GL_COMBINE 0x8570
70#endif
71#ifndef GL_CLAMP_TO_BORDER
72#define GL_CLAMP_TO_BORDER 0x812D
73#endif
74#ifndef GL_CLAMP_TO_EDGE
75#define GL_CLAMP_TO_EDGE 0x812F
76#endif
77#ifndef GL_MIRRORED_REPEAT
78#define GL_MIRRORED_REPEAT 0x8370
79#endif
80
81SO_PIMPL_BASE_PUBLIC_DECLARATION(SoTexture)
82
83
84//
85// Class: SoTexture
86//
87// Texture node.
88//
90
156class SoTexture : public SoNode {
157
158 SO_NODE_ABSTRACT_HEADER(SoTexture);
159
160 SO_PIMPL_BASE_PUBLIC_HEADER(SoTexture);
161 RENDERER_RESOURCE(SoTexture);
162public:
170 ALPHA_FORMAT,SoDEPRECATED ALPHA4,
180 LUMINANCE_FORMAT, SoDEPRECATED LUMINANCE4,
204 INTENSITY_FORMAT, SoDEPRECATED INTENSITY4,
354#ifndef HIDDEN_FROM_DOC
355 LAST_FORMAT
356#endif
357 };
358
360 enum Model {
364 MODULATE = SbEnums::TEX_MODEL_MODULATE,
365
375 DECAL = SbEnums::TEX_MODEL_DECAL,
376
380 BLEND = SbEnums::TEX_MODEL_BLEND,
381
387 REPLACE = SbEnums::TEX_MODEL_REPLACE,
388
394 ADD = SbEnums::TEX_MODEL_ADD,
395
403 COMBINE = SbEnums::TEX_MODEL_COMBINE
404
405 };
406
408 enum Wrap {
412 REPEAT = SbEnums::TEX_ADDRESS_REPEAT,
413
419 CLAMP = SbEnums::TEX_ADDRESS_CLAMP,
420
427 CLAMP_TO_BORDER = SbEnums::TEX_ADDRESS_CLAMP_BORDER,
428
435 CLAMP_TO_EDGE = SbEnums::TEX_ADDRESS_CLAMP_TO_EDGE,
436
443 MIRRORED_REPEAT = SbEnums::TEX_ADDRESS_MIRROR_REPEAT
444
445 };
446
453 {
455 AUTO = SbEnums::TEX_FILTER_AUTO,
457 NEAREST = SbEnums::TEX_FILTER_NEAREST,
459 LINEAR = SbEnums::TEX_FILTER_LINEAR,
461 NEAREST_MIPMAP_NEAREST = SbEnums::TEX_FILTER_NEAREST_MIPMAP_NEAREST,
463 NEAREST_MIPMAP_LINEAR = SbEnums::TEX_FILTER_NEAREST_MIPMAP_LINEAR,
465 LINEAR_MIPMAP_NEAREST = SbEnums::TEX_FILTER_LINEAR_MIPMAP_NEAREST,
467 LINEAR_MIPMAP_LINEAR = SbEnums::TEX_FILTER_LINEAR_MIPMAP_LINEAR
468 } ;
469
477 HW_NPOT = 0,
478
483
488
493
498
503
508
513
518
523
524#ifndef HIDDEN_FROM_DOC
525 HW_LAST
526#endif
527 };
528
539
554
561
567
572
580
588
601
619
640
669
680
685
694
699 inline virtual void setOverride(const SbBool state)
700 { override.setValue(state); }
701
705 inline virtual SbBool isOverride() const
706 { return override.getValue(); }
707
718 static SbRasterImage* readTexture( const SbString& filename, FileType filetype = UNKNOWN );
719
720private:
721 virtual void doAction(SoAction *action)=0;
722 virtual void GLRender(SoGLRenderAction *action)=0;
723 virtual void callback(SoCallbackAction *action);
724
725private:
726 static void initClass();
727 static void exitClass();
728
733 virtual bool affectsPath() const;
734
735 SoSFBool override;
736
742 SoSFBool forInternalShader;
743
745 enum NumSamplesSpecialValues
746 {
748 INHERIT_FROM_CURRENT_TARGET = -2,
749 };
750
759 SoSFInt32 numSamples;
760
768 int getNumSamples();
769
775 static int getNumSamples(SoState* state);
776
778 void updateFromState(SoState* state);
779
780 enum SubImageCopyPolicy
781 {
782 SUBIMAGE_NO_COPY,
783 SUBIMAGE_COPY,
784 SUBIMAGE_NO_COPY_AND_DELETE,
785 };
786
788 void subImage(const std::vector<SoTextureImageElementBase::TextureDataConfiguration>& subTextures,
789 SubImageCopyPolicy copyPolicy = SUBIMAGE_COPY);
790
791private:
792 SoTexture();
793
794 virtual ~SoTexture();
795
796private:
797
798#if 1 SoDEPRECATED
800 SoSFBool useAutoMipmap;
801#endif
804 void commonConstructor();
805
806 friend class inventor::impl::SoExtTexture2Impl;
807 friend class inventor::impl::SoIndexedTexture2Impl;
808 friend class inventor::impl::SoRenderToTexturePropertyImpl;
809 friend struct inventor::renderer::Resource<SoTexture>;
810 friend class inventor::renderer::FixedPipelineShader;
811 friend class inventor::renderer::RendererContext;
812};
813
814#endif /* _SO_TEXTURE_ */
815
<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 int32_t integer.
Definition SoSFInt32.h:80
Field containing a homogeneous three-dimensional vector.
Definition SoSFVec4f.h:80
Traversal state.
Definition SoState.h:74
Abstract base class for texture mapping nodes.
Definition SoTexture.h:156
SoSFBool enableBorder
Enables borders for textures.
Definition SoTexture.h:579
SoSFVec4f borderColor
Defines border color used for border texture filtering.
Definition SoTexture.h:587
FileType
File Type possible values.
Definition SoTexture.h:643
@ BMP
BMP.
Definition SoTexture.h:657
@ TIFF
TIFF.
Definition SoTexture.h:651
@ JPEG2000
JPEG2000.
Definition SoTexture.h:661
@ GIF
GIF.
Definition SoTexture.h:653
@ UNKNOWN
Unknown file.
Definition SoTexture.h:645
@ SGI
SGI.
Definition SoTexture.h:649
@ JPEG
JPEG.
Definition SoTexture.h:655
@ HDRI
HDRI.
Definition SoTexture.h:665
@ RGB
RGB.
Definition SoTexture.h:647
@ DDS
DDS.
Definition SoTexture.h:663
@ PNG
PNG.
Definition SoTexture.h:659
FileType getBitmapFileType(void)
Gets the texture file format.
virtual void setOverride(const SbBool state)
Set the state of the override field.
Definition SoTexture.h:699
SoSFEnum minFilter
Specifies the OpenGL minFilter.
Definition SoTexture.h:618
static SbBool isSupported(HW_Feature feature)
Returns information about hardware support for various texture features.
Wrap
Texture wrap type.
Definition SoTexture.h:408
Model
Texture Combiner Functions.
Definition SoTexture.h:360
virtual SbBool isOverride() const
Returns the state of the override field.
Definition SoTexture.h:705
SoSFEnum wrapS
Indicates what to do when texture coordinates in the S (horizontal) direction lie outside the range 0...
Definition SoTexture.h:560
void setBitmapFileType(FileType in_type)
Sets the texture file format.
SoSFEnum magFilter
Specifies the OpenGL magFilter.
Definition SoTexture.h:639
@ HW_MIRRORED_REPEAT
Check support for texture coordinates mirrored repeat.
Definition SoTexture.h:507
@ HW_FLOATFORMAT
Check support for floating point texture format.
Definition SoTexture.h:482
@ HW_COMPRESSION_LATC
Check support for texture_compression_latc.
Definition SoTexture.h:517
@ HW_AUTOMIPMAP
Check support for automatic mipmap generation.
Definition SoTexture.h:492
@ HW_COMPRESSION_RGTC
Check support for texture_compression_rgtc.
Definition SoTexture.h:522
@ HW_DEPTHFORMAT
Check support for depth textures.
Definition SoTexture.h:487
@ HW_EDGE_CLAMP
Check support for texture coordinates edge clamp.
Definition SoTexture.h:502
@ HW_COMPRESSION_S3TC
Check support for DDS support (S3TC)
Definition SoTexture.h:512
@ HW_BORDER_CLAMP
Check support for texture coordinates border clamp.
Definition SoTexture.h:497
SoSFFloat maxAnisotropy
Specifies on a per-texture object basis, the maximum degree of anisotropy to account for in texture f...
Definition SoTexture.h:600
Filter
Specifies the OpenGL filtering method for minification and magnification.
Definition SoTexture.h:453
InternalFormat
Texture internal storage format.
Definition SoTexture.h:166
@ RGB16
RGB16.
Definition SoTexture.h:230
@ COMPRESSED_LUMINANCE_LATC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:286
@ RGBA2
RGBA2.
Definition SoTexture.h:234
@ ALPHA_FORMAT
ALPHA_FORMAT.
Definition SoTexture.h:170
@ RGBA8
RGBA8.
Definition SoTexture.h:240
@ DEPTH_COMPONENT24
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 9....
Definition SoTexture.h:322
@ RGB_FORMAT
RGB_FORMAT.
Definition SoTexture.h:216
@ LUMINANCE12_ALPHA4
LUMINANCE12_ALPHA4.
Definition SoTexture.h:198
@ COMPRESSED_RGB
COMPRESSED_RGB.
Definition SoTexture.h:280
@ INTENSITY12
INTENSITY12.
Definition SoTexture.h:210
@ LUMINANCE6_ALPHA2
LUMINANCE6_ALPHA2.
Definition SoTexture.h:194
@ COMPRESSED_SIGNED_LUMINANCE_LATC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:290
@ RGBA4
RGBA4.
Definition SoTexture.h:236
@ COMPRESSED_LUMINANCE_ALPHA_LATC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:294
@ RGBA_FORMAT
RGBA_FORMAT.
Definition SoTexture.h:232
@ RGBA_FLOAT32
RGBA_FLOAT32.
Definition SoTexture.h:248
@ LUMINANCE_FORMAT
LUMINANCE_FORMAT.
Definition SoTexture.h:180
@ COMPRESSED_ALPHA
COMPRESSED_ALPHA.
Definition SoTexture.h:272
@ LUMINANCE_ALPHA_FLOAT32
LUMINANCE_ALPHA_FLOAT32.
Definition SoTexture.h:258
@ COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:298
@ INTENSITY_FLOAT32
INTENSITY_FLOAT32.
Definition SoTexture.h:254
@ LUMINANCE_ALPHA_FLOAT16
LUMINANCE_ALPHA_FLOAT16.
Definition SoTexture.h:270
@ RGB5
RGB5.
Definition SoTexture.h:220
@ RGB12
RGB12.
Definition SoTexture.h:228
@ AUTO_INTERNAL_FORMAT
Default.
Definition SoTexture.h:168
@ ALPHA_FLOAT16
ALPHA_FLOAT16.
Definition SoTexture.h:264
@ RGB5_ALPHA1
RGB5_ALPHA1.
Definition SoTexture.h:238
@ RGB4
RGB4.
Definition SoTexture.h:218
@ DEPTH24_STENCIL8
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 9....
Definition SoTexture.h:326
@ LUMINANCE4_ALPHA4
LUMINANCE4_ALPHA4.
Definition SoTexture.h:192
@ LUMINANCE12
LUMINANCE12.
Definition SoTexture.h:186
@ COMPRESSED_INTENSITY
COMPRESSED_INTENSITY.
Definition SoTexture.h:278
@ LUMINANCE8_ALPHA8
LUMINANCE8_ALPHA8.
Definition SoTexture.h:196
@ RGB10_ALPHA2
RGB10_ALPHA2.
Definition SoTexture.h:242
@ COMPRESSED_SIGNED_RED_RGTC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:306
@ COMPRESSED_LUMINANCE
COMPRESSED_LUMINANCE.
Definition SoTexture.h:274
@ RGB_FLOAT32
RGB_FLOAT32.
Definition SoTexture.h:250
@ LUMINANCE8
LUMINANCE8.
Definition SoTexture.h:184
@ RGBA12
RGBA12.
Definition SoTexture.h:244
@ RGBA16
RGBA16.
Definition SoTexture.h:246
@ ALPHA16
ALPHA16.
Definition SoTexture.h:178
@ LUMINANCE12_ALPHA12
LUMINANCE12_ALPHA12.
Definition SoTexture.h:200
@ LUMINANCE_ALPHA
LUMINANCE_ALPHA.
Definition SoTexture.h:190
@ RGB10
RGB10.
Definition SoTexture.h:226
@ INTENSITY16
INTENSITY16.
Definition SoTexture.h:212
@ LUMINANCE16
LUMINANCE16.
Definition SoTexture.h:188
@ ALPHA12
ALPHA12.
Definition SoTexture.h:176
@ R8I
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 10....
Definition SoTexture.h:330
@ RGBA_FLOAT16
RGBA_FLOAT16.
Definition SoTexture.h:260
@ COMPRESSED_SIGNED_RED_GREEN_RGTC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:314
@ RGB_FLOAT16
RGB_FLOAT16.
Definition SoTexture.h:262
@ DEPTH_COMPONENT16
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 9....
Definition SoTexture.h:318
@ COMPRESSED_RGBA
COMPRESSED_RGBA.
Definition SoTexture.h:282
@ COMPRESSED_LUMINANCE_ALPHA
COMPRESSED_LUMINANCE_ALPHA.
Definition SoTexture.h:276
@ INTENSITY_FORMAT
INTENSITY_FORMAT.
Definition SoTexture.h:204
@ COMPRESSED_RED_GREEN_RGTC2
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:310
@ LUMINANCE16_ALPHA16
LUMINANCE16_ALPHA16.
Definition SoTexture.h:202
@ LUMINANCE_FLOAT16
LUMINANCE_FLOAT16.
Definition SoTexture.h:268
@ ALPHA8
ALPHA8.
Definition SoTexture.h:174
@ RG8
RG8.
Definition SoTexture.h:222
@ INTENSITY8
INTENSITY8.
Definition SoTexture.h:208
@ LUMINANCE_FLOAT32
LUMINANCE_FLOAT32.
Definition SoTexture.h:256
@ COMPRESSED_RED_RGTC1
<a href= EnumSince.html ><b>NOTE</b>: enumeration value available since Open Inventor</a> 7....
Definition SoTexture.h:302
@ R3_G3_B2
R3_G3_B2.
Definition SoTexture.h:214
@ ALPHA_FLOAT32
ALPHA_FLOAT32.
Definition SoTexture.h:252
@ RGB8
RGB8.
Definition SoTexture.h:224
@ INTENSITY_FLOAT16
INTENSITY_FLOAT16.
Definition SoTexture.h:266
SoSFEnum internalFormat
Internal format for texture storage.
Definition SoTexture.h:538
SoSFEnum model
Specifies how to map texture onto surface.
Definition SoTexture.h:566
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:571
SoSFBool enableCompressedTexture
Enables storage of textures on the graphics board in compressed form.
Definition SoTexture.h:553
int SbBool
Boolean type.
Definition SbBase.h:87