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

The TexturePaths class represents a component that stores the paths of 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_paths.h>

Inheritance diagram for vcl::comp::TexturePaths:

Public Types

using TexFileNamesIterator = std::vector< std::string >::iterator
 
using ConstTexFileNamesIterator = std::vector< std::string >::const_iterator
 

Public Member Functions

 TexturePaths ()=default
 Initializes the component with an empty vector of texture paths, and an empty string as mesh base path.
 
uint textureNumber () const
 Returns the number of texture paths of the mesh.
 
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 clearTexturePaths ()
 Clears the vector of texture paths.
 
void pushTexturePath (const std::string &textName)
 Adds a texture path to the vector of texture paths.
 
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< TexFileNamesIterator > 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:
 
View< ConstTexFileNamesIterator > 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< TexturePaths, CompId::TEXTURE_PATHS, detail::TPData, void, false, false >
 

Private Member Functions

std::vector< std::string > & texPaths ()
 
const std::vector< std::string > & texPaths () const
 

Detailed Description

The TexturePaths class represents a component that stores the paths of 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 TexturePaths component stores a vector of texture paths that are 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 TexturePaths component, you'll be able to access to this component member functions from m:

for (const auto& texPath : m.texturePaths()) {
auto absPath = m.meshBasePath() + texPath;
// do something with absPath
}
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
View< TexFileNamesIterator > texturePaths()
Returns a lightweigth view object that stores the begin and end iterators of the vector of texture pa...
Definition texture_paths.h:197

Member Function Documentation

◆ pushTexturePath()

void vcl::comp::TexturePaths::pushTexturePath ( const std::string &  textName)
inline

Adds a texture path to the vector of texture paths.

Parameters
[in]textNameThe texture path to add.

◆ texturePath() [1/2]

std::string & vcl::comp::TexturePaths::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.

Parameters
[in]iThe index of the texture.

◆ texturePath() [2/2]

const std::string & vcl::comp::TexturePaths::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.

Parameters
[in]iThe index of the texture.

◆ texturePathBegin() [1/2]

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

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

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

◆ texturePathBegin() [2/2]

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

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

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

◆ texturePathEnd() [1/2]

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

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

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

◆ texturePathEnd() [2/2]

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

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

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

◆ texturePaths() [1/2]

View< TexFileNamesIterator > vcl::comp::TexturePaths::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
}
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]

View< ConstTexFileNamesIterator > vcl::comp::TexturePaths::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
}
Returns
a lightweight view object that can be used in range-based for loops to iterate over the vector of texture paths.

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