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:
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:670
base class for all drawables, which is independent of the used rendering API.
Definition drawable.h:16
const box3 & get_box() const
return the axis aligned bounding box
void center_view()
call this to center the view after loading the mesh.
void draw_mesh_primitive(cgv::render::context &ctx, unsigned pi, bool opaque, bool use_materials=true)
draw all faces belonging to the given primitive, optionally turn off the specification of materials
void init_frame(cgv::render::context &ctx)
init textures if the mesh has been newly loaded
void clear(context &ctx)
clear all objects living in the context like textures or display lists
virtual bool read_mesh(const std::string &file_name)
read mesh from the given file_name which is extended by model path if it does not exist
void finish_draw(context &ctx)
default finish drawing implementation calls draw_mesh(ctx, false) to render transparent part
mesh_drawable()
construct from name which is necessary construction argument to node
std::string file_name
currently loaded file name
void draw_mesh(cgv::render::context &ctx, bool opaque, bool use_materials=true)
draw the complete mesh, optionally turn off the specification of materials
void draw(cgv::render::context &ctx)
default drawing implementation calls draw_mesh(ctx, true) to render opaque part
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...
namespace for opengl specific GPU programming
Definition gl.cxx:6
namespace for api independent GPU programming
this header is dependency free
Definition print.h:11
cgv::media::axis_aligned_box< float, 3 > box3
declare type of 3d single precision floating point axis-aligned boxes