Skip to content

Commit

Permalink
Fixed low FPS when sending point markers (ros-visualization#1049) (ro…
Browse files Browse the repository at this point in the history
…s-visualization#1055)

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 0f6b3ad9c78c97d702f8f52b31e7cb46a64b8d35)

Co-authored-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
mergify[bot] and ahcorde authored Sep 6, 2023
1 parent 2391b3a commit 16a0d8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rviz_rendering/src/rviz_rendering/objects/point_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ PointCloud::addPointToHardwareBuffer(
float y = point->position.y;
float z = point->position.z;

auto num_vertices = internals.rend->getBuffer()->getNumVertices();
auto vertex_size =
internals.rend->getRenderOperation()->vertexData->vertexDeclaration->getVertexSize(0);

for (uint32_t j = 0; j < getVerticesPerPoint(); ++j, ++internals.current_vertex_count) {
*float_buffer++ = x;
*float_buffer++ = y;
Expand All @@ -602,9 +606,7 @@ PointCloud::addPointToHardwareBuffer(

assert(
reinterpret_cast<uint8_t *>(float_buffer) <=
reinterpret_cast<uint8_t *>(float_buffer) +
internals.rend->getBuffer()->getNumVertices() *
internals.rend->getRenderOperation()->vertexData->vertexDeclaration->getVertexSize(0));
reinterpret_cast<uint8_t *>(float_buffer) + num_vertices * vertex_size);
}
internals.float_buffer = float_buffer;
return internals;
Expand Down

0 comments on commit 16a0d8c

Please sign in to comment.