SOTEXTURE2(3iv)

✨ NAME ✨

SoTexture2 β€” the texture mapping node πŸ’… (this is page 3IV, bestie, we're in the Inventor section of the manual and it's giving iconic)


πŸ¦‹ INHERITS FROM πŸ¦‹

SoBase > SoFieldContainer > SoNode > SoTexture2

the family tree is lowkey a whole lineage, and SoTexture2 is the main character at the bottom of it πŸ‘‘

🌸 SYNOPSIS 🌸

#include <Inventor/nodes/SoTexture2.h>

okay so first up, the enums, and they matter, don't skip them:

enum Model {
     SoTexture2::MODULATE  The texture color is multiplied by the surface
                                color
     SoTexture2::DECAL     The texture color replaces the surface color
     SoTexture2::BLEND     Blends between the surface color and a
                                specified blend color
}

enum Wrap {
     SoTexture2::REPEAT  Repeats texture outside 0-1 texture coordinate
                              range
     SoTexture2::CLAMP   Clamps texture coordinates to lie within 0-1
                              range
}

Fields from class SoTexture2:

SoSFString          filename
SoSFImage           image
SoSFEnum            wrapS
SoSFEnum            wrapT
SoSFEnum            model
SoSFColor           blendColor

Methods from class SoTexture2:

                     SoTexture2()
static SoType       getClassTypeId()

Methods from class SoNode:

void                setOverride(SbBool state)
SbBool              isOverride() const
SoNode *            copy(SbBool copyConnections = FALSE) const
virtual SbBool      affectsState() const
static SoNode *     getByName(const SbName &name)
static int          getByName(const SbName &name, SoNodeList &list)

Methods from class SoFieldContainer:

void                setToDefaults()
SbBool              hasDefaultValues() const
SbBool              fieldsAreEqual(const SoFieldContainer *fc) const
void                copyFieldValues(const SoFieldContainer *fc, SbBool
                         copyConnections = FALSE)
SbBool              set(const char *fieldDataString)
void                get(SbString &fieldDataString)
virtual int         getFields(SoFieldList &resultList) const
virtual SoField *   getField(const SbName &fieldName) const
SbBool              getFieldName(const SoField *field, SbName &fieldName)
                         const
SbBool              isNotifyEnabled() const
SbBool              enableNotify(SbBool flag)

Methods from class SoBase:

void                ref()
void                unref() const
void                unrefNoDelete() const
void                touch()
virtual SoType      getTypeId() const
SbBool              isOfType(SoType type) const
virtual void        setName(const SbName &name)
virtual SbName      getName() const

πŸ’– DESCRIPTION πŸ’–

So this is a property node, and what it does is define a texture map plus the parameters for that map. That map then gets used to slap texture onto every subsequent shape as they get rendered. It's a whole vibe-setting node fr fr.

The texture can be read from the file you point at with the filename field. Once the texture has been read, the image field holds the texture data. BUT β€” heads up β€” this field is marked so the image is not written out when the texture node itself gets written to a file. Sneaky. And when you want to turn texturing off, you set the filename field to an empty string (""). That's the off switch, periodt.

Textures can also be specified in memory, by setting the image field to contain the texture data directly. Doing that resets the filename to the empty string. (Yes, they fight over the same spot. That's the rule.)

Now the sizing tea β˜•: if the texture image's width or height is not a power of 2, or the image's width or height is greater than the maximum supported by OpenGL, then the image will be automatically scaled up or down to the next power of 2, or to the maximum texture size. For maximum speed, point-sampling is used to do the scale. If you want more accurate resampling, pre-filter your images to a power of 2 that's smaller than the maximum texture size β€” and use the OpenGL glGetIntegerv(GL_MAX_TEXTURE_SIZE...) call to figure out the max texture for a specific OpenGL implementation.

The quality of the texturing is affected by the textureQuality field of the SoComplexity node. That textureQuality field affects what kind of filtering gets done to the texture when it must be minified or magnified. The mapping of a particular texture quality value to a particular OpenGL filtering technique is implementation dependent, and it varies based on the texturing performance. And if mipmap filtering is required, the mipmaps are automatically created using the simple box filter. No cap. 🫢


πŸŽ€ FIELDS πŸŽ€

  • SoSFString filename β€” names the file from which to read the texture image. Currently only SGI .rgb files are supported, ngl. If the filename is not an absolute path name, the list of directories maintained by SoInput gets searched. If the texture is not found in any of those directories, then the file is searched for relative to the directory from which the SoTexture2 node was read. For example, if an SoTexture2 node with a filename of "../tofu.rgb" is read from /usr/people/bob/models/food.iv, then /usr/people/bob/tofu.rgb will be read (assuming tofu.rgb isn't found in the directories maintained by SoInput). πŸ“
  • SoSFImage image β€” contains an in-memory representation of the texture map. It's either the contents of the file read from filename, an image read directly from an Inventor file, or an image set programmatically using the methods provided by SoSFImage.
  • SoSFEnum wrapS
  • SoSFEnum wrapT β€” indicates what to do when texture coordinates in the S (horizontal) or T (vertical) direction lie outside the range 0-1.
  • SoSFEnum model β€” specifies how to map the texture onto the surface.
  • SoSFColor blendColor β€” the color used for the BLEND model. πŸ’œ

πŸ’… METHODS πŸ’…

  • SoTexture2() β€” creates a texture node with default settings. Fresh out the box, defaults on defaults. ✨
  • static SoType getClassTypeId() β€” returns the type identifier for this class. iykyk.

πŸ”₯ ACTION BEHAVIOR πŸ”₯

SoGLRenderAction, SoCallbackAction β€” sets the current texture in state. That's it, that's the behavior, she ate. πŸ‘‘


🌈 FILE FORMAT/DEFAULTS 🌈

Texture2 {
     filename    ""
     image       0 0 0
     wrapS       REPEAT
     wrapT       REPEAT
     model       MODULATE
     blendColor  0 0 0
}

⭐ SEE ALSO ⭐

SoComplexity, SoMaterial, SoTexture2Transform, SoTextureCoordinate2, SoTextureCoordinateBinding, SoTextureCoordinateFunction


and that's the whole page, bestie 🧚 this was SoTexture2(3IV)(), signed off the exact same way it came in β€” SoTexture2(3IV)() β€” no date on it, just the source/version tag chilling at the bottom like a little footnote πŸ’– go texture something iconic πŸ’…βœ¨