H3D API  2.4.1
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
H3D::TextureProperties Class Reference

TextureProperties allows fine control over a texture's application. More...

#include <H3D/TextureProperties.h>

Inheritance diagram for H3D::TextureProperties:
Inheritance graph

Public Member Functions

 TextureProperties (Inst< SFNode > _metadata=0, Inst< SFFloat > _anisotropicDegree=0, Inst< SFColorRGBA > _borderColor=0, Inst< SFInt32 > _borderWidth=0, Inst< SFString > _boundaryModeS=0, Inst< SFString > _boundaryModeT=0, Inst< SFString > _boundaryModeR=0, Inst< SFString > _magnificationFilter=0, Inst< SFString > _minificationFilter=0, Inst< SFString > _textureCompression=0, Inst< SFFloat > _texturePriority=0, Inst< SFBool > _generateMipMaps=0, Inst< SFVec4f > _textureTransferScale=0, Inst< SFVec4f > _textureTransferBias=0, Inst< SFString > _textureCompareMode=0, Inst< SFFloat > _textureCompareFailValue=0, Inst< SFString > _textureType=0, Inst< SFString > _textureFormat=0)
 Constructor.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual void renderTextureProperties (GLenum texture_target, bool texture_provided_mip_maps)
 Render all OpenGL texture properties that are set by glTexParamter calls for the given texture_target.
 
virtual bool glInternalFormat (Image *image, GLint &internal_format)
 Function that returns true if internal_format input is set.
 
virtual bool glPixelFormat (Image *image, GLenum &pixel_format)
 Function that returns true if pixel_format input is set.
 
virtual bool match (const TextureProperties *tp)
 Function that check if this textureProperites matches another one.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual void render ()
 the render() function is used for the depth-first rendering traversal of the scene-graph. More...
 
virtual void traverseSG (TraverseInfo &ti)
 traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More...
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 

Public Attributes

H3DUniquePtr< SFFloatanisotropicDegree
 The anisotropicDegree field describes the minimum degree of anisotropy to account for in texture filtering. More...
 
H3DUniquePtr< SFColorRGBAborderColor
 The borderColor field describes the color to use for border pixels. More...
 
H3DUniquePtr< SFInt32borderWidth
 The borderWidth field describes the color to use for border pixels. More...
 
H3DUniquePtr< SFStringboundaryModeS
 The boundaryModeS field describes the way S texture coordinate boundaries are handled. More...
 
H3DUniquePtr< SFStringboundaryModeT
 The boundaryModeT field describes the way T texture coordinate boundaries are handled. More...
 
H3DUniquePtr< SFStringboundaryModeR
 The boundaryModeR field describes the way R texture coordinate boundaries are handled. More...
 
H3DUniquePtr< SFStringmagnificationFilter
 The magnificationFilter field describes the way textures are filtered when the image is smaller then the screen space representation. More...
 
H3DUniquePtr< SFStringminificationFilter
 The minificationFilter field describes the way textures are filtered when the image is larger then the screen space representation. More...
 
H3DUniquePtr< SFStringtextureCompression
 The textureCompression fields describes if/how a texture should be compressed. More...
 
H3DUniquePtr< SFFloattexturePriority
 The texturePriority field describes the texture residence priority for allocating texture memory. More...
 
H3DUniquePtr< SFBoolgenerateMipMaps
 The generateMipMaps field describes whether mipmaps should be generated for the texture. More...
 
H3DUniquePtr< SFVec4ftextureTransferScale
 The textureTransferScale field defines the scale component of the transfer function from image value to texture memory value. More...
 
H3DUniquePtr< SFVec4ftextureTransferBias
 The textureTransferBias field defines the bias component of the transfer function from image value to texture memory value. More...
 
H3DUniquePtr< FieldpropertyChanged
 Field that gets an event when any of the X3D fields in the TextureProperties generates an event.
 
H3DUniquePtr< SFStringtextureCompareMode
 The textureCompareMode field specifies what texture compare function to use. More...
 
H3DUniquePtr< SFFloattextureCompareFailValue
 The textureCompareFailValue contains the value to use as texture output when the test in textureCompareMode fails. More...
 
H3DUniquePtr< SFStringtextureType
 The textureType specifies what texture target type should be used for the texture. More...
 
H3DUniquePtr< SFStringtextureFormat
 The textureFormat specifies the format of the texture. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

TextureProperties allows fine control over a texture's application.

This node can be used to set the texture properties for a node with a textureProperties field. A texture with a TextureProperties node will ignore the repeatS and repeatT fields on the texture.

The anisotropicDegree field describes the minimum degree of anisotropy to account for in texture filtering. A value of 1 implies no anisotropic filtering. Values above the system's maximum supported value will be clamped to the maximum allowed.

The borderColor field describes the color to use for border pixels.

The borderWidth field describes the number of pixels to use for a texture border.

The boundaryModeS, boundaryModeT nad boundaryModeR fields describe the way texture coordinate boundaries are handled. Valid values are:

The magnificationFilter field describes the way textures are filtered when the image is smaller then the screen space representation. Valid values are:

The minificationFilter field describes the way textures are filtered when the image is larger then the screen space representation. Valid values are:

-"AVG_PIXEL" Select the weighted average of the four texture elements that are closest to the center of the pixel being textured.
-"AVG_PIXEL_AVG_MIPMAP" Performs tri-linear filtering. Choose the two mipmaps that most closely match the size of the pixel being textured and use the weighted average of the four texture elements that are closest to the center of the pixel to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
-"AVG_PIXEL_NEAREST_MIPMAP" Choose the mipmap that most closely matches the size of the pixel being textured and use the weighted average of the four texture elements that are closest to the center of the pixel to produce a texture value.
-"DEFAULT" Select the browser-specified default minification mode.
-"FASTEST" Select the fastest method available. Mipmaps shall be used, if available.
-"NEAREST_PIXEL" Select the pixel that is nearest to the center of the pixel being textured.
-"NEAREST_PIXEL_AVG_MIPMAP" Choose the two mipmaps that most closely match the size of the pixel being textured and use the texture element nearest to the center of the pixel to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
-"NEAREST_PIXEL_NEAREST_MIPMAP" Choose the mipmap that most closely matches the size of the pixel being textured and use the texture element nearest to the center of the pixel) to produce a texture value.

-"NICEST" Select the highest quality method available. Mipmaps shall be used, if available.

Modes with MIPMAP in the name require mipmaps. If mipmaps are not provided, the mode shall pick the corresponding non-mipmapped mode (e.g., AVG_PIXEL_NEAREST_MIPMAP becomes AVG_PIXEL).

The texturePriority field describes the texture residence priority for allocating texture memory. Zero indicates the lowest priority and 1 indicates the highest priority. Values are clamped to the range [0,1].

The generateMipMaps field describes whether mipmaps should be generated for the texture. Mipmaps are required for filtering modes with MIPMAP in their value.

The textureCompression fields describes if/how a texture should be compressed. Valid values are:

The textureCompareMode field specifies what texture compare function to use. Texture compare is used to compare the R texture coordinates to the texture value and return 1 if the test succeeds and textureCompareFailValue on fail. The output of a texture lookup with this enabled will there for only return 1 or textureCompareFailValue depending on the test. The original texture value is only used for the test. The normal usage of this is when using shadow mapping to determine if a fragment is in shadow or not.

The valid values are:

"NONE"No texture compare is done. Texture works as normal.
"GEQUAL"Output texture value is 1 if R texture coordinate >= original texture value, textureCompareFailValue otherwise.
"LEQUAL"Output texture value is 1 if R texture coordinate <= original texture value, textureCompareFailValue otherwise.

The textureCompareFailValue contains the value to use as texture output when the test in textureCompareMode fails.

The textureType specifies what texture target type should be used for the texture. This can affect how texture values are interpolated and how texture coordinates are used to look up into the texture.

The valid values are:

"NORMAL"GL_TEXTURE_2D for 2d textures and GL_TEXTURE_3D for 3d textures.
"2D_RECTANGLE"GL_TEXTURE_RECTANGLE. Only valid for 2D textures. Make the texture lookup in pixel space instead of as normal with normalized coordinates. E.g. tex coord (4,5) will look up the pixel with that index directly
"2D_ARRAY"GL_TEXTURE_2D_ARRAY. Only valid for 3D textures and together with shaders. Texture is a stack of 2D images where the R component specifies the index of the 2D image to use.

Examples:

Internal routes:

Member Function Documentation

◆ defaultXMLContainerField()

virtual string H3D::TextureProperties::defaultXMLContainerField ( )
inlinevirtual

Returns the default xml containerField attribute value.

For this node it is "textureProperties".

Reimplemented from H3D::Node.

Member Data Documentation

◆ anisotropicDegree

H3DUniquePtr< SFFloat > H3D::TextureProperties::anisotropicDegree

The anisotropicDegree field describes the minimum degree of anisotropy to account for in texture filtering.

A value of 1 implies no anisotropic filtering. Values above the system's maximum supported value will be clamped to the maximum allowed.

Access type: inputOutput
Default value: 1.0

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ borderColor

H3DUniquePtr< SFColorRGBA > H3D::TextureProperties::borderColor

The borderColor field describes the color to use for border pixels.

Access type: inputOutput
Default value: 0 0 0 0

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ borderWidth

H3DUniquePtr< SFInt32 > H3D::TextureProperties::borderWidth

The borderWidth field describes the color to use for border pixels.

Access type: inputOutput
Default value: 0

Referenced by H3D::X3DTexture2DNode::glTexImage(), H3D::X3DTexture3DNode::glTexImage(), match(), and TextureProperties().

◆ boundaryModeR

H3DUniquePtr< SFString > H3D::TextureProperties::boundaryModeR

The boundaryModeR field describes the way R texture coordinate boundaries are handled.

Access type: inputOutput
Default value: "REPEAT"

Referenced by H3D::DepthMapSurface::initialize(), match(), renderTextureProperties(), and TextureProperties().

◆ boundaryModeS

H3DUniquePtr< SFString > H3D::TextureProperties::boundaryModeS

The boundaryModeS field describes the way S texture coordinate boundaries are handled.

Access type: inputOutput
Default value: "REPEAT"

Referenced by H3D::DepthMapSurface::initialize(), match(), renderTextureProperties(), and TextureProperties().

◆ boundaryModeT

H3DUniquePtr< SFString > H3D::TextureProperties::boundaryModeT

The boundaryModeT field describes the way T texture coordinate boundaries are handled.

Access type: inputOutput
Default value: "REPEAT"

Referenced by H3D::DepthMapSurface::initialize(), match(), renderTextureProperties(), and TextureProperties().

◆ generateMipMaps

H3DUniquePtr< SFBool > H3D::TextureProperties::generateMipMaps

The generateMipMaps field describes whether mipmaps should be generated for the texture.

Mipmaps are required for filtering modes with MIPMAP in their value.

Access type: inputOutput
Default value: false

Referenced by H3D::X3DTexture2DNode::glTexImage(), H3D::X3DTexture3DNode::glTexImage(), match(), and TextureProperties().

◆ magnificationFilter

H3DUniquePtr< SFString > H3D::TextureProperties::magnificationFilter

The magnificationFilter field describes the way textures are filtered when the image is smaller then the screen space representation.


Access type: inputOutput
Default value: "FASTEST"

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ minificationFilter

H3DUniquePtr< SFString > H3D::TextureProperties::minificationFilter

The minificationFilter field describes the way textures are filtered when the image is larger then the screen space representation.


Access type: inputOutput
Default value: "FASTEST"

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ textureCompareFailValue

H3DUniquePtr< SFFloat > H3D::TextureProperties::textureCompareFailValue

The textureCompareFailValue contains the value to use as texture output when the test in textureCompareMode fails.

Access type: inputOutput
Default value: 0

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ textureCompareMode

H3DUniquePtr< SFString > H3D::TextureProperties::textureCompareMode

The textureCompareMode field specifies what texture compare function to use.

Texture compare is used to compare the R texture coordinates to the texture value and return 1 if the test succeeds and textureCompareFailValue on fail. The output of a texture lookup with this enabled will there for only return 1 or textureCompareFailValue depending on the test. The original texture value is only used for the test. The normal usage of this is when using shadow mapping to determine if a fragment is in shadow or not.

The valid values are:

"NONE"No texture compare is done. Texture works as normal.
"GEQUAL"Output texture value is 1 if R texture coordinate >= original texture value, textureCompareFailValue otherwise.
"LEQUAL"Output texture value is 1 if R texture coordinate <= original texture value, textureCompareFailValue otherwise.

Access type: inputOutput
Valid values: "NONE", "GEQUAL", "LEQUAL"
Default value: "NONE"

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ textureCompression

