cgv
Loading...
Searching...
No Matches
plot3d.h
1#pragma once
2
3#include "plot_base.h"
4#include <cgv/render/shader_program.h>
5#include <libs/cgv_gl/box_renderer.h>
6#include <cgv_gl/cone_renderer.h>
7
8#include "lib_begin.h"
9
10namespace cgv {
11 namespace plot {
12
14enum PlotFaceIllumination
15{
16 PFI_NONE,
17 PFI_PER_FACE,
18 PFI_PER_VERTEX
19};
20
22struct CGV_API plot3d_config : public plot_base_config
23{
37 PlotFaceIllumination face_illumination;
39 void set_colors(const rgb& base_color);
41 plot3d_config(const std::string& _name);
42};
43
45class CGV_API plot3d : public plot_base
46{
47 cgv::render::shader_program tick_label_prog;
50 cgv::render::shader_program wirebox_prog;
53 //cgv::render::shader_program surface_prog;
57
58 bool compute_sample_coordinate_interval(int i, int ai, float& samples_min, float& samples_max);
59 void draw_domain(cgv::render::context& ctx);
60 void draw_ticks(cgv::render::context& ctx);
61 void draw_sub_plots(cgv::render::context& ctx);
62protected:
63 std::vector<std::vector<vec3> > samples;
65 void compute_tick_render_information();
66public:
68 plot3d(unsigned nr_attributes = 0);
72 unsigned add_sub_plot(const std::string& name);
74 void set_samples_per_row(unsigned i, unsigned N);
76 unsigned get_samples_per_row(unsigned i) const;
78 void delete_sub_plot(unsigned i);
80 plot3d_config& ref_sub_plot3d_config(unsigned i = 0);
82 std::vector<vec3>& ref_sub_plot_samples(unsigned i = 0);
84
86 void create_line_config_gui(cgv::base::base* bp, cgv::gui::provider& p, plot_base_config& pbc);
88 void create_bar_config_gui(cgv::base::base* bp, cgv::gui::provider& p, plot_base_config& pbc);
89 void create_config_gui(cgv::base::base* bp, cgv::gui::provider& p, unsigned i);
90 bool init(cgv::render::context& ctx);
91 void draw(cgv::render::context& ctx);
92 void clear(cgv::render::context& ctx);
93 void create_gui(cgv::base::base* bp, cgv::gui::provider& p);
94};
95
96 }
97}
98#include <cgv/config/lib_end.h>
base class for all classes that can be registered with support for dynamic properties (see also secti...
Definition base.h:75
derive from this class to provide a gui to the current viewer
Definition provider.h:64
The plot3d class draws 2d plots with potentially several sub plots of different plot configuration.
Definition plot3d.h:46
base class for plot2d and plot3d, which can have several sub plots each
Definition plot_base.h:282
attribute array manager used to upload arrays to gpu
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
a shader program combines several shader code fragments to a complete definition of the shading pipel...
the cgv namespace
Definition print.h:11
extend common plot configuration with parameters specific to 2d plot
Definition plot3d.h:23
rgb surface_color
color of faces
Definition plot3d.h:35
PlotFaceIllumination face_illumination
how to illuminate the surface
Definition plot3d.h:37
unsigned samples_per_row
if samples per row > 0, the samples are interpreted as regular grid
Definition plot3d.h:29
mapped_size bar_percentual_depth
provide second dimension of bar extend
Definition plot3d.h:27
bool wireframe
whether to turn on wireframe
Definition plot3d.h:33
bool show_line_orientation
whether to illustrate line orientation
Definition plot3d.h:25
bool show_surface
whether to show faces
Definition plot3d.h:31
plot independent configuration parameters of one sub plot in a 2d or 3d plot
Definition plot_base.h:130
boxes use surface render styles