src/vertexmap.cpp

changeset 259
c27612f0eac0
parent 250
2837b549e616
child 264
76a025db4948
equal deleted inserted replaced
258:fe094d0687ad 259:c27612f0eac0
1 #include "vertexmap.h" 1 #include "vertexmap.h"
2 #include "gl/common.h" 2 #include "gl/common.h"
3 3
4 unsigned int hashVertex(const glm::vec3& vec) 4 hash_t hashVertex(const glm::vec3& vec)
5 { 5 {
6 return qHash(glm::ivec3{ 6 return qHash(glm::ivec3{
7 int(vec.x * 10000), 7 int(vec.x * 10000),
8 int(vec.y * 10000), 8 int(vec.y * 10000),
9 int(vec.z * 10000), 9 int(vec.z * 10000),
128 const glm::vec3 c = glm::normalize(glm::cross(a, b)); 128 const glm::vec3 c = glm::normalize(glm::cross(a, b));
129 const glm::vec3 d = glm::normalize(glm::cross(a, c)); 129 const glm::vec3 d = glm::normalize(glm::cross(a, c));
130 return glm::mat4{{a, 0}, {-c, 0}, {d, 0}, {}}; 130 return glm::mat4{{a, 0}, {-c, 0}, {d, 0}, {}};
131 }); 131 });
132 points(element, [&](const glm::vec3 point) { 132 points(element, [&](const glm::vec3 point) {
133 const unsigned int hash = hashVertex(point); 133 const hash_t hash = hashVertex(point);
134 VertexInfo& info = this->map[hash]; 134 VertexInfo& info = this->map[hash];
135 info.point = point; 135 info.point = point;
136 info.objects.insert(this->model->idAt(i)); 136 info.objects.insert(this->model->idAt(i));
137 if (matrix.has_value() and not info.transformSet) 137 if (matrix.has_value() and not info.transformSet)
138 { 138 {

mercurial