Easy3D 2.5.3
drawable_points.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_RENDERER_DRAWABLE_POINTS_H
28#define EASY3D_RENDERER_DRAWABLE_POINTS_H
29
30#include <easy3d/renderer/drawable.h>
31
32
33namespace easy3d {
34
35
42 class PointsDrawable : public Drawable {
43 public:
44 explicit PointsDrawable(const std::string& name = "", Model* model = nullptr);
45
46 Type type() const override;
47
48 // a point imposter can be a sphere, or a surfel/disc
49 enum ImposterType {
50 PLAIN,
51 SPHERE,
52 SURFEL
53 };
54
56 ImposterType impostor_type() const { return impostor_type_; }
57 void set_impostor_type(ImposterType t) { impostor_type_ = t; }
58
60 float point_size() const { return point_size_; }
61 void set_point_size(float s) { point_size_ = s; }
62
63 // Rendering.
64 void draw(const Camera* camera) const override;
65
66 protected:
67 // without texture
68 void _draw_plain_points(const Camera* camera) const;
69 void _draw_spheres_sprite(const Camera* camera) const;
70 void _draw_spheres_geometry(const Camera* camera) const;
71 void _draw_surfels(const Camera* camera) const;
72
73 // textured
74 void _draw_plain_points_with_texture(const Camera* camera) const;
75 void _draw_spheres_with_texture_sprite(const Camera* camera) const;
76 void _draw_spheres_with_texture_geometry(const Camera* camera) const;
77 void _draw_surfels_with_texture(const Camera* camera) const;
78
79 private:
80 float point_size_;
81 ImposterType impostor_type_;
82 };
83
84}
85
86
87#endif // EASY3D_RENDERER_DRAWABLE_POINTS_H
The base class for drawable objects. A drawable represent a set of points, line segments,...
Definition: drawable.h:56
Model * model()
the model to which the drawable is attached to (can be NULL).
Definition: drawable.h:77
The base class of renderable 3D models.
Definition: model.h:49
The drawable for rendering a set of points, e.g., point clouds, vertices of a mesh.
Definition: drawable_points.h:42
Type type() const override
Returns the type of the drawable.
Definition: drawable_points.cpp:51
ImposterType impostor_type() const
Definition: drawable_points.h:56
void draw(const Camera *camera) const override
The draw method.
Definition: drawable_points.cpp:56
float point_size() const
Definition: drawable_points.h:60
Definition: collider.cpp:182