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;
66public:
68 plot3d(unsigned nr_attributes = 0);
71
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
90 bool init(cgv::render::context& ctx);
91 void draw(cgv::render::context& ctx);
92 void clear(cgv::render::context& ctx);
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
std::vector< vec3 > & ref_sub_plot_samples(unsigned i=0)
return the samples of the i-th sub plot
Definition plot3d.cxx:136
void draw(cgv::render::context &ctx)
overload to draw the content of this drawable
Definition plot3d.cxx:505
void compute_tick_render_information()
overloaded in derived classes to compute complete tick render information
Definition plot3d.cxx:16
plot3d_config & ref_sub_plot3d_config(unsigned i=0)
return a reference to the plot3d configuration of the i-th plot
Definition plot3d.cxx:129
bool init(cgv::render::context &ctx)
this method is called after creation or recreation of the context, return whether all necessary funct...
Definition plot3d.cxx:142
void create_bar_config_gui(cgv::base::base *bp, cgv::gui::provider &p, plot_base_config &pbc)
create the gui for a bar subplot
Definition plot3d.cxx:555
void clear(cgv::render::context &ctx)
clear all objects living in the context like textures or display lists
Definition plot3d.cxx:535
void create_gui(cgv::base::base *bp, cgv::gui::provider &p)
create a gui for the plot with gui for all configs
Definition plot3d.cxx:579
void set_samples_per_row(unsigned i, unsigned N)
set the number of samples of the i-th sub plot to N
Definition plot3d.cxx:117
void delete_sub_plot(unsigned i)
delete the i-th sub plot
Definition plot3d.cxx:108
unsigned get_samples_per_row(unsigned i) const
return the number of samples per row
Definition plot3d.cxx:123
void create_line_config_gui(cgv::base::base *bp, cgv::gui::provider &p, plot_base_config &pbc)
create the gui for a line subplot
Definition plot3d.cxx:549
plot3d(unsigned nr_attributes=0)
construct 3d plot with given number of additional attributes and default parameters
Definition plot3d.cxx:66
unsigned add_sub_plot(const std::string &name)
add sub plot and return reference to samples
Definition plot3d.cxx:84
void create_config_gui(cgv::base::base *bp, cgv::gui::provider &p, unsigned i)
create the gui for a subplot configuration
Definition plot3d.cxx:562
plot_base(unsigned dim, unsigned nr_attributes=0)
construct from plot dimension and number of additional attributes with default parameters
unsigned nr_attributes
number of additional attributes
Definition plot_base.h:346
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:670
a shader program combines several shader code fragments to a complete definition of the shading pipel...
this header is dependency free
Definition print.h:11
cgv::media::color< float, cgv::media::RGB > rgb
declare rgb color type with 32 bit components
Definition color.h:896
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
void set_colors(const rgb &base_color)
add tube and surface color
Definition plot3d.cxx:9
mapped_size bar_percentual_depth
provide second dimension of bar extend
Definition plot3d.h:27
plot3d_config(const std::string &_name)
construct with default values
Definition plot3d.cxx:28
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:134
plot_base_config(const std::string &_name, unsigned dim)
set default values
Definition plot_base.cxx:47
boxes use surface render styles