src
liblvr2
display
InteractivePointCloud.cpp
Go to the documentation of this file.
1
28
/*
29
* InteractivePointCloud.cpp
30
*
31
* Created on: 02.04.2012
32
* Author: Thomas Wiemann
33
*/
34
35
#include "
lvr2/display/InteractivePointCloud.hpp
"
36
37
namespace
lvr2
38
{
39
40
InteractivePointCloud::InteractivePointCloud
()
41
{
42
m_boundingBox
=
new
BoundingBox<Vec>
(
43
Vec
(-8, -8, -8),
44
Vec
(8, 8, 8)
45
);
46
47
updateBuffer
(
PointBufferPtr
());
48
}
49
50
InteractivePointCloud::InteractivePointCloud
(
PointBufferPtr
buffer)
51
{
52
m_boundingBox
=
new
BoundingBox<Vec>
(
53
Vec
(-8, -8, -8),
54
Vec
(8, 8, 8)
55
);
56
57
updateBuffer
(buffer);
58
}
59
60
61
InteractivePointCloud::~InteractivePointCloud
()
62
{
63
64
}
65
66
void
InteractivePointCloud::render
()
67
{
68
if
(
m_buffer
)
69
{
70
glColor3f(1.0, 0.0, 0.0);
71
glDrawArrays(GL_POINTS, 0,
m_buffer
->numPoints());
72
}
73
}
74
75
void
InteractivePointCloud::updateBuffer
(
PointBufferPtr
buffer)
76
{
77
if
(buffer)
78
{
79
if
(!
m_boundingBox
)
80
{
81
m_boundingBox
=
new
BoundingBox<Vec>
;
82
m_boundingBox
->expand(
Vec
(8000, 8000, 8000));
83
}
84
85
size_t
num_vertices = buffer->numPoints();
86
float
* vertices = buffer->getPointArray().get();
87
88
// m_boundingBox = new BoundingBox<Vertex<float> >;
89
// for (int i = 0; i < int(num_vertices); i++)
90
// {
91
// int index = 3 * i;
92
// m_boundingBox->expand(vertices[index], vertices[index + 1], vertices[index + 2]);
93
// }
94
95
glVertexPointer(3, GL_FLOAT, 0, vertices);
96
m_buffer
= buffer;
97
}
98
}
99
100
}
/* namespace lvr2 */
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition:
PointBuffer.hpp:130
lvr2::Renderable::m_boundingBox
BoundingBox< Vec > * m_boundingBox
Definition:
Renderable.hpp:165
lvr2::InteractivePointCloud::InteractivePointCloud
InteractivePointCloud()
Definition:
InteractivePointCloud.cpp:40
lvr2::InteractivePointCloud::render
virtual void render()
Definition:
InteractivePointCloud.cpp:66
lvr2::InteractivePointCloud::updateBuffer
void updateBuffer(PointBufferPtr buffer)
Definition:
InteractivePointCloud.cpp:75
lvr2::BoundingBox
A dynamic bounding box class.
Definition:
BoundingBox.hpp:49
lvr2::Renderable::Vec
BaseVector< float > Vec
Definition:
Renderable.hpp:69
lvr2
Definition:
BaseBufferManipulators.hpp:39
InteractivePointCloud.hpp
lvr2::InteractivePointCloud::~InteractivePointCloud
virtual ~InteractivePointCloud()
Definition:
InteractivePointCloud.cpp:61
lvr2::InteractivePointCloud::m_buffer
PointBufferPtr m_buffer
Definition:
InteractivePointCloud.hpp:59
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz
, Alexander Mock
, Lars Kiesow
, Lukas Kalbertodt
, Tristan Igelbrink
, Johan M. von Behren
, Dominik Feldschnieders
, Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23