22 face_index_data[geometry_type].reserve(face_index_data[geometry_type].size() + primitive_count);
23 vertex_data[geometry_type].reserve(vertex_data[geometry_type].size() + primitive_count * vertex_count * 3);
24 normal_data[geometry_type].reserve(normal_data[geometry_type].size() + primitive_count * vertex_count * 3);
25 color_data[geometry_type].reserve(color_data[geometry_type].size() + primitive_count * 4);
26 uv_data[geometry_type].reserve(uv_data[geometry_type].size() + primitive_count * vertex_count * 2);
27 texture_flag_data[geometry_type].reserve(texture_flag_data[geometry_type].size() + primitive_count);
28 texture_ID_data[geometry_type].reserve(texture_ID_data[geometry_type].size() + primitive_count);
29 coordinate_flag_data[geometry_type].reserve(coordinate_flag_data[geometry_type].size() + primitive_count);
30 delete_flag_data[geometry_type].reserve(delete_flag_data[geometry_type].size() + primitive_count);
31 context_geometry_flag_data[geometry_type].reserve(context_geometry_flag_data[geometry_type].size() + primitive_count);
32 sky_geometry_flag_data[geometry_type].reserve(sky_geometry_flag_data[geometry_type].size() + primitive_count);
33 size_data[geometry_type].reserve(size_data[geometry_type].size() + primitive_count);
37 bool has_glyph_texture,
uint coordinate_system,
bool visible_flag,
bool iscontextgeometry,
bool isskygeometry,
float size) {
42 assert(vertices.size() == vertex_count);
43 assert(uvs.empty() || uvs.size() == vertex_count);
46 std::vector<helios::vec3> vertices_copy = vertices;
48 bool geometry_is_new =
false;
49 if (!doesGeometryExist(UUID)) {
50 registerUUID(UUID, geometry_type);
51 geometry_is_new =
true;
54 if (coordinate_system == 0) {
57 for (
auto &vertex: vertices_copy) {
58 vertex.x = 2.f * vertex.x - 1.f;
59 vertex.y = 2.f * vertex.y - 1.f;
63 size_t vertex_index = UUID_map.at(UUID).vertex_index;
64 size_t normal_index = UUID_map.at(UUID).normal_index;
65 size_t uv_index = UUID_map.at(UUID).uv_index;
66 size_t color_index = UUID_map.at(UUID).color_index;
67 size_t texture_flag_index = UUID_map.at(UUID).texture_flag_index;
68 size_t texture_ID_index = UUID_map.at(UUID).texture_ID_index;
69 size_t size_index = UUID_map.at(UUID).size_index;
71 for (
char i = 0; i < vertex_count; i++) {
73 if (geometry_is_new) {
74 face_index_data[geometry_type].push_back(
static_cast<int>(visible_flag_data[geometry_type].size()));
76 vertex_data[geometry_type].push_back(vertices_copy.at(i).x);
77 vertex_data[geometry_type].push_back(vertices_copy.at(i).y);
78 vertex_data[geometry_type].push_back(vertices_copy.at(i).z);
82 vertex_data[geometry_type].at(vertex_index) = vertices_copy.at(i).x;
83 vertex_data[geometry_type].at(vertex_index + 1) = vertices_copy.at(i).y;
84 vertex_data[geometry_type].at(vertex_index + 2) = vertices_copy.at(i).z;
88 if ((geometry_type == GEOMETRY_TYPE_TRIANGLE || geometry_type == GEOMETRY_TYPE_RECTANGLE) && !uvs.empty()) {
90 if (geometry_is_new) {
91 uv_data[geometry_type].push_back(uvs.at(i).x);
92 uv_data[geometry_type].push_back(1.f - uvs.at(i).y);
95 if (has_glyph_texture) {
96 texture_flag_data[geometry_type].push_back(3);
97 }
else if (override_texture_color) {
98 texture_flag_data[geometry_type].push_back(2);
100 texture_flag_data[geometry_type].push_back(1);
102 texture_ID_data[geometry_type].push_back(textureID);
105 uv_data[geometry_type].at(uv_index) = uvs.at(i).x;
106 uv_data[geometry_type].at(uv_index + 1) = 1.f - uvs.at(i).y;
110 if (has_glyph_texture) {
111 texture_flag_data[geometry_type].at(texture_flag_index) = 3;
112 }
else if (override_texture_color) {
113 texture_flag_data[geometry_type].at(texture_flag_index) = 2;
115 texture_flag_data[geometry_type].at(texture_flag_index) = 1;
117 texture_flag_index++;
118 texture_ID_data[geometry_type].at(texture_ID_index) = textureID;
124 if (geometry_is_new) {
125 uv_data[geometry_type].push_back(0.f);
126 uv_data[geometry_type].push_back(0.f);
129 if (has_glyph_texture) {
130 texture_flag_data[geometry_type].push_back(3);
131 texture_ID_data[geometry_type].push_back(textureID);
133 texture_flag_data[geometry_type].push_back(0);
134 texture_ID_data[geometry_type].push_back(0);
138 uv_data[geometry_type].at(uv_index) = 0.f;
139 uv_data[geometry_type].at(uv_index + 1) = 0.f;
143 if (has_glyph_texture) {
144 texture_flag_data[geometry_type].at(texture_flag_index) = 3;
145 texture_ID_data[geometry_type].at(texture_ID_index) = textureID;
147 texture_flag_data[geometry_type].at(texture_flag_index) = 0;
148 texture_ID_data[geometry_type].at(texture_ID_index) = 0;
150 texture_flag_index++;
158 if (geometry_type == GEOMETRY_TYPE_TRIANGLE || geometry_type == GEOMETRY_TYPE_RECTANGLE) {
159 normal = normalize(
cross(vertices_copy.at(1) - vertices_copy.at(0), vertices_copy.at(2) - vertices_copy.at(0)));
161 if (geometry_is_new) {
162 normal_data[geometry_type].push_back(normal.
x);
163 normal_data[geometry_type].push_back(normal.
y);
164 normal_data[geometry_type].push_back(normal.
z);
166 color_data[geometry_type].push_back(color.
r);
167 color_data[geometry_type].push_back(color.
g);
168 color_data[geometry_type].push_back(color.
b);
169 color_data[geometry_type].push_back(color.
a);
171 coordinate_flag_data[geometry_type].push_back(coordinate_system);
173 visible_flag_data[geometry_type].push_back(visible_flag);
175 delete_flag_data[geometry_type].push_back(
false);
177 context_geometry_flag_data[geometry_type].push_back(iscontextgeometry);
179 sky_geometry_flag_data[geometry_type].push_back(isskygeometry ? 1 : 0);
181 size_data[geometry_type].push_back(size);
183 normal_data[geometry_type].at(normal_index) = normal.
x;
184 normal_data[geometry_type].at(normal_index + 1) = normal.
y;
185 normal_data[geometry_type].at(normal_index + 2) = normal.
z;
187 color_data[geometry_type].at(color_index) = color.
r;
188 color_data[geometry_type].at(color_index + 1) = color.
g;
189 color_data[geometry_type].at(color_index + 2) = color.
b;
190 color_data[geometry_type].at(color_index + 3) = color.
a;
192 size_data[geometry_type].at(size_index) = size;
198bool GeometryHandler::doesGeometryExist(
size_t UUID)
const {
199 return (UUID_map.find(UUID) != UUID_map.end());
202std::vector<size_t> GeometryHandler::getAllGeometryIDs()
const {
203 std::vector<size_t> result;
204 result.reserve(UUID_map.size());
205 for (
const auto &[UUID, primitivemap]: UUID_map) {
206 if (getDeleteFlag(UUID)) {
210 result.push_back(UUID);
215size_t GeometryHandler::getPrimitiveCount(
bool include_deleted)
const {
217 if (include_deleted) {
218 for (
auto &type: all_geometry_types) {
219 count += delete_flag_data.at(type).size();
224 for (
auto &type: all_geometry_types) {
225 count += std::count(delete_flag_data.at(type).begin(), delete_flag_data.at(type).end(),
false);
232 if (include_deleted) {
233 return delete_flag_data.at(type).size();
236 size_t count = std::count(delete_flag_data.at(type).begin(), delete_flag_data.at(type).end(),
false);
242 if (include_deleted) {
243 return delete_flag_data.at(type).size();
246 size_t count = std::count(delete_flag_data.at(type).begin(), delete_flag_data.at(type).end(),
false);
252 if (include_deleted) {
253 return delete_flag_data.at(type).size();
256 size_t count = std::count(delete_flag_data.at(type).begin(), delete_flag_data.at(type).end(),
false);
262 if (include_deleted) {
263 return delete_flag_data.at(type).size();
266 size_t count = std::count(delete_flag_data.at(type).begin(), delete_flag_data.at(type).end(),
false);
272 assert(face_index_data.find(geometry_type) != face_index_data.end());
274 return &face_index_data.at(geometry_type);
280 assert(UUID_map.find(UUID) != UUID_map.end());
283 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
285 const char vertex_count =
getVertexCount(index_map.geometry_type);
288 assert(vertices.size() == vertex_count);
292 std::vector<helios::vec3> vertices_to_store = vertices;
293 const uint coordinate_system = coordinate_flag_data.at(index_map.geometry_type).at(index_map.coordinate_flag_index);
294 if (coordinate_system == 0) {
296 for (
auto &vertex: vertices_to_store) {
297 vertex.x = 2.f * vertex.x - 1.f;
298 vertex.y = 2.f * vertex.y - 1.f;
302 const size_t vertex_ind = index_map.vertex_index;
305 for (
int i = 0; i < vertex_count; i++) {
306 vertex_data[index_map.geometry_type].at(vertex_ind + ii + 0) = vertices_to_store.at(i).x;
307 vertex_data[index_map.geometry_type].at(vertex_ind + ii + 1) = vertices_to_store.at(i).y;
308 vertex_data[index_map.geometry_type].at(vertex_ind + ii + 2) = vertices_to_store.at(i).z;
312 const size_t normal_ind = index_map.normal_index;
314 const helios::vec3 normal = normalize(
cross(vertices_to_store.at(1) - vertices_to_store.at(0), vertices_to_store.at(2) - vertices_to_store.at(0)));
315 normal_data[index_map.geometry_type].at(normal_ind + 0) = normal.
x;
316 normal_data[index_map.geometry_type].at(normal_ind + 1) = normal.
y;
317 normal_data[index_map.geometry_type].at(normal_ind + 2) = normal.
z;
325 assert(UUID_map.find(UUID) != UUID_map.end());
328 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
330 const size_t vertex_ind = index_map.vertex_index;
332 const char vertex_count =
getVertexCount(index_map.geometry_type);
334 std::vector<helios::vec3> vertices(vertex_count);
336 for (
int i = 0; i < vertex_count; i++) {
337 vertices.at(i).x = vertex_data.at(index_map.geometry_type).at(vertex_ind + i * 3 + 0);
338 vertices.at(i).y = vertex_data.at(index_map.geometry_type).at(vertex_ind + i * 3 + 1);
339 vertices.at(i).z = vertex_data.at(index_map.geometry_type).at(vertex_ind + i * 3 + 2);
344 const uint coordinate_system = coordinate_flag_data.at(index_map.geometry_type).at(index_map.coordinate_flag_index);
345 if (coordinate_system == 0) {
347 for (
auto &vertex: vertices) {
348 vertex.x = (vertex.x + 1.f) * 0.5f;
349 vertex.y = (vertex.y + 1.f) * 0.5f;
358 assert(vertex_data.find(geometry_type) != vertex_data.end());
360 return &vertex_data.at(geometry_type);
366 assert(UUID_map.find(UUID) != UUID_map.end());
369 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
371 const size_t normal_ind = index_map.normal_index;
375 normal.
x = normal_data.at(index_map.geometry_type).at(normal_ind + 0);
376 normal.
y = normal_data.at(index_map.geometry_type).at(normal_ind + 1);
377 normal.
z = normal_data.at(index_map.geometry_type).at(normal_ind + 2);
384 assert(normal_data.find(geometry_type) != normal_data.end());
386 return &normal_data.at(geometry_type);
392 assert(UUID_map.find(UUID) != UUID_map.end());
395 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
397 const size_t color_ind = index_map.color_index;
399 color_data[index_map.geometry_type].at(color_ind + 0) = color.
r;
400 color_data[index_map.geometry_type].at(color_ind + 1) = color.
g;
401 color_data[index_map.geometry_type].at(color_ind + 2) = color.
b;
402 color_data[index_map.geometry_type].at(color_ind + 3) = color.
a;
410 assert(UUID_map.find(UUID) != UUID_map.end());
413 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
415 const size_t color_ind = index_map.color_index;
417 const helios::RGBAcolor color{color_data.at(index_map.geometry_type).at(color_ind), color_data.at(index_map.geometry_type).at(color_ind + 1), color_data.at(index_map.geometry_type).at(color_ind + 2),
418 color_data.at(index_map.geometry_type).at(color_ind + 3)};
425 assert(color_data.find(geometry_type) != color_data.end());
427 return &color_data.at(geometry_type);
433 assert(UUID_map.find(UUID) != UUID_map.end());
436 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
438 if (index_map.geometry_type == GEOMETRY_TYPE_LINE || index_map.geometry_type == GEOMETRY_TYPE_POINT) {
443 const char vertex_count =
getVertexCount(index_map.geometry_type);
446 assert(uvs.size() == vertex_count);
449 const size_t uv_ind = index_map.uv_index;
452 for (
int i = 0; i < vertex_count; i++) {
453 uv_data.at(index_map.geometry_type).at(uv_ind + ii) = uvs.at(i).x;
454 uv_data.at(index_map.geometry_type).at(uv_ind + ii + 1) = uvs.at(i).y;
464 assert(UUID_map.find(UUID) != UUID_map.end());
467 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
469 const size_t uv_ind = index_map.uv_index;
471 const char vertex_count =
getVertexCount(index_map.geometry_type);
473 std::vector<helios::vec2> uvs(vertex_count);
475 for (
int i = 0; i < vertex_count; i++) {
476 uvs.at(i).x = uv_data.at(index_map.geometry_type).at(uv_ind + i * 2);
477 uvs.at(i).x = uv_data.at(index_map.geometry_type).at(uv_ind + i * 2 + 1);
485 assert(uv_data.find(geometry_type) != uv_data.end());
487 return &uv_data.at(geometry_type);
493 assert(UUID_map.find(UUID) != UUID_map.end());
496 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
498 if (index_map.geometry_type == GEOMETRY_TYPE_LINE || index_map.geometry_type == GEOMETRY_TYPE_POINT) {
503 const size_t texture_ind = index_map.texture_ID_index;
505 texture_ID_data.at(index_map.geometry_type).at(texture_ind) = textureID;
513 assert(UUID_map.find(UUID) != UUID_map.end());
516 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
518 const size_t texture_ID_ind = index_map.texture_ID_index;
520 return texture_ID_data.at(index_map.geometry_type).at(texture_ID_ind);
525 assert(texture_ID_data.find(geometry_type) != texture_ID_data.end());
527 return &texture_ID_data.at(geometry_type);
533 assert(UUID_map.find(UUID) != UUID_map.end());
536 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
538 if (index_map.geometry_type == GEOMETRY_TYPE_LINE || index_map.geometry_type == GEOMETRY_TYPE_POINT) {
543 const size_t texture_flag_ind = index_map.texture_flag_index;
545 const int current_flag = texture_flag_data.at(index_map.geometry_type).at(texture_flag_ind);
546 if (current_flag == 1) {
548 texture_flag_data.at(index_map.geometry_type).at(texture_flag_ind) = 2;
557 assert(UUID_map.find(UUID) != UUID_map.end());
560 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
562 if (index_map.geometry_type == GEOMETRY_TYPE_LINE || index_map.geometry_type == GEOMETRY_TYPE_POINT) {
567 const size_t texture_flag_ind = index_map.texture_flag_index;
570 texture_flag_data.at(index_map.geometry_type).at(texture_flag_ind) = 1;
577 assert(texture_flag_data.find(geometry_type) != texture_flag_data.end());
579 return &texture_flag_data.at(geometry_type);
585 assert(UUID_map.find(UUID) != UUID_map.end());
588 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
590 const size_t visibile_ind = index_map.visible_index;
592 visible_flag_data.at(index_map.geometry_type).at(visibile_ind) =
static_cast<char>(isvisible);
600 assert(UUID_map.find(UUID) != UUID_map.end());
603 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
605 const size_t visible_ind = index_map.visible_index;
607 return static_cast<bool>(visible_flag_data.at(index_map.geometry_type).at(visible_ind));
612 assert(visible_flag_data.find(geometry_type) != visible_flag_data.end());
614 return &visible_flag_data.at(geometry_type);
619 assert(coordinate_flag_data.find(geometry_type) != coordinate_flag_data.end());
621 return &coordinate_flag_data.at(geometry_type);
626 assert(UUID_map.find(UUID) != UUID_map.end());
629 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
630 const size_t sky_ind = index_map.sky_geometry_flag_index;
632 return static_cast<bool>(sky_geometry_flag_data.at(index_map.geometry_type).at(sky_ind));
637 assert(sky_geometry_flag_data.find(geometry_type) != sky_geometry_flag_data.end());
639 return &sky_geometry_flag_data.at(geometry_type);
645 assert(UUID_map.find(UUID) != UUID_map.end());
648 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
650 const size_t size_ind = index_map.size_index;
652 size_data[index_map.geometry_type].at(size_ind) = size;
660 assert(UUID_map.find(UUID) != UUID_map.end());
663 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
665 const size_t size_ind = index_map.size_index;
667 return size_data.at(index_map.geometry_type).at(size_ind);
672 assert(size_data.find(geometry_type) != size_data.end());
674 return &size_data.at(geometry_type);
677bool GeometryHandler::getDeleteFlag(
size_t UUID)
const {
679 assert(UUID_map.find(UUID) != UUID_map.end());
682 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
684 const size_t delete_flag_ind = index_map.delete_flag_index;
686 return delete_flag_data.at(index_map.geometry_type).at(delete_flag_ind);
692 assert(UUID_map.find(UUID) != UUID_map.end());
695 const PrimitiveIndexMap &index_map = UUID_map.at(UUID);
697 delete_flag_data.at(index_map.geometry_type).at(index_map.delete_flag_index) =
true;
698 visible_flag_data.at(index_map.geometry_type).at(index_map.visible_index) =
false;
702 deleted_primitive_count++;
704 if (deleted_primitive_count > 250000) {
710 for (
const auto &UUID: UUIDs) {
717 for (
const auto &geometry_type: all_geometry_types) {
718 if (vertex_data.find(geometry_type) == vertex_data.end()) {
722 face_index_data.at(geometry_type).clear();
723 vertex_data.at(geometry_type).clear();
724 normal_data.at(geometry_type).clear();
725 uv_data.at(geometry_type).clear();
726 color_data.at(geometry_type).clear();
727 texture_flag_data.at(geometry_type).clear();
728 texture_ID_data.at(geometry_type).clear();
729 coordinate_flag_data.at(geometry_type).clear();
730 visible_flag_data.at(geometry_type).clear();
731 context_geometry_flag_data.at(geometry_type).clear();
732 sky_geometry_flag_data.at(geometry_type).clear();
733 delete_flag_data.at(geometry_type).clear();
734 size_data.at(geometry_type).clear();
739 deleted_primitive_count = 0;
744 for (
const auto &geometry_type: all_geometry_types) {
745 if (vertex_data.find(geometry_type) == vertex_data.end()) {
749 for (
size_t i = 0; i < context_geometry_flag_data.at(geometry_type).size(); i++) {
750 assert(context_geometry_flag_data.at(geometry_type).size() == delete_flag_data.at(geometry_type).size());
751 if (context_geometry_flag_data.at(geometry_type).at(i)) {
752 delete_flag_data.at(geometry_type).at(i) =
true;
754 deleted_primitive_count++;
771 for (
const auto &[UUID, index_map]: UUID_map) {
773 if (coordinate_flag_data.at(index_map.geometry_type).at(index_map.coordinate_flag_index) == 0) {
779 for (
const auto &vertex: vertices) {
780 if (vertex.x < xbounds.
x) {
781 xbounds.
x = vertex.x;
783 if (vertex.x > xbounds.
y) {
784 xbounds.
y = vertex.x;
786 if (vertex.y < ybounds.
x) {
787 ybounds.
x = vertex.y;
789 if (vertex.y > ybounds.
y) {
790 ybounds.
y = vertex.y;
792 if (vertex.z < zbounds.
x) {
793 zbounds.
x = vertex.z;
795 if (vertex.z > zbounds.
y) {
796 zbounds.
y = vertex.z;
807 radius = {0.5f * (xbounds.
y - xbounds.
x), 0.5f * (ybounds.
y - ybounds.
x), 0.5f * (zbounds.
y - zbounds.
x)};
809 center = {xbounds.
x + radius.
x, ybounds.
x + radius.
y, zbounds.
x + radius.
z};
813 std::uniform_int_distribution<size_t> dist(1, (std::numeric_limits<size_t>::max)());
815 while (UUID == 0 || UUID_map.find(UUID) != UUID_map.end()) {
816 UUID = dist(random_generator);
823 assert(UUID_map.find(UUID) != UUID_map.end());
825 return UUID_map.at(UUID);
828void GeometryHandler::defragmentBuffers() {
831 if (deleted_primitive_count == 0) {
837 for (
const auto &geometry_type: all_geometry_types) {
838 if (vertex_data.find(geometry_type) == vertex_data.end()) {
842 auto &oldFace = face_index_data.at(geometry_type);
843 auto &oldVertex = vertex_data.at(geometry_type);
844 auto &oldNormal = normal_data.at(geometry_type);
845 auto &oldUV = uv_data.at(geometry_type);
846 auto &oldColor = color_data.at(geometry_type);
847 auto &oldTexFlag = texture_flag_data.at(geometry_type);
848 auto &oldTexID = texture_ID_data.at(geometry_type);
849 auto &oldCoordFlag = coordinate_flag_data.at(geometry_type);
850 auto &oldVisible = visible_flag_data.at(geometry_type);
851 auto &oldContextFlag = context_geometry_flag_data.at(geometry_type);
852 auto &oldSkyFlag = sky_geometry_flag_data.at(geometry_type);
853 auto &oldDeleteFlag = delete_flag_data.at(geometry_type);
854 auto &oldSize = size_data.at(geometry_type);
857 std::vector<VisualizerGeometryType> newType;
858 std::vector<float> newVertex, newNormal, newUV, newColor, newSize;
859 std::vector<int> newFace, newTexFlag, newTexID, newCoordFlag;
860 std::vector<bool> newDeleteFlag, newContextFlag;
861 std::vector<char> newVisible, newSkyFlag;
864 std::vector<size_t> toErase;
867 for (
auto &[UUID, prim]: UUID_map) {
868 if (prim.geometry_type != geometry_type) {
873 if (oldDeleteFlag[prim.delete_flag_index]) {
874 toErase.push_back(UUID);
880 const size_t v3 =
static_cast<size_t>(vcount) * 3;
881 const size_t v2 =
static_cast<size_t>(vcount) * 2;
884 const size_t fi = newFace.size();
885 const size_t vi = newVertex.size();
886 const size_t ni = newNormal.size();
887 const size_t ui = newUV.size();
888 const size_t ci = newColor.size();
889 const size_t tfi = newTexFlag.size();
890 const size_t tidi = newTexID.size();
891 const size_t cfi = newCoordFlag.size();
892 const size_t vi2 = newVisible.size();
893 const size_t cfi2 = newContextFlag.size();
894 const size_t sfi = newSkyFlag.size();
895 const size_t dfi = newDeleteFlag.size();
896 const size_t si = newSize.size();
899 newFace.insert(newFace.end(), vcount, scast<int>(newVisible.size()));
901 newVertex.insert(newVertex.end(), oldVertex.begin() + prim.vertex_index, oldVertex.begin() + prim.vertex_index + v3);
903 newNormal.insert(newNormal.end(), oldNormal.begin() + prim.normal_index, oldNormal.begin() + prim.normal_index + 3);
905 newUV.insert(newUV.end(), oldUV.begin() + prim.uv_index, oldUV.begin() + prim.uv_index + v2);
907 newColor.insert(newColor.end(), oldColor.begin() + prim.color_index, oldColor.begin() + prim.color_index + 4);
909 newTexFlag.push_back(oldTexFlag[prim.texture_flag_index]);
910 newTexID.push_back(oldTexID[prim.texture_ID_index]);
911 newCoordFlag.push_back(oldCoordFlag[prim.coordinate_flag_index]);
912 newVisible.push_back(oldVisible[prim.visible_index]);
913 newContextFlag.push_back(oldContextFlag[prim.context_geometry_flag_index]);
914 newSkyFlag.push_back(oldSkyFlag[prim.sky_geometry_flag_index]);
915 newDeleteFlag.push_back(oldDeleteFlag[prim.delete_flag_index]);
916 newSize.push_back(oldSize[prim.size_index]);
919 prim.face_index_index = fi;
920 prim.vertex_index = vi;
921 prim.normal_index = ni;
923 prim.color_index = ci;
924 prim.texture_flag_index = tfi;
925 prim.texture_ID_index = tidi;
926 prim.coordinate_flag_index = cfi;
927 prim.visible_index = vi2;
928 prim.context_geometry_flag_index = cfi2;
929 prim.sky_geometry_flag_index = sfi;
930 prim.delete_flag_index = dfi;
931 prim.size_index = si;
935 for (
auto UUID: toErase) {
936 UUID_map.erase(UUID);
940 oldFace.swap(newFace);
941 oldVertex.swap(newVertex);
942 oldNormal.swap(newNormal);
944 oldColor.swap(newColor);
945 oldTexFlag.swap(newTexFlag);
946 oldTexID.swap(newTexID);
947 oldCoordFlag.swap(newCoordFlag);
948 oldVisible.swap(newVisible);
949 oldContextFlag.swap(newContextFlag);
950 oldSkyFlag.swap(newSkyFlag);
951 oldDeleteFlag.swap(newDeleteFlag);
952 oldSize.swap(newSize);
956 deleted_primitive_count = 0;
959void GeometryHandler::registerUUID(
size_t UUID,
const VisualizerGeometryType &geometry_type) {
961 UUID_map[UUID] = {geometry_type,
962 face_index_data.at(geometry_type).size(),
963 vertex_data.at(geometry_type).size(),
964 normal_data.at(geometry_type).size(),
965 uv_data.at(geometry_type).size(),
966 color_data.at(geometry_type).size(),
967 texture_flag_data.at(geometry_type).size(),
968 texture_ID_data.at(geometry_type).size(),
969 coordinate_flag_data.at(geometry_type).size(),
970 visible_flag_data.at(geometry_type).size(),
971 context_geometry_flag_data.at(geometry_type).size(),
972 sky_geometry_flag_data.at(geometry_type).size(),
973 delete_flag_data.at(geometry_type).size(),
974 size_data.at(geometry_type).size()};
979 switch (geometry_type) {
980 case GEOMETRY_TYPE_RECTANGLE:
982 case GEOMETRY_TYPE_TRIANGLE:
984 case GEOMETRY_TYPE_POINT:
986 case GEOMETRY_TYPE_LINE:
995 dirty_UUIDs.insert(UUID);
1003 dirty_UUIDs.clear();