Skip to content

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 ​

cpp
PointCloud()

Construct an empty point cloud.

~PointCloud ​

cpp
~PointCloud()

Destroy the point cloud and release GPU resources.

Public member functions ​

setCategory ​

cpp
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

ParameterDescription
categoryNew render category.

See also VisualCategory

setDetectable ​

cpp
void setDetectable(bool detectable)

Convenience helper for toggling the point cloud render category.

Parameters

ParameterDescription
detectableTrue to include this cloud in detectable-only capture/detection render passes; false to keep it viewer-only for those passes.

getCategory ​

cpp
VisualCategory getCategory() const

Get the render category used by capture/detection filters.

Returns Current point cloud category.

isDetectable ​

cpp
bool isDetectable() const

Check whether detectable-only render passes include this point cloud.

Returns True when the category is VisualCategory::Detectable.

enabled ​

cpp
bool enabled() const

Returns True when rendering is enabled.

renderRevision ​

cpp
uint64_t renderRevision() const

Internal:

Returns Counter bumped on every render-affecting change, used by the renderer to invalidate cached frames.

updatePointBuffer ​

cpp
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 ​

cpp
void updatePointPositionsBuffer()

Streaming variant for point clouds whose colors stay unchanged. Updates bounds + position VBO only and reuses the initialized color buffer.

updatePointRange ​

cpp
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

ParameterDescription
beginIndex of the first changed point.
countNumber of changed points.

draw ​

cpp
void draw(Camera &camera, Shader &shader)

Draw the point cloud.

Parameters

ParameterDescription
cameraActive camera (unused but kept for consistency).
shaderShader to use for drawing; must already be in use (only the pointSize uniform is set here).

approximateBounds ​

cpp
bool approximateBounds(glm::vec3 &center, float &radius) const

Bounding sphere (centroid + max distance) of the last uploaded positions.

Parameters

ParameterDescription
center (out)Sphere center in world coordinates.
radius (out)Sphere radius.

Returns False (outputs untouched) when positions is empty.

setMaxRenderedPoints ​

cpp
void setMaxRenderedPoints(size_t maxPoints)

Cap drawn points for simple single-threaded LOD.

Parameters

ParameterDescription
maxPointsMaximum number of points drawn per frame; 0 draws all.

maxRenderedPoints ​

cpp
size_t maxRenderedPoints() const

Returns Point cap set by setMaxRenderedPoints() (0 = unlimited).

setRenderedPointStride ​

cpp
void setRenderedPointStride(size_t stride)

Draw every Nth point for cheap point-cloud LOD.

Parameters

ParameterDescription
stridePoint stride; 0 is treated as 1 (draw contiguous points).

renderedPointStride ​

cpp
size_t renderedPointStride() const

Returns Current point stride (>= 1).

enable ​

cpp
void enable(bool enable)

Enable or disable rendering.

Parameters

ParameterDescription
enableTrue to enable.

notifyDataChanged ​

cpp
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 ​

cpp
std::vector<glm::vec3> positions

Point positions in world space.

colors ​

cpp
std::vector<glm::vec4> colors

Per-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 ​

cpp
float pointSize

Rendered point size in pixels; values <= 0 render at 2 px.

RaiSim — physics for robotics and AI.