ClusterTexCoordMapping.hpp
Go to the documentation of this file.
1 
28 /*
29 * Texturizer.tcc
30 *
31 * @date 23.07.2017
32 * @author Jan Philipp Vogtherr <jvogtherr@uni-osnabrueck.de>
33 * @author Kristin Schmidt <krschmidt@uni-osnabrueck.de>
34 */
35 
36 #ifndef LVR2_TEXTURE_CLUSTER_TEXCOORD_MAPPING_H_
37 #define LVR2_TEXTURE_CLUSTER_TEXCOORD_MAPPING_H_
38 
40 
41 #include <vector>
42 #include <utility>
43 
44 using std::vector;
45 using std::pair;
46 
47 namespace lvr2
48 {
49 
54 struct TexCoords
55 {
57  float u;
59  float v;
60 
64  TexCoords(float u = 0, float v = 0) : u(u), v(v) {}
65 
66 };
67 
77 {
78 private:
80  array<boost::optional<pair<ClusterHandle, TexCoords>>, 100> m_mapping;
82  size_t m_len;
83 
84 public:
89 
96  inline void push(ClusterHandle handle, TexCoords tex)
97  {
98  if (m_len == m_mapping.size())
99  {
100  cout << "Error: Overflow in ClusterTexCoordMapping" << endl;
101  }
102  else
103  {
104  m_mapping[m_len] = std::make_pair(handle, tex);
105  m_len++;
106  }
107  }
108 
116  inline TexCoords getTexCoords(ClusterHandle clusterH) const
117  {
118  for (size_t i = 0; i < m_len; i++)
119  {
120  if (m_mapping[i]->first == clusterH)
121  {
122  return m_mapping[i]->second;
123  }
124  }
125  return TexCoords();
126  }
127 
128 
129 
130 };
131 
132 } // namespace lvr2
133 
134 #endif /* LVR2_TEXTURE_CLUSTER_TEXCOORD_MAPPING_H_ */
Handles.hpp
lvr2::ClusterTexCoordMapping::push
void push(ClusterHandle handle, TexCoords tex)
Adds an entry to the mapping.
Definition: ClusterTexCoordMapping.hpp:96
lvr2::ClusterTexCoordMapping
Mapping of clusters to texture coordinates for a single vertex.
Definition: ClusterTexCoordMapping.hpp:76
lvr2::TexCoords::v
float v
v-coordinate
Definition: ClusterTexCoordMapping.hpp:59
lvr2::ClusterTexCoordMapping::m_mapping
array< boost::optional< pair< ClusterHandle, TexCoords > >, 100 > m_mapping
The mapping of cluster handles to texture coordinates.
Definition: ClusterTexCoordMapping.hpp:80
lvr2::TexCoords::u
float u
u-coordinate
Definition: ClusterTexCoordMapping.hpp:57
lvr2::ClusterTexCoordMapping::m_len
size_t m_len
The number of stored pairs.
Definition: ClusterTexCoordMapping.hpp:82
lvr2::TexCoords::TexCoords
TexCoords(float u=0, float v=0)
Constructor.
Definition: ClusterTexCoordMapping.hpp:64
lvr2::ClusterHandle
Handle to access Cluster of the ClusterBiMap.
Definition: Handles.hpp:152
lvr2
Definition: BaseBufferManipulators.hpp:39
first
void first(int id)
Definition: example.cpp:7
lvr2::ClusterTexCoordMapping::ClusterTexCoordMapping
ClusterTexCoordMapping()
Constructor.
Definition: ClusterTexCoordMapping.hpp:88
lvr2::ClusterTexCoordMapping::getTexCoords
TexCoords getTexCoords(ClusterHandle clusterH) const
Returns the texture coordinates to a given cluster handle.
Definition: ClusterTexCoordMapping.hpp:116
lvr2::TexCoords
Texture coordinates.
Definition: ClusterTexCoordMapping.hpp:54


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23