class mrpt::opengl::PointsProxy
Overview
GPU-side proxy for rendering point clouds.
This proxy handles rendering of any CVisualObject that uses the POINTS shader, such as:
CPointCloud
CPointCloudColoured
Any object derived from VisualObjectParams_Points
The proxy manages:
Vertex buffer (3D positions)
Color buffer (per-vertex RGBA colors)
Point rendering parameters (size, variable sizing)
VAO for efficient attribute binding
Point rendering features:
Fixed point size or variable (distance-based) point size
Per-vertex colors
Alpha blending for transparency
Typical data flow:
compile() : Upload initial point positions and colors to GPU
updateBuffers() : Re-upload when points change
render() : Draw points every frame
See also:
PointsProxyBase, mrpt::viz::VisualObjectParams_Points
#include <mrpt/opengl/PointsProxy.h> class PointsProxy: public mrpt::opengl::PointsProxyBase { public: // structs struct PointParams; // construction PointsProxy(); // methods virtual void compile(const mrpt::viz::CVisualObject* sourceObj); virtual void updateBuffers(const mrpt::viz::CVisualObject* sourceObj); virtual void render(const RenderContext& rc) const; virtual const char* typeName() const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<RenderableProxy> Ptr; // fields mrpt::math::CMatrixFloat44 m_modelMatrix = mrpt::math::CMatrixFloat44::Identity(); bool m_visible = true; bool m_castShadows = true; uint64_t m_changeCount = 0; mrpt::math::TPoint3Df m_sortPointLocal {0, 0, 0}; // methods virtual void compile(const mrpt::viz::CVisualObject* sourceObj) = 0; virtual void updateBuffers(const mrpt::viz::CVisualObject* sourceObj); virtual void render(const RenderContext& rc) const = 0; virtual std::vector<shader_id_t> requiredShaders() const = 0; virtual bool castsShadows() const; virtual bool isTransparent() const; virtual bool isBackground() const; virtual shader_id_t shadowMapShader() const; virtual bool cullEligible() const; const std::optional<mrpt::math::TBoundingBoxf>& localBoundingBox() const; virtual const char* typeName() const; void setSourceObject(std::weak_ptr<const mrpt::viz::CVisualObject> obj); void setResourceScope(const void* scope); std::shared_ptr<const mrpt::viz::CVisualObject> getSourceObject() const; bool isSourceValid() const; bool sourceNeedsUpdate() const; RenderableProxy& operator = (const RenderableProxy&); RenderableProxy& operator = (RenderableProxy&&); virtual void compile(const mrpt::viz::CVisualObject* sourceObj); virtual void updateBuffers(const mrpt::viz::CVisualObject* sourceObj); virtual void render(const RenderContext& rc) const; virtual std::vector<shader_id_t> requiredShaders() const; virtual bool castsShadows() const; virtual const char* typeName() const;
Methods
virtual void compile(const mrpt::viz::CVisualObject* sourceObj)
Initial compilation: uploads object data to GPU.
This is called once when the proxy is first created. It should:
Create OpenGL buffers (VBOs, VAOs, textures)
Upload initial vertex/color/normal/texture data
Cache any frequently-used values
Must be called from OpenGL context thread
After this call, the proxy should be ready to render
Parameters:
sourceObj |
The abstract viz object (read-only access) |
virtual void updateBuffers(const mrpt::viz::CVisualObject* sourceObj)
Incremental update: refreshes GPU buffers with changed data.
This is called when the data version of the source object changes (mrpt::viz::CVisualObject::dataVersion()). It should:
Re-upload only the changed data (vertices, colors, etc.)
Be as efficient as possible (don’t recompile everything)
Must be called from OpenGL context thread
Default implementation calls compile() - override for efficiency
Parameters:
sourceObj |
The abstract viz object (read-only access) |
virtual void render(const RenderContext& rc) const
Renders this object using the provided context.
This is called every frame for visible objects. It should:
Bind appropriate buffers (VAO, VBO, textures)
Set shader uniforms (model matrix, material properties, etc.)
Issue draw calls (glDrawArrays, glDrawElements, etc.)
Must be called from OpenGL context thread
The shader program is already bound when this is called
Common matrices (P, V, M) are already uploaded by CompiledViewport
Parameters:
rc |
Rendering context (shader, matrices, lights) |
virtual const char* typeName() const
Returns a human-readable type name for this proxy.
Used for debugging and logging.