cgv
Loading...
Searching...
No Matches
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
13namespace cgv {
15 namespace render {
17 namespace gl {
18
19
22{
23public:
26protected:
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();
47public:
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>
the simple_mesh class is templated over the coordinate type that defaults to float
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
base class for all drawables, which is independent of the used rendering API.
Definition drawable.h:15
simple implementation of a drawable for a polygonal mesh with support for materials
std::string file_name
currently loaded file name
std::string model_path
default path to file names
cgv::media::mesh::simple_mesh< float > mesh_type
type of mesh
box3 box
the bounding box of the mesh is computed in the read_mesh method
the mesh_render_info structure manages vertex buffer objects for attribute and element buffers as wel...
the cgv namespace
Definition print.h:11