23#ifndef VCL_MESH_COMPONENTS_TEXTURE_PATHS_H
24#define VCL_MESH_COMPONENTS_TEXTURE_PATHS_H
26#include "bases/component.h"
28#include <vclib/concepts/mesh/components/texture_images.h>
29#include <vclib/concepts/mesh/components/texture_paths.h>
30#include <vclib/io/serialization.h>
31#include <vclib/types/view.h>
42 std::vector<std::string> texPaths;
76 CompId::TEXTURE_PATHS,
82 using Base = Component<
84 CompId::TEXTURE_PATHS,
92 using TexFileNamesIterator = std::vector<std::string>::iterator;
93 using ConstTexFileNamesIterator = std::vector<std::string>::const_iterator;
127 const std::string&
meshBasePath()
const {
return Base::data().meshPath; }
168 return texPaths().begin();
178 return texPaths().end();
224 template<
typename Element>
225 void importFrom(
const Element& e,
bool =
true)
229 for (
const auto&
tex : e.textures()) {
230 texPaths().push_back(
tex.path());
236 void serialize(std::ostream& os)
const
238 vcl::serialize(os, texPaths());
242 void deserialize(std::istream& is)
244 vcl::deserialize(is, texPaths());
250 std::vector<std::string>& texPaths() {
return Base::data().texPaths; }
252 const std::vector<std::string>& texPaths()
const
254 return Base::data().texPaths;
The Element class.
Definition element.h:57
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The View class is a simple class that stores and exposes two iterators begin and end.
Definition view.h:67
The TexturePaths class represents a component that stores the paths of the textures used by a mesh....
Definition texture_paths.h:81
uint textureNumber() const
Returns the number of texture paths of the mesh.
Definition texture_paths.h:108
TexFileNamesIterator texturePathBegin()
Returns an iterator to the beginning of the vector of texture paths.
Definition texture_paths.h:153
void clearTexturePaths()
Clears the vector of texture paths.
Definition texture_paths.h:137
TexFileNamesIterator texturePathEnd()
Returns an iterator to the end of the vector of texture paths.
Definition texture_paths.h:159
TexturePaths()=default
Initializes the component with an empty vector of texture paths, and an empty string as mesh base pat...
std::string & meshBasePath()
Returns a reference to the mesh base path.
Definition texture_paths.h:132
View< ConstTexFileNamesIterator > texturePaths() const
Returns a lightweigth const view object that stores the begin and end iterators of the vector of text...
Definition texture_paths.h:217
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 bas...
Definition texture_paths.h:122
ConstTexFileNamesIterator texturePathEnd() const
Returns a const iterator to the end of the vector of texture paths.
Definition texture_paths.h:176
const std::string & meshBasePath() const
Returns the mesh base path.
Definition texture_paths.h:127
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
ConstTexFileNamesIterator texturePathBegin() const
Returns a const iterator to the beginning of the vector of texture paths.
Definition texture_paths.h:166
void pushTexturePath(const std::string &textName)
Adds a texture path to the vector of texture paths.
Definition texture_paths.h:143
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.
Definition texture_paths.h:115
HasTexturePaths concept is satisfied only if a Mesh class provides the member functions specified in ...
Definition texture_paths.h:47