-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodeluploader.cpp
More file actions
38 lines (29 loc) · 1004 Bytes
/
Copy pathmodeluploader.cpp
File metadata and controls
38 lines (29 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "modeluploader.h"
ModelUploader::ModelUploader(std::shared_ptr<BaseUploaderImp> imp) : BaseUploader(imp)
{
}
std::shared_ptr<VertixModel> ModelUploader::load_model(std::shared_ptr<PolygonModelBuilder> builder)
{
builder->build_model();
size_t cnt = _imp->read_uint();
for (size_t i = 0; i < cnt; ++i) {
double x, y, z;
x = _imp->read_double();
y = _imp->read_double();
z = _imp->read_double();
builder->build_vert(x, y, z);
}
cnt = _imp->read_uint();
for (size_t i = 0; i < cnt; ++i) {
size_t first, second, third, red, green, blue, flag;
first = _imp->read_uint();
second = _imp->read_uint();
third = _imp->read_uint();
red = _imp->read_uint();
green = _imp->read_uint();
blue = _imp->read_uint();
flag = _imp->read_uint();
builder->build_polygon(first, second, third, QColor(red, green, blue), (bool)flag);
}
return builder->get_model();
}