cgv
Loading...
Searching...
No Matches
spline_tube_renderer.h
1#pragma once
2
3#include "surface_renderer.h"
4
5#include "gl/lib_begin.h"
6
7namespace cgv { // @<
8 namespace render { // @<
9 class CGV_API spline_tube_renderer;
10
12
15 extern CGV_API spline_tube_renderer& ref_spline_tube_renderer(context& ctx, int ref_count_change = 0);
16
26
29 {
30 protected:
35
36 vec3 eye_pos;
37
39 render_style* create_render_style() const;
41 bool build_shader_program(context& ctx, shader_program& prog, const shader_define_map& defines);
42 public:
43
44
45 void set_eye_pos(vec3 ep) { eye_pos = ep; }
46
47
51 void enable_attribute_array_manager(const context& ctx, attribute_array_manager& aam);
53 void disable_attribute_array_manager(const context& ctx, attribute_array_manager& aam);
55 template <typename T = float>
56 void set_radius_array(const context& ctx, const std::vector<T>& radii) { has_radii = true; set_attribute_array(ctx, "radius", radii); }
58 template <typename T = float>
59 void set_radius_array(const context& ctx, const T* radii, size_t nr_elements, unsigned stride_in_bytes = 0) { has_radii = true; set_attribute_array(ctx, "radius", radii, nr_elements, stride_in_bytes); }
61 void remove_radius_array(const context& ctx);
63 template <typename T = float>
64 void set_tangent_array(const context& ctx, const std::vector<T>& tangents) { has_tangents = true; set_attribute_array(ctx, "tangent", tangents); }
66 template <typename T = float>
67 void set_tangent_array(const context& ctx, const T* tangents, size_t nr_elements, unsigned stride_in_bytes = 0) { has_tangents = true; set_attribute_array(ctx, "tangent", tangents, nr_elements, stride_in_bytes); }
69 void remove_tangent_array(const context& ctx);
71 bool validate_attributes(const context& ctx) const;
73 bool enable(context& ctx);
75 bool disable(context& ctx);
77 void draw(context& ctx, size_t start, size_t count,
78 bool use_strips = false, bool use_adjacency = false, uint32_t strip_restart_index = -1);
79 };
80
82 {
83 bool self_reflect(cgv::reflect::reflection_handler& rh);
84 };
86 }
87}
88
89#include <cgv/config/lib_end.h>
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
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...
renderer that supports point splatting
bool has_tangents
whether tangents are specified
bool has_radii
whether radii are specified
base classes for renderers that support surface rendering
std::map< std::string, std::string > shader_define_map
typedef for shader define map data structure
Definition shader_code.h:52
spline_tube_renderer & ref_spline_tube_renderer(context &ctx, int ref_count_change)
reference to a singleton spline tube renderer that is shared among drawables
the cgv namespace
Definition print.h:11
this reflection traits implementation is used for external self_reflect implementations of instances ...
base class for all render styles
Definition renderer.h:16
float radius
default tube radius, initialized to 1
float radius_scale
multiplied to the tube radius, initialized to 1