27#include <easy3d/viewer/viewer.h>
28#include <easy3d/core/surface_mesh.h>
29#include <easy3d/renderer/drawable_points.h>
30#include <easy3d/renderer/drawable_lines.h>
31#include <easy3d/renderer/drawable_triangles.h>
32#include <easy3d/renderer/renderer.h>
33#include <easy3d/util/resource.h>
34#include <easy3d/util/initializer.h>
50 drawable->
set_point_size(24.0f);
51 drawable->
set_impostor_type(PointsDrawable::SPHERE);
59 drawable->
set_impostor_type(LinesDrawable::CYLINDER);
60 drawable->
set_line_width(6);
78 std::vector<vec3> normal_points;
80 const vec3 &s = points[v];
81 const vec3 &t = points[v] + normals[v] *
length;
82 normal_points.push_back(s);
83 normal_points.push_back(t);
89 drawable->set_impostor_type(LinesDrawable::CONE);
90 drawable->set_line_width(8);
98 drawable->set_point_size(24.0f);
99 drawable->set_impostor_type(PointsDrawable::SURFEL);
103int main(
int argc,
char **argv) {
109 Viewer viewer(EXAMPLE_TITLE);
112 const std::string file_name = resource::directory() +
"/data/sphere.obj";
113 auto mesh =
dynamic_cast<SurfaceMesh *
>(viewer.add_model(file_name,
false));
115 LOG(ERROR) <<
"failed to load model. Please make sure the file exists and format is correct.";
121 create_spheres(mesh);
125 create_cylinders(mesh);
137 auto points = copy->get_vertex_property<
vec3>(
"v:point");
138 for (
auto v : copy->vertices())
140 viewer.add_model(copy,
false);
142 create_surfels(copy);
void update_vertex_buffer(const std::vector< vec3 > &vertices, bool dynamic=false)
Creates/Updates a single buffer.
Definition: drawable.cpp:142
FT diagonal_length() const
Definition: box.h:185
The drawable for rendering a set of line segments, e.g., edges of a mesh, vector fields.
Definition: drawable_lines.h:40
Renderer * renderer()
Gets the renderer of this model.
Definition: model.h:94
const Box3 & bounding_box(bool recompute=false) const
The bounding box of the model.
Definition: model.cpp:41
The drawable for rendering a set of points, e.g., point clouds, vertices of a mesh.
Definition: drawable_points.h:42
PointsDrawable * add_points_drawable(const std::string &name)
Definition: renderer.cpp:313
LinesDrawable * add_lines_drawable(const std::string &name)
Definition: renderer.cpp:327
void set_uniform_coloring(const vec4 &color)
Definition: state.cpp:89
A halfedge data structure for polygonal meshes of 2-manifold.
Definition: surface_mesh.h:52
VertexContainer vertices() const
returns vertex container for C++11 range-based for-loops
Definition: surface_mesh.h:1631
VertexProperty< T > get_vertex_property(const std::string &name) const
Definition: surface_mesh.h:1417
void update_vertex_normals()
compute vertex normals by calling compute_vertex_normal(Vertex) for each vertex.
Definition: surface_mesh.cpp:1093
The built-in Easy3D viewer.
Definition: viewer.h:61
Definition: collider.cpp:182
T length(const Vec< N, T > &v)
Computes the length/magnitude of a vector.
Definition: vec.h:289
void initialize(bool use_log_file, bool use_setting_file, const std::string &resource_dir)
Initialization of Easy3D.
Definition: initializer.cpp:35