cgv
mesh_drawable.h
1 #pragma once
2 
3 #include <cgv/render/textured_material.h>
4 #include <cgv/render/vertex_buffer.h>
5 #include <cgv/render/attribute_array_binding.h>
6 #include <cgv/media/mesh/simple_mesh.h>
7 #include <cgv/media/axis_aligned_box.h>
8 #include <cgv/render/drawable.h>
9 #include "mesh_render_info.h"
10 
11 #include "lib_begin.h"
12 
13 namespace cgv {
15  namespace render {
17  namespace gl {
18 
19 
21 class CGV_API mesh_drawable : public cgv::render::drawable
22 {
23 public:
26 protected:
28  std::string model_path;
30  std::string file_name;
32  mesh_type mesh;
34  mesh_render_info mesh_info;
36  bool rebuild_mesh_info;
40  void draw_mesh_primitive(cgv::render::context &ctx, unsigned pi, bool opaque, bool use_materials = true);
42  void draw_mesh(cgv::render::context &ctx, bool opaque, bool use_materials = true);
44 
46  void center_view();
47 public:
49  mesh_drawable();
51  void init_frame(cgv::render::context &ctx);
53  void draw(cgv::render::context &ctx);
55  void finish_draw(context &ctx);
57  virtual bool read_mesh(const std::string& file_name);
59  void clear(context& ctx);
61  const box3& get_box() const;
62 };
63 
64  }
65  }
66 }
67 #include <cgv/config/lib_end.h>
cgv::render::gl::mesh_drawable::model_path
std::string model_path
default path to file names
Definition: mesh_drawable.h:28
cgv::render::gl::mesh_drawable
simple implementation of a drawable for a polygonal mesh with support for materials
Definition: mesh_drawable.h:22
cgv::render::gl::mesh_drawable::mesh_type
cgv::media::mesh::simple_mesh< float > mesh_type
type of mesh
Definition: mesh_drawable.h:25
cgv::media::axis_aligned_box
Definition: axis_aligned_box.h:15
cgv::render::gl::mesh_drawable::box
box3 box
the bounding box of the mesh is computed in the read_mesh method
Definition: mesh_drawable.h:38
cgv::render::drawable
Definition: drawable.h:15
cgv::media::mesh::simple_mesh< float >
cgv::render::mesh_render_info
Definition: mesh_render_info.h:16
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::render::context
Definition: context.h:525
cgv::render::gl::mesh_drawable::file_name
std::string file_name
currently loaded file name
Definition: mesh_drawable.h:30