H3DUniquePtr< SFString > H3D::TextureProperties::textureCompression

The textureCompression fields describes if/how a texture should be compressed.

Access type: inputOutput
Default value: "FASTEST"

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ textureFormat

H3DUniquePtr< SFString > H3D::TextureProperties::textureFormat

The textureFormat specifies the format of the texture.

Can be used to set a specific sized internal format and pixel format used by glTexImageXX calls, This field is ignored if the textureCompression is not DEFAULT.

The valid values are:

"NORMAL"Format is decided by the internal Image data read from file or by default settings for a texture type.
"INTEGER"internal format and pixel format are as defined in the OpenGL extension EXT_texture_integer. The image (if there is one) decides number of bytes, number of channels and whether the data is unsigned or signed.
"FLOAT"internal format and pixel format are as defined in the OpenGL extension ARB_texture_float. The internal Image class (if there is one) decides number of bytes and number of channels.

Access type: inputOutput
Valid values: "NORMAL", "INTEGER", "FLOAT", "SRGB"
Default value: "NORMAL"

Referenced by glInternalFormat(), glPixelFormat(), match(), and TextureProperties().

◆ texturePriority

H3DUniquePtr< SFFloat > H3D::TextureProperties::texturePriority

The texturePriority field describes the texture residence priority for allocating texture memory.

Zero indicates the lowest priority and 1 indicates the highest priority. Values are clamped to the range [0,1].

Access type: inputOutput
Default value: 0

Referenced by match(), renderTextureProperties(), and TextureProperties().

◆ textureTransferBias

H3DUniquePtr< SFVec4f > H3D::TextureProperties::textureTransferBias

The textureTransferBias field defines the bias component of the transfer function from image value to texture memory value.

When the image data is transferred to texture memory a scaling factor and bias value can be added to each pixel value before putting it into texture space. The four values are mapped to r, g, b and alpha components respectively. This does not affect the values in the image field of the texture, but only the values in texture memory. E.g. texture_memory_value.r = (image_value.r * textureTransferScale.x) + textureTransferBias.x Access type: inputOutput
Default value: 0 0 0 0

Referenced by H3D::X3DTexture2DNode::glTexImage(), H3D::X3DTexture3DNode::glTexImage(), match(), H3D::X3DTexture2DNode::renderSubImage(), H3D::X3DTexture3DNode::renderSubImage(), and TextureProperties().

◆ textureTransferScale

H3DUniquePtr< SFVec4f > H3D::TextureProperties::textureTransferScale

The textureTransferScale field defines the scale component of the transfer function from image value to texture memory value.

When the image data is transferred to texture memory a scaling factor and bias value can be added to each pixel value before putting it into texture space. The four values are mapped to r, g, b and alpha components respectively. This does not affect the values in the image field of the texture, but only the values in texture memory. E.g. texture_memory_value.r = (image_value.r * textureTransferScale.x) + textureTransferBias.x

Access type: inputOutput
Default value: 1 1 1 1

Referenced by H3D::X3DTexture2DNode::glTexImage(), H3D::X3DTexture3DNode::glTexImage(), match(), H3D::X3DTexture2DNode::renderSubImage(), H3D::X3DTexture3DNode::renderSubImage(), and TextureProperties().

◆ textureType

H3DUniquePtr< SFString > H3D::TextureProperties::textureType

The textureType specifies what texture target type should be used for the texture.

This can affect how texture values are interpolated and how texture coordinates are used to look up into the texture.

The valid values are:

"NORMAL"GL_TEXTURE_2D for 2d textures and GL_TEXTURE_3D for 3d textures.
"2D_RECTANGLE"GL_TEXTURE_RECTANGLE. Only valid for 2D textures. Make the texture lookup in pixel space instead of as normal with normalized coordinates. E.g. tex coord (4,5) will look up the pixel with that index directly
"2D_ARRAY"GL_TEXTURE_2D_ARRAY. Only valid for 3D textures and together with shaders. Texture is a stack of 2D images where the R component specifies the index of the 2D image to use.

Access type: inputOutput
Valid values: "NORMAL", "2D_RECTANGLE"(if 2d texture), "2D_ARRAY"(if 3d texture)
Default value: "NORMAL"

Referenced by match(), and TextureProperties().


The documentation for this class was generated from the following files: