Easy3D 2.6.1
Loading...
Searching...
No Matches
PointsDrawable Class Reference

The drawable for rendering a set of points, e.g., point clouds, vertices of a mesh. More...

#include <easy3d/renderer/drawable_points.h>

Inheritance diagram for PointsDrawable:
Drawable State

Public Types

enum  ImposterType { PLAIN , SPHERE , SURFEL }
 The type of the point imposter. More...
 
- Public Types inherited from Drawable
enum  Type { DT_POINTS = 0x0000 , DT_LINES = 0x0001 , DT_TRIANGLES = 0x0004 }
 The type of the drawable. More...
 
- Public Types inherited from State
enum  Method { UNIFORM_COLOR , COLOR_PROPERTY , SCALAR_FIELD , TEXTURED }
 Available coloring methods. More...
 
enum  Location { VERTEX , FACE , EDGE , HALFEDGE }
 The location of a coloring property. More...
 

Public Member Functions

 PointsDrawable (const std::string &name="", Model *model=nullptr)
 Constructor that initializes the drawable with a name and an optional model.
 
Type type () const override
 Returns the type of the drawable.
 
ImposterType impostor_type () const
 Returns the type of the point imposter.
 
void set_impostor_type (ImposterType t)
 Sets the type of the point imposter.
 
float point_size () const
 Returns the size of the points.
 
void set_point_size (float s)
 Sets the size of the points.
 
void draw (const Camera *camera) const override
 Draws the drawable.
 
- Public Member Functions inherited from Drawable
 Drawable (const std::string &name="unknown", Model *model=nullptr)
 Constructor that initializes the drawable with a name and an optional model.
 
 ~Drawable () override
 Destructor.
 
const std::string & name () const
 Returns the name of the drawable.
 
void set_name (const std::string &n)
 Sets the name of the drawable.
 
Model * model ()
 Returns the model to which the drawable is attached.
 
const Model * model () const
 Returns the model to which the drawable is attached (const version).
 
void set_model (Model *m)
 Sets the model to which the drawable is attached.
 
const Box3 & bounding_box () const
 Returns the bounding box of the drawable.
 
State & state ()
 Returns the state of the drawable.
 
const State & state () const
 Returns the state of the drawable (const version).
 
void set_state (const State &s)
 Sets the state of the drawable.
 
void buffer_stats (std::ostream &output) const
 Prints statistics of the buffers to an output stream.
 
std::size_t num_vertices () const
 Returns the number of vertices.
 
VertexArrayObject * vao ()
 Returns the vertex array object of this drawable.
 
const VertexArrayObject * vao () const
 Returns the vertex array object of this drawable (const version).
 
unsigned int vertex_buffer () const
 Returns the vertex buffer ID.
 
unsigned int color_buffer () const
 Returns the color buffer ID.
 
unsigned int normal_buffer () const
 Returns the normal buffer ID.
 
unsigned int texcoord_buffer () const
 Returns the texture coordinate buffer ID.
 
unsigned int element_buffer () const
 Returns the element buffer ID.
 
void update_vertex_buffer (const std::vector< vec3 > &vertices, bool dynamic=false)
 Creates/Updates the vertex buffer.
 
void update_color_buffer (const std::vector< vec3 > &colors, bool dynamic=false)
 Creates/Updates the color buffer.
 
void update_normal_buffer (const std::vector< vec3 > &normals, bool dynamic=false)
 Updates the normal buffer.
 
void update_texcoord_buffer (const std::vector< vec2 > &texcoords, bool dynamic=false)
 Updates the texture coordinate buffer.
 
void update_element_buffer (const std::vector< unsigned int > &elements)
 Updates the element buffer.
 
void update_element_buffer (const std::vector< std::vector< unsigned int > > &elements)
 Updates the element buffer.
 
void disable_element_buffer ()
 Disables the use of the element buffer.
 
void gl_draw () const
 Draws the drawable using OpenGL.
 
void update ()
 Requests an update of the OpenGL buffers.
 
void set_update_func (const std::function< void(Model *, Drawable *)> &func)
 Sets the update function for the drawable.
 
Manipulator * manipulator ()
 Returns the manipulator attached to this drawable.
 
const Manipulator * manipulator () const
 Returns the manipulator attached to this drawable (const version).
 
void set_manipulator (std::shared_ptr< Manipulator > manip)
 Attaches a manipulator to this drawable.
 
mat4 manipulated_matrix () const
 Returns the manipulation matrix.
 
- Public Member Functions inherited from State
 State ()
 Default constructor.
 
 State (const State &s)
 Copy constructor.
 
State & operator= (const State &rhs)
 Assignment operator.
 
virtual ~State ()=default
 Virtual destructor.
 
bool is_visible () const
 Checks if the drawable is visible.
 
void set_visible (bool v)
 Sets the visibility of the drawable.
 
bool is_selected () const
 Checks if the drawable is selected.
 
void set_selected (bool b)
 Sets the selection state of the drawable.
 
void set_uniform_coloring (const vec4 &color)
 Constructs a uniform coloring scheme.
 
void set_property_coloring (Location color_location, const std::string &color_name="")
 Constructs a scheme for rendering a drawable with per-element color.
 
