|
1 | 1 | #include "glwidget.h" |
2 | 2 | #include "glvehicle.h" |
| 3 | +#include "glpointcloud.h" |
3 | 4 | #include "gltriangle.h" |
4 | 5 | #include "glpoint.h" |
5 | 6 | #include "global.h" |
@@ -33,6 +34,7 @@ GLWidget::GLWidget(QWidget* parent, |
33 | 34 | , mousePos_() |
34 | 35 | , config_(config) |
35 | 36 | , lanes_() |
| 37 | + , pointcloud_(100, this, config_.srcPath_) |
36 | 38 | , pressedKeys_() |
37 | 39 | , sceneKeys_() |
38 | 40 | , msgSource_(msgSource) |
@@ -159,7 +161,7 @@ GLWidget::paintGL() |
159 | 161 | //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
160 | 162 |
|
161 | 163 | // Depth test is disabled, thus the static objects (i.e. grid) will be drawn first. |
162 | | - // Afterwards the lanes, then the vehicles etc. are drawn, the texts are the last ones. |
| 164 | + // Afterwards the lanes, then the vehicles etc. are drawn, then point clouds and the texts are the last ones. |
163 | 165 | foreach (GLObject* staticObject, staticObjects_) |
164 | 166 | { |
165 | 167 | if(staticObject->isVisible_) |
@@ -190,6 +192,10 @@ GLWidget::paintGL() |
190 | 192 | RenderObject(object); |
191 | 193 | } |
192 | 194 |
|
| 195 | + if (pointcloud_.isVisible_) { |
| 196 | + RenderObject(&pointcloud_.glPointCloud_); |
| 197 | + } |
| 198 | + |
193 | 199 | foreach (GLObject* object, simulationObjects_) |
194 | 200 | { |
195 | 201 | if (object->GetTextObject() != nullptr && object->GetTextObject()->isVisible_) |
@@ -231,7 +237,6 @@ GLWidget::RenderObject(GLObject* object) |
231 | 237 | } |
232 | 238 | shaderProgram_.setUniformValue(uniformColorLocation_, color); |
233 | 239 | } |
234 | | - |
235 | 240 | glBindVertexArray(object->vaoId_); |
236 | 241 | glDrawArrays(object->GetPrimitiveType(), 0, object->vertices_.size()); |
237 | 242 | } |
@@ -408,7 +413,8 @@ GLWidget::ResetObjectTextOrientations() |
408 | 413 |
|
409 | 414 | void |
410 | 415 | GLWidget::MessageParsed(const Message& message, |
411 | | - const LaneMessage& laneMessage) |
| 416 | + const LaneMessage& laneMessage, |
| 417 | + const PointMessage& pointMessage) |
412 | 418 | { |
413 | 419 | // The check for a connected receiver is necessary because the signals for received messages |
414 | 420 | // the receiver emits are asynchronous. It sometimes happens that after the receiver disconnected, |
@@ -594,6 +600,12 @@ GLWidget::MessageParsed(const Message& message, |
594 | 600 | } |
595 | 601 | } |
596 | 602 |
|
| 603 | + // copy point clouds |
| 604 | + if (pointMessage.size() > 0) { |
| 605 | + pointcloud_.UpdatePointCloud(pointMessage); |
| 606 | + } |
| 607 | + |
| 608 | + |
597 | 609 | // TODO: Remove ununsed objects from object tree, also stop tracking etc |
598 | 610 | // Hide unused objects |
599 | 611 | foreach (GLObject* object, objectControlList) |
|
0 commit comments