|
2 | 2 | * Automatically generated. Please verify that types *
|
3 | 3 | * used have the correct size on your platform. *
|
4 | 4 | *****************************************************/
|
| 5 | +#include "fastply/fastply_macros.h" |
| 6 | + |
5 | 7 | #include <cstdint>
|
6 | 8 | #include <cstring>
|
7 | 9 |
|
8 |
| -struct __attribute__ ((packed)) Vertex { |
9 |
| - const float x; |
10 |
| - const float y; |
11 |
| - const float z; |
12 |
| - const float nx; |
13 |
| - const float ny; |
14 |
| - const float nz; |
15 |
| - const uint8_t red; |
16 |
| - const uint8_t green; |
17 |
| - const uint8_t blue; |
| 10 | +FASTPLY_ELEMENT(Vertex, |
| 11 | + const float x; |
| 12 | + const float y; |
| 13 | + const float z; |
| 14 | + const float nx; |
| 15 | + const float ny; |
| 16 | + const float nz; |
| 17 | + const uint8_t red; |
| 18 | + const uint8_t green; |
| 19 | + const uint8_t blue; |
18 | 20 |
|
19 |
| - bool operator==(const Vertex& rhs) const { |
20 |
| - return x == rhs.x && |
21 |
| - y == rhs.y && |
22 |
| - z == rhs.z && |
23 |
| - nx == rhs.nx && |
24 |
| - ny == rhs.ny && |
25 |
| - nz == rhs.nz && |
26 |
| - red == rhs.red && |
27 |
| - green == rhs.green && |
28 |
| - blue == rhs.blue; |
29 |
| - } |
30 |
| -}; |
| 21 | + FASTPLY_GENERATE_OPERATORS(Vertex, x, y, z, nx, ny, nz, red, green, blue) |
| 22 | +) |
31 | 23 |
|
32 |
| -struct __attribute__ ((packed)) Camera { |
33 |
| - const float view_px; |
34 |
| - const float view_py; |
35 |
| - const float view_pz; |
36 |
| - const float x_axisx; |
37 |
| - const float x_axisy; |
38 |
| - const float x_axisz; |
39 |
| - const float y_axisx; |
40 |
| - const float y_axisy; |
41 |
| - const float y_axisz; |
42 |
| - const float z_axisx; |
43 |
| - const float z_axisy; |
44 |
| - const float z_axisz; |
45 |
| - const float focal; |
46 |
| - const float scalex; |
47 |
| - const float scaley; |
48 |
| - const float centerx; |
49 |
| - const float centery; |
50 |
| - const int32_t viewportx; |
51 |
| - const int32_t viewporty; |
52 |
| - const float k1; |
53 |
| - const float k2; |
| 24 | +FASTPLY_ELEMENT(Camera, |
| 25 | + const float view_px; |
| 26 | + const float view_py; |
| 27 | + const float view_pz; |
| 28 | + const float x_axisx; |
| 29 | + const float x_axisy; |
| 30 | + const float x_axisz; |
| 31 | + const float y_axisx; |
| 32 | + const float y_axisy; |
| 33 | + const float y_axisz; |
| 34 | + const float z_axisx; |
| 35 | + const float z_axisy; |
| 36 | + const float z_axisz; |
| 37 | + const float focal; |
| 38 | + const float scalex; |
| 39 | + const float scaley; |
| 40 | + const float centerx; |
| 41 | + const float centery; |
| 42 | + const int32_t viewportx; |
| 43 | + const int32_t viewporty; |
| 44 | + const float k1; |
| 45 | + const float k2; |
54 | 46 |
|
55 |
| - bool operator==(const Camera& rhs) const { |
56 |
| - return view_px == rhs.view_px && |
57 |
| - view_py == rhs.view_py && |
58 |
| - view_pz == rhs.view_pz && |
59 |
| - x_axisx == rhs.x_axisx && |
60 |
| - x_axisy == rhs.x_axisy && |
61 |
| - x_axisz == rhs.x_axisz && |
62 |
| - y_axisx == rhs.y_axisx && |
63 |
| - y_axisy == rhs.y_axisy && |
64 |
| - y_axisz == rhs.y_axisz && |
65 |
| - z_axisx == rhs.z_axisx && |
66 |
| - z_axisy == rhs.z_axisy && |
67 |
| - z_axisz == rhs.z_axisz && |
68 |
| - focal == rhs.focal && |
69 |
| - scalex == rhs.scalex && |
70 |
| - scaley == rhs.scaley && |
71 |
| - centerx == rhs.centerx && |
72 |
| - centery == rhs.centery && |
73 |
| - viewportx == rhs.viewportx && |
74 |
| - viewporty == rhs.viewporty && |
75 |
| - k1 == rhs.k1 && |
76 |
| - k2 == rhs.k2; |
77 |
| - } |
78 |
| -}; |
| 47 | + FASTPLY_GENERATE_OPERATORS(Camera, view_px, view_py, view_pz, x_axisx, x_axisy, x_axisz, y_axisx, y_axisy, y_axisz, z_axisx, z_axisy, z_axisz, focal, scalex, scaley, centerx, centery) |
| 48 | +) |
79 | 49 |
|
80 |
| -struct __attribute__ ((packed)) Alltypes { |
81 |
| - const int8_t c; |
82 |
| - const uint8_t uc; |
83 |
| - const int16_t s; |
84 |
| - const uint16_t us; |
85 |
| - const int32_t i; |
86 |
| - const uint32_t ui; |
87 |
| - const float f; |
88 |
| - const double d; |
| 50 | +FASTPLY_ELEMENT(Alltypes, |
| 51 | + const int8_t c; |
| 52 | + const uint8_t uc; |
| 53 | + const int16_t s; |
| 54 | + const uint16_t us; |
| 55 | + const int32_t i; |
| 56 | + const uint32_t ui; |
| 57 | + const float f; |
| 58 | + const double d; |
89 | 59 |
|
90 |
| - bool operator==(const Alltypes& rhs) const { |
91 |
| - return c == rhs.c && |
92 |
| - uc == rhs.uc && |
93 |
| - s == rhs.s && |
94 |
| - us == rhs.us && |
95 |
| - i == rhs.i && |
96 |
| - ui == rhs.ui && |
97 |
| - f == rhs.f && |
98 |
| - d == rhs.d; |
99 |
| - } |
100 |
| -}; |
| 60 | + FASTPLY_GENERATE_OPERATORS(Alltypes, c, uc, s, us, i, ui, f, d) |
| 61 | +) |
101 | 62 |
|
102 |
| -struct __attribute__ ((packed)) Face { |
| 63 | +FASTPLY_ELEMENT(Face, |
103 | 64 | const uint8_t vertex_index_length = 4;
|
104 | 65 | const int32_t vertex_index[4];
|
105 | 66 |
|
106 |
| - bool operator==(const Face& rhs) const { |
107 |
| - return !std::memcmp(&vertex_index, &rhs.vertex_index, sizeof(int32_t)*4); |
108 |
| - } |
109 |
| -}; |
| 67 | + FASTPLY_GENERATE_OPERATORS(Face, vertex_index[0], vertex_index[1], vertex_index[2], vertex_index[3]) |
| 68 | +) |
110 | 69 |
|
0 commit comments