Visual Computing Library  devel
Loading...
Searching...
No Matches
vcl::TextureDescriptor Class Reference

Describes the properties of a texture, such as its source path and rendering parameters. More...

#include <vclib/space/core/texture_descriptor.h>

Public Types

enum class  MagnificationFilter { NONE = -1 , NEAREST = 9728 , LINEAR }
 Defines the texture magnification filter modes, following the glTF 2.0 specification. The magnification filter is used when the pixel being textured maps to an area less than or equal to one texel. More...
 
enum class  MinificationFilter {
  NONE = -1 , NEAREST = 9728 , LINEAR , NEAREST_MIPMAP_NEAREST ,
  LINEAR_MIPMAP_NEAREST , NEAREST_MIPMAP_LINEAR , LINEAR_MIPMAP_LINEAR
}
 Defines the texture minification filter modes, following the glTF 2.0 specification. The minification filter is used when the pixel being textured maps to an area greater than one texel. More...
 
enum class  WrapMode { REPEAT = 10497 , CLAMP_TO_EDGE = 33071 , MIRRORED_REPEAT = 33648 }
 Defines the texture wrapping modes for S (U) and T (V) coordinates, following the glTF 2.0 specification. More...
 

Public Member Functions

void deserialize (std::istream &is)
 Deserializes the TextureDescriptor from an input stream.
 
bool isNull () const
 Checks whether the texture descriptor is null (i.e., has an empty path).
 
MagnificationFiltermagFilter ()
 Gets a mutable reference to the magnification filter of the texture.
 
MagnificationFilter magFilter () const
 Gets the magnification filter of the texture.
 
MinificationFilterminFilter ()
 Gets a mutable reference to the minification filter of the texture.
 
MinificationFilter minFilter () const
 Gets the minification filter of the texture.
 
bool operator== (const TextureDescriptor &other) const =default
 Compares this TextureDescriptor with another for equality.
 
std::string & path ()
 Gets a mutable reference to the file path of the texture.
 
const std::string & path () const
 Gets the file path of the texture.
 
void serialize (std::ostream &os) const
 Serializes the TextureDescriptor to an output stream.
 
 TextureDescriptor ()
 Default constructor. Initializes with an empty path and default filter/wrap modes.
 
 TextureDescriptor (const std::string &path)
 Constructs a TextureDescriptor from a file path.
 
WrapModewrapU ()
 Gets a mutable reference to the wrap mode for the U (S) texture coordinate.
 
WrapMode wrapU () const
 Gets the wrap mode for the U (S) texture coordinate.
 
WrapModewrapV ()
 Gets a mutable reference to the wrap mode for the V (T) texture coordinate.
 
WrapMode wrapV () const
 Gets the wrap mode for the V (T) texture coordinate.
 

Private Attributes

MagnificationFilter mMagFilter
 The magnification filter mode.
 
MinificationFilter mMinFilter
 The minification filter mode.
 
std::string mPath
 The file path to the texture source.
 
WrapMode mWrapU
 The wrap mode for the U (S) texture coordinate.
 
WrapMode mWrapV
 The wrap mode for the V (T) texture coordinate.
 

Detailed Description

Describes the properties of a texture, such as its source path and rendering parameters.

This class encapsulates metadata for a texture, including its file path, minification and magnification filters, and texture coordinate wrapping modes. The enum values for filters and wrap modes follow the glTF 2.0 specification.

Member Enumeration Documentation

◆ MagnificationFilter

Defines the texture magnification filter modes, following the glTF 2.0 specification. The magnification filter is used when the pixel being textured maps to an area less than or equal to one texel.

Enumerator
NONE 

No filter specified.

NEAREST 

Nearest neighbor filtering.

LINEAR 

Linear filtering.

◆ MinificationFilter

Defines the texture minification filter modes, following the glTF 2.0 specification. The minification filter is used when the pixel being textured maps to an area greater than one texel.

Enumerator
NONE 

No filter specified.

NEAREST 

Nearest neighbor filtering.

LINEAR 

Linear filtering.

NEAREST_MIPMAP_NEAREST 

Nearest neighbor filtering with the nearest mipmap level.

LINEAR_MIPMAP_NEAREST 

Linear filtering with the nearest mipmap level.

NEAREST_MIPMAP_LINEAR 

Nearest neighbor filtering with linear interpolation between mipmap levels.

LINEAR_MIPMAP_LINEAR 

Linear filtering with linear interpolation between mipmap levels (trilinear filtering).

◆ WrapMode

Defines the texture wrapping modes for S (U) and T (V) coordinates, following the glTF 2.0 specification.

Enumerator
REPEAT 

The texture repeats.

CLAMP_TO_EDGE 

The texture coordinates are clamped to the [0.0, 1.0] range.

MIRRORED_REPEAT 

The texture repeats in a mirrored fashion.

Constructor & Destructor Documentation

◆ TextureDescriptor()

vcl::TextureDescriptor::TextureDescriptor ( const std::string &  path)
inline

Constructs a TextureDescriptor from a file path.

Filter/wrap modes are initialized to default values.

Parameters
[in]pathThe file path of the texture.

Member Function Documentation

◆ deserialize()

void vcl::TextureDescriptor::deserialize ( std::istream &  is)
inline

Deserializes the TextureDescriptor from an input stream.

Parameters
[in/out]is: The input stream.

◆ isNull()

bool vcl::TextureDescriptor::isNull ( ) const
inline

Checks whether the texture descriptor is null (i.e., has an empty path).

Returns
true if the path is empty, false otherwise.

◆ magFilter() [1/2]

MagnificationFilter & vcl::TextureDescriptor::magFilter ( )
inline

Gets a mutable reference to the magnification filter of the texture.

Returns
A reference to the magnification filter mode.

◆ magFilter() [2/2]

MagnificationFilter vcl::TextureDescriptor::magFilter ( ) const
inline

Gets the magnification filter of the texture.

Returns
The magnification filter mode.

◆ minFilter() [1/2]

MinificationFilter & vcl::TextureDescriptor::minFilter ( )
inline

Gets a mutable reference to the minification filter of the texture.

Returns
A reference to the minification filter mode.

◆ minFilter() [2/2]

MinificationFilter vcl::TextureDescriptor::minFilter ( ) const
inline

Gets the minification filter of the texture.

Returns
The minification filter mode.

◆ operator==()

bool vcl::TextureDescriptor::operator== ( const TextureDescriptor other) const
default

Compares this TextureDescriptor with another for equality.

Parameters
[in]otherThe other TextureDescriptor to compare against.
Returns
true if all members are equal, false otherwise.

◆ path() [1/2]

std::string & vcl::TextureDescriptor::path ( )
inline

Gets a mutable reference to the file path of the texture.

Returns
A reference to the texture's file path.

◆ path() [2/2]

const std::string & vcl::TextureDescriptor::path ( ) const
inline

Gets the file path of the texture.

Returns
A const reference to the texture's file path.

◆ serialize()

void vcl::TextureDescriptor::serialize ( std::ostream &  os) const
inline

Serializes the TextureDescriptor to an output stream.

Parameters
[in/out]os: The output stream.

◆ wrapU() [1/2]

WrapMode & vcl::TextureDescriptor::wrapU ( )
inline

Gets a mutable reference to the wrap mode for the U (S) texture coordinate.

Returns
A reference to the U wrap mode.

◆ wrapU() [2/2]

WrapMode vcl::TextureDescriptor::wrapU ( ) const
inline

Gets the wrap mode for the U (S) texture coordinate.

Returns
The U wrap mode.

◆ wrapV() [1/2]

WrapMode & vcl::TextureDescriptor::wrapV ( )
inline

Gets a mutable reference to the wrap mode for the V (T) texture coordinate.

Returns
A reference to the V wrap mode.

◆ wrapV() [2/2]

WrapMode vcl::TextureDescriptor::wrapV ( ) const
inline

Gets the wrap mode for the V (T) texture coordinate.

Returns
The V wrap mode.

Member Data Documentation

◆ mMagFilter

MagnificationFilter vcl::TextureDescriptor::mMagFilter
private
Initial value:

The magnification filter mode.

◆ mMinFilter

MinificationFilter vcl::TextureDescriptor::mMinFilter
private
Initial value:

The minification filter mode.

◆ mWrapU

WrapMode vcl::TextureDescriptor::mWrapU
private
Initial value:

The wrap mode for the U (S) texture coordinate.

◆ mWrapV

WrapMode vcl::TextureDescriptor::mWrapV
private
Initial value:

The wrap mode for the V (T) texture coordinate.


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