void set_texture_coloring (Location texcoord_location, const std::string &texcoord_name, const Texture *texture=nullptr, float repeat=1.0f, float repeat_fraction=0.0f)
 Constructs a scheme for textured rendering.
 
void set_scalar_coloring (Location scalar_location, const std::string &scalar_name, const Texture *texture=nullptr, float clamp_lower=0.05f, float clamp_upper=0.05f)
 Constructs a scheme for rendering scalar fields.
 
void set_coloring (Method method, Location location, const std::string &name)
 Sets the coloring.
 
void set_coloring_method (Method method)
 Sets the coloring method.
 
Method coloring_method () const
 Returns the coloring method being used for rendering.
 
const vec4 & color () const
 Returns the color, which is effective only when the coloring method was set to UNIFORM_COLOR.
 
void set_color (const vec4 &c)
 Sets the color.
 
Location property_location () const
 Returns the location of the color property.
 
const std::string & property_name () const
 Returns the name of the color attribute.
 
bool lighting () const
 Checks if lighting is enabled.
 
void set_lighting (bool l)
 Enables or disables lighting.
 
bool lighting_two_sides () const
 Checks if double-sided lighting is enabled.
 
void set_lighting_two_sides (bool b)
 Enables or disables double-sided lighting.
 
bool distinct_back_color () const
 Checks if a different color is used for rendering the backside of a drawable.
 
void set_distinct_back_color (bool b)
 Enables or disables different backside color.
 
const vec4 & back_color () const
 Returns the backside color.
 
void set_back_color (const vec4 &c)
 Sets the backside color.
 
const Texture * texture () const
 Returns the texture.
 
void set_texture (const Texture *tex)
 Sets the texture.
 
float texture_repeat () const
 Returns the repeat factor of the texture.
 
void set_texture_repeat (float r)
 Sets the repeat factor of the texture.
 
float texture_fractional_repeat () const
 Returns the fractional repeat factor of the texture.
 
void set_texture_fractional_repeat (float fr)
 Sets the fractional repeat factor of the texture.
 
bool is_ssao_enabled () const
 Checks if SSAO is enabled.
 
void enable_ssao (bool b)
 Enables or disables SSAO.
 
void set_ssao_texture (unsigned int tex)
 Sets the SSAO texture.
 
bool clamp_range () const
 Checks if the value range of a scalar field is clamped.
 
void set_clamp_range (bool b)
 Sets the clamping of the value range of a scalar field.
 
float clamp_lower () const
 Returns the percentage of values clamped at the lower side of the range.
 
void set_clamp_lower (float v)
 Sets the percentage of values clamped at the lower side of the range.
 
float clamp_upper () const
 Returns the percentage of values clamped at the upper side of the range.
 
void set_clamp_upper (float v)
 Sets the percentage of values clamped at the upper side of the range.
 
Material & material ()
 Returns the material.
 
const Material & material () const
 Returns the material (const version).
 
void set_material (const Material &m)
 Sets the material.
 
bool plane_clip_discard_primitive () const
 Controls the behavior for vertex clipping.
 
void set_plane_clip_discard_primitive (bool b)
 Sets the behavior for vertex clipping.
 
bool highlight () const
 Checks if a subset of primitives of this drawable is highlighted.
 
void set_highlight (bool b)
 Sets the highlight state of a subset of primitives of this drawable.
 
void set_highlight_range (const std::pair< int, int > &range)
 Sets the range of primitives to be highlighted.
 
const std::pair< int, int > & highlight_range () const
 Returns the range of primitives to be highlighted.
 

Detailed Description

The drawable for rendering a set of points, e.g., point clouds, vertices of a mesh.

See also
LinesDrawable, TrianglesDrawable
Examples
Tutorial_301_Drawables/main.cpp, Tutorial_302_Imposters/main.cpp, and Tutorial_403_PointSelection/main.cpp.

Member Enumeration Documentation

◆ ImposterType

The type of the point imposter.

Enumerator
PLAIN 

Plain mode.

SPHERE 

The points will be drawn as spheres.

SURFEL 

The points will be drawn as surfels/discs.

Constructor & Destructor Documentation

◆ PointsDrawable()

PointsDrawable ( const std::string & name = "",
Model * model = nullptr )
explicit

Constructor that initializes the drawable with a name and an optional model.

Parameters
nameThe name of the drawable.
modelThe model to which the drawable is attached (can be nullptr).

Member Function Documentation

◆ draw()

void draw ( const Camera * camera) const
overridevirtual

Draws the drawable.

Parameters
cameraThe camera used for rendering.

Implements Drawable.

◆ impostor_type()

ImposterType impostor_type ( ) const
inline

Returns the type of the point imposter.

Returns
The type of the point imposter.

◆ point_size()

float point_size ( ) const
inline

Returns the size of the points.

Returns
The size of the points.

◆ set_impostor_type()

void set_impostor_type ( ImposterType t)
inline

Sets the type of the point imposter.

Parameters
tThe new type of the point imposter.

◆ set_point_size()

void set_point_size ( float s)
inline

Sets the size of the points.

Parameters
sThe new size of the points.

◆ type()

Type type ( ) const
inlineoverridevirtual

Returns the type of the drawable.

Returns
The type of the drawable, which is DT_POINTS.

Implements Drawable.


The documentation for this class was generated from the following files: