Visual Computing Library
Loading...
Searching...
No Matches
vcl::comp::TextureImages Class Reference

The TextureImages class represents a component that stores the textures used by a mesh. This component makes sense only if it is used by meshes, and therefore it cannot be stored vertically or be optional (no template arguments are needed for these options). More...

#include <vclib/mesh/components/texture_images.h>

Inheritance diagram for vcl::comp::TextureImages:

Public Types

using TextureType = Texture
 Expose the type of the Texture.
 
using TextureIterator = std::vector< Texture >::iterator
 
using ConstTextureIterator = std::vector< Texture >::const_iterator
 
using TexFileNamesIterator = decltype(std::declval< detail::TData >().pathBegin())
 
using ConstTexFileNamesIterator = decltype(std::declval< const detail::TData >().pathBegin())
 

Public Member Functions

 TextureImages ()=default
 Initializes the component with an empty vector of textures and an empty string as mesh base path.
 
uint textureNumber () const
 Returns the number of texture of the mesh.
 
const Texturetexture (uint i) const
 Returns the i-th texture of the mesh. The path of the texture is relative to the mesh base path.
 
Texturetexture (uint i)
 Returns a reference to the i-th texture of the mesh. The path of the texture is relative to the mesh base path.
 
const std::string & texturePath (uint i) const
 Returns the path of the i-th texture of the mesh. The path is relative to the mesh base path.
 
std::string & texturePath (uint i)
 Returns a reference to the path of the i-th texture of the mesh. The path is relative to the mesh base path.
 
const std::string & meshBasePath () const
 Returns the mesh base path.
 
std::string & meshBasePath ()
 Returns a reference to the mesh base path.
 
void clearTextures ()
 Clears the vector of textures.
 
void clearTexturePaths ()
 Clears the vector of textures.
 
void pushTexture (const Texture &texture)
 Adds a texture to the vector of textures.
 
void pushTexturePath (const std::string &textPath)
 Adds a texture to the vector of textures. The image of the texture is left empty.
 
TextureIterator textureBegin ()
 Returns an iterator to the beginning of the vector of textures.
 
TextureIterator textureEnd ()
 Returns an iterator to the end of the vector of textures.
 
ConstTextureIterator textureBegin () const
 Returns a const iterator to the beginning of the vector of textures.
 
ConstTextureIterator textureEnd () const
 Returns a const iterator to the end of the vector of textures.
 
TexFileNamesIterator texturePathBegin ()
 Returns an iterator to the beginning of the vector of texture paths.
 
TexFileNamesIterator texturePathEnd ()
 Returns an iterator to the end of the vector of texture paths.
 
ConstTexFileNamesIterator texturePathBegin () const
 Returns a const iterator to the beginning of the vector of texture paths.
 
ConstTexFileNamesIterator texturePathEnd () const
 Returns a const iterator to the end of the vector of texture paths.
 
View< TextureIterator > textures ()
 Returns a lightweigth view object that stores the begin and end iterators of the vector of textures. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:
 
View< ConstTextureIterator > textures () const
 Returns a lightweigth const view object that stores the begin and end iterators of the vector of textures. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:
 
auto texturePaths ()
 Returns a lightweigth view object that stores the begin and end iterators of the vector of texture paths. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:
 
auto texturePaths () const
 Returns a lightweigth const view object that stores the begin and end iterators of the vector of texture paths. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:
 

Protected Member Functions

template<typename Element >
void importFrom (const Element &e, bool=true)
 
void serialize (std::ostream &os) const
 
void deserialize (std::istream &is)
 

Private Types

using Base = Component< TextureImages, CompId::TEXTURE_IMAGES, detail::TData, void, false, false >
 

Private Member Functions

std::vector< Texture > & texs ()
 
const std::vector< Texture > & texs () const
 

Detailed Description

The TextureImages class represents a component that stores the textures used by a mesh. This component makes sense only if it is used by meshes, and therefore it cannot be stored vertically or be optional (no template arguments are needed for these options).

The TextureImages component stores a vector of textures that are composed by an image and a path relative to the mesh path. The mesh path is stored as well, and it is used to construct the absolute paths of the textures.

The member functions of this class will be available in the instance of any Mesh that will contain this component.

For example, if you have a Mesh m with the TextureImages component, you'll be able to access to this component member functions from m:

for (const auto& texture : m.textures()) {
// do something with texture
}
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
View< TextureIterator > textures()
Returns a lightweigth view object that stores the begin and end iterators of the vector of textures....
Definition texture_images.h:319
const Texture & texture(uint i) const
Returns the i-th texture of the mesh. The path of the texture is relative to the mesh base path.
Definition texture_images.h:147

Member Function Documentation

◆ clearTexturePaths()

void vcl::comp::TextureImages::clearTexturePaths ( )
inline

Clears the vector of textures.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the clearTextures() member function instead.

◆ pushTexture()

void vcl::comp::TextureImages::pushTexture ( const Texture texture)
inline

Adds a texture to the vector of textures.

Parameters
[in]textureThe texture to add.

◆ pushTexturePath()

