raisin::PointCloud
class · #include <rayrai/PointCloud.hpp>
Simple point cloud renderer.
Stores positions and colors on the CPU; nothing reaches the GPU until one of the update methods is called. GL buffers are created lazily on the first upload and released in the destructor, so construction needs no GL context but every update/draw call and the destructor (once uploaded) do.
Constructors & destructor
PointCloud
PointCloud()Construct an empty point cloud.
~PointCloud
~PointCloud()Destroy the point cloud and release GPU resources.
Public member functions
setCategory
void setCategory(VisualCategory category)Set the render category used by capture/detection filters.
Point clouds are visible in the normal interactive viewer regardless of this category. External-camera and generated-capture passes can request only detectable point clouds, in which case clouds left as VisualCategory::NotDetectable are skipped. This lets debug lidar traces, helper samples, and temporary overlays remain visible to a human operator without appearing in external-camera or generated capture images.
This is render metadata only; it does not create collision, physics behavior, or semantic labels. New PointCloud instances default to VisualCategory::NotDetectable.
Parameters
| Parameter | Description |
|---|---|
category | New render category. |
See also VisualCategory
setDetectable
void setDetectable(bool detectable)Convenience helper for toggling the point cloud render category.
Parameters
| Parameter | Description |
|---|---|
detectable | True to include this cloud in detectable-only capture/detection render passes; false to keep it viewer-only for those passes. |
getCategory
VisualCategory getCategory() constGet the render category used by capture/detection filters.
Returns Current point cloud category.
isDetectable
bool isDetectable() constCheck whether detectable-only render passes include this point cloud.
Returns True when the category is VisualCategory::Detectable.
enabled
bool enabled() constReturns True when rendering is enabled.
renderRevision
uint64_t renderRevision() constInternal:
Returns Counter bumped on every render-affecting change, used by the renderer to invalidate cached frames.
updatePointBuffer
void updatePointBuffer()Upload positions and colors to the GPU (or free the buffers if empty).
Also recomputes the bounding sphere. Does nothing (and logs an error) when colors.size() != positions.size().
updatePointPositionsBuffer
void updatePointPositionsBuffer()Streaming variant for point clouds whose colors stay unchanged. Updates bounds + position VBO only and reuses the initialized color buffer.
updatePointRange
void updatePointRange(size_t begin, size_t count)Upload a changed point range of positions and colors in place.
No-op unless the buffers were already uploaded with matching sizes; the range is clamped to the uploaded capacity. Bounds are not recomputed, so call updatePointBuffer() if points moved outside the previous bounds.
Parameters
| Parameter | Description |
|---|---|
begin | Index of the first changed point. |
count | Number of changed points. |
draw
void draw(Camera &camera, Shader &shader)Draw the point cloud.
Parameters
| Parameter | Description |
|---|---|
camera | Active camera (unused but kept for consistency). |
shader | Shader to use for drawing; must already be in use (only the pointSize uniform is set here). |
approximateBounds
bool approximateBounds(glm::vec3 ¢er, float &radius) constBounding sphere (centroid + max distance) of the last uploaded positions.
Parameters
| Parameter | Description |
|---|---|
center (out) | Sphere center in world coordinates. |
radius (out) | Sphere radius. |
Returns False (outputs untouched) when positions is empty.
setMaxRenderedPoints
void setMaxRenderedPoints(size_t maxPoints)Cap drawn points for simple single-threaded LOD.
Parameters
| Parameter | Description |
|---|---|
maxPoints | Maximum number of points drawn per frame; 0 draws all. |
maxRenderedPoints
size_t maxRenderedPoints() constReturns Point cap set by setMaxRenderedPoints() (0 = unlimited).
setRenderedPointStride
void setRenderedPointStride(size_t stride)Draw every Nth point for cheap point-cloud LOD.
Parameters
| Parameter | Description |
|---|---|
stride | Point stride; 0 is treated as 1 (draw contiguous points). |
renderedPointStride
size_t renderedPointStride() constReturns Current point stride (>= 1).
enable
void enable(bool enable)Enable or disable rendering.
Parameters
| Parameter | Description |
|---|---|
enable | True to enable. |
notifyDataChanged
void notifyDataChanged()Bump the render revision after a direct mutation of positions or colors.
setCategory(), enable(), setMaxRenderedPoints() already bump the revision themselves; this method is for the public positions / colors vectors, which the setter pattern does not cover.
Public attributes
positions
std::vector<glm::vec3> positionsPoint positions in world space.
colors
std::vector<glm::vec4> colorsPer-point colors (must match positions size).
RGB in [0, 1]. The built-in point shader draws opaque round points and ignores alpha; a black (zero) color falls back to the shader's uPointColor uniform.
pointSize
float pointSizeRendered point size in pixels; values <= 0 render at 2 px.