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:
88  ClusterTexCoordMapping() : m_len(0) {}
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_ */
void first(int id)
Definition: example.cpp:7
Mapping of clusters to texture coordinates for a single vertex.
size_t m_len
The number of stored pairs.
TexCoords(float u=0, float v=0)
Constructor.
Texture coordinates.
array< boost::optional< pair< ClusterHandle, TexCoords > >, 100 > m_mapping
The mapping of cluster handles to texture coordinates.
Handle to access Cluster of the ClusterBiMap.
Definition: Handles.hpp:152
TexCoords getTexCoords(ClusterHandle clusterH) const
Returns the texture coordinates to a given cluster handle.
void push(ClusterHandle handle, TexCoords tex)
Adds an entry to the mapping.
float v
v-coordinate
float u
u-coordinate


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 Mon Feb 28 2022 22:46:06