26 : m_enable_lighting(false),
27 m_enable_cube_transparency(true),
28 m_showVoxelsAsPoints(false),
29 m_showVoxelsAsPointsSize(3.0f),
32 m_grid_color(0xE0, 0xE0, 0xE0, 0x90),
53 #if MRPT_HAS_OPENGL_GLUT
68 const GLubyte grid_line_indices[] = {0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6,
69 6, 7, 7, 4, 0, 5, 1, 6, 2, 7, 3, 4};
71 const GLubyte cube_indices[36] = {0, 1, 2, 2, 3, 0, 0, 3, 4, 4, 5, 0,
72 0, 5, 6, 6, 1, 0, 1, 6, 7, 7, 2, 1,
73 7, 4, 3, 3, 2, 7, 4, 7, 6, 6, 5, 4};
76 const GLfloat normals_cube[3 * 6 * 4] = {
77 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
78 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
79 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
80 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0,
81 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1,
82 -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0};
91 #if MRPT_HAS_OPENGL_GLUT
106 if (m_grid_color.A != 255)
113 m_grid_color.R, m_grid_color.G, m_grid_color.B, m_grid_color.A);
115 const size_t nGrids = m_grid_cubes.size();
116 for (
size_t i = 0; i < nGrids; i++)
121 c.
max.
x,
c.max.y,
c.max.z,
c.max.x,
c.min.y,
c.max.z,
122 c.max.x,
c.min.y,
c.min.z,
c.max.x,
c.max.y,
c.min.z,
123 c.min.x,
c.max.y,
c.min.z,
c.min.x,
c.max.y,
c.max.z,
124 c.min.x,
c.min.y,
c.max.z,
c.min.x,
c.min.y,
c.min.z};
128 sizeof(grid_line_indices) /
sizeof(grid_line_indices[0]),
144 if (m_enable_cube_transparency)
150 if (m_showVoxelsAsPoints)
156 for (
size_t i = 0; i < m_voxel_sets.size(); i++)
158 if (!m_voxel_sets[i].visible)
continue;
160 const std::vector<TVoxel>& voxels = m_voxel_sets[i].voxels;
161 const size_t N = voxels.size();
162 for (
size_t j = 0; j < N; j++)
168 const double L = voxels[j].side_length * 0.5;
170 if (!m_showVoxelsAsPoints)
174 c.x + L,
c.y + L,
c.z + L,
c.x + L,
c.y - L,
c.z + L,
175 c.x + L,
c.y - L,
c.z - L,
c.x + L,
c.y + L,
c.z - L,
176 c.x - L,
c.y + L,
c.z - L,
c.x - L,
c.y + L,
c.z + L,
177 c.x - L,
c.y - L,
c.z + L,
c.x - L,
c.y - L,
c.z - L};
181 sizeof(cube_indices) /
sizeof(cube_indices[0]),
192 if (m_showVoxelsAsPoints)
220 out <<
a.visible <<
a.voxels;
225 in >>
a.visible >>
a.voxels;
231 out <<
a.min <<
a.max;
236 in >>
a.min >>
a.max;
242 out <<
a.coords <<
a.side_length <<
a.color;
247 in >>
a.coords >>
a.side_length >>
a.color;
256 writeToStreamRender(out);
258 out << m_voxel_sets << m_grid_cubes << m_bb_min << m_bb_max
259 << m_enable_lighting << m_showVoxelsAsPoints << m_showVoxelsAsPointsSize
260 << m_show_grids << m_grid_width << m_grid_color
261 << m_enable_cube_transparency
273 readFromStreamRender(
in);
275 in >> m_voxel_sets >> m_grid_cubes >> m_bb_min >> m_bb_max >>
276 m_enable_lighting >> m_showVoxelsAsPoints >>
277 m_showVoxelsAsPointsSize >> m_show_grids >> m_grid_width >>
281 in >> m_enable_cube_transparency;
283 m_enable_cube_transparency =
false;
310 m_pose.composePoint(bb_min, bb_min);
311 m_pose.composePoint(bb_max, bb_max);
317 return a.coords.z <
b.coords.z;
322 for (
size_t i = 0; i < m_voxel_sets.size(); i++)
325 m_voxel_sets[i].voxels.begin(), m_voxel_sets[i].voxels.end(),