void vcl::comp::TextureImages::pushTexturePath ( const std::string &  textPath)
inline

Adds a texture to the vector of textures. The image of the texture is left empty.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the pushTexture() member function instead.
Parameters
[in]textPathThe texture path to add.

◆ texture() [1/2]

Texture & vcl::comp::TextureImages::texture ( uint  i)
inline

Returns a reference to the i-th texture of the mesh. The path of the texture is relative to the mesh base path.

Parameters
[in]iThe index of the texture.

◆ texture() [2/2]

const Texture & vcl::comp::TextureImages::texture ( uint  i) const
inline

Returns the i-th texture of the mesh. The path of the texture is relative to the mesh base path.

Parameters
[in]iThe index of the texture.

◆ textureBegin() [1/2]

TextureIterator vcl::comp::TextureImages::textureBegin ( )
inline

Returns an iterator to the beginning of the vector of textures.

Returns
an iterator to the beginning of the vector of textures.

◆ textureBegin() [2/2]

ConstTextureIterator vcl::comp::TextureImages::textureBegin ( ) const
inline

Returns a const iterator to the beginning of the vector of textures.

Returns
a const iterator to the beginning of the vector of textures.

◆ textureEnd() [1/2]

TextureIterator vcl::comp::TextureImages::textureEnd ( )
inline

Returns an iterator to the end of the vector of textures.

Returns
an iterator to the end of the vector of textures.

◆ textureEnd() [2/2]

ConstTextureIterator vcl::comp::TextureImages::textureEnd ( ) const
inline

Returns a const iterator to the end of the vector of textures.

Returns
a const iterator to the end of the vector of textures.

◆ texturePath() [1/2]

std::string & vcl::comp::TextureImages::texturePath ( uint  i)
inline

Returns a reference to the path of the i-th texture of the mesh. The path is relative to the mesh base path.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the texture(uint).path() member function instead.
Parameters
[in]iThe index of the texture.

◆ texturePath() [2/2]

const std::string & vcl::comp::TextureImages::texturePath ( uint  i) const
inline

Returns the path of the i-th texture of the mesh. The path is relative to the mesh base path.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the texture(uint).path() member function instead.
Parameters
[in]iThe index of the texture.

◆ texturePathBegin() [1/2]

TexFileNamesIterator vcl::comp::TextureImages::texturePathBegin ( )
inline

Returns an iterator to the beginning of the vector of texture paths.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the textureBegin() member function instead.
Returns
an iterator to the beginning of the vector of texture paths.

◆ texturePathBegin() [2/2]

ConstTexFileNamesIterator vcl::comp::TextureImages::texturePathBegin ( ) const
inline

Returns a const iterator to the beginning of the vector of texture paths.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the textureBegin() member function instead.
Returns
a const iterator to the beginning of the vector of texture paths.

◆ texturePathEnd() [1/2]

TexFileNamesIterator vcl::comp::TextureImages::texturePathEnd ( )
inline

Returns an iterator to the end of the vector of texture paths.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the texturePathEnd() member function instead.
Returns
an iterator to the end of the vector of texture paths.

◆ texturePathEnd() [2/2]

ConstTexFileNamesIterator vcl::comp::TextureImages::texturePathEnd ( ) const
inline

Returns a const iterator to the end of the vector of texture paths.

Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the texturePathEnd() member function instead.
Returns
a const iterator to the end of the vector of texture paths.

◆ texturePaths() [1/2]

auto vcl::comp::TextureImages::texturePaths ( )
inline

Returns a lightweigth view object that stores the begin and end iterators of the vector of texture paths. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:

for (auto& tpath : m.texturePaths()) {
// Do something with tpath
}
auto texturePaths()
Returns a lightweigth view object that stores the begin and end iterators of the vector of texture pa...
Definition texture_images.h:364
Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the textures() member function instead.
Returns
a lightweight view object that can be used in range-based for loops to iterate over the vector of texture paths.

◆ texturePaths() [2/2]

auto vcl::comp::TextureImages::texturePaths ( ) const
inline

Returns a lightweigth const view object that stores the begin and end iterators of the vector of texture paths. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:

for (const auto& tpath : m.texturePaths()) {
// Do something with tpath
}
Note
This member function is provided for compatibility with the TexturePaths component. It is recommended to use the textures() member function instead.
Returns
a lightweight view object that can be used in range-based for loops to iterate over the vector of texture paths.

◆ textures() [1/2]

View< TextureIterator > vcl::comp::TextureImages::textures ( )
inline

Returns a lightweigth view object that stores the begin and end iterators of the vector of textures. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:

for (auto& texture : m.texturess()) {
// Do something with texture
}
Returns
a lightweight view object that can be used in range-based for loops to iterate over the vector of textures.

◆ textures() [2/2]

View< ConstTextureIterator > vcl::comp::TextureImages::textures ( ) const
inline

Returns a lightweigth const view object that stores the begin and end iterators of the vector of textures. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:

for (const auto& texture : m.textures()) {
// Do something with texture
}
Returns
a lightweight view object that can be used in range-based for loops to iterate over the vector of textures.

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