1#include "spline_tube_renderer.h"
2#include <cgv_gl/gl/gl.h>
3#include <cgv_gl/gl/gl_tools.h>
9 static int ref_count = 0;
11 r.
manage_singleton(ctx,
"spline_tube_renderer", ref_count, ref_count_change);
33 remove_attribute_array(ctx,
"radii");
37 remove_attribute_array(ctx,
"tangent");
86 draw_impl(ctx, PT_LINES, start, count, use_strips, use_adjacency, strip_restart_index);
96#include <cgv/gui/provider.h>
104 void* value_ptr,
const std::string& value_type,
105 const std::string& gui_type,
const std::string& options,
bool*) {
111 p->
add_member_control(b,
"default radius", strs_ptr->
radius,
"value_slider",
"min=0.001;step=0.0001;max=10.0;log=true;ticks=true");
119#include "gl/lib_begin.h"
base class for all classes that can be registered with support for dynamic properties (see also secti...
helper template for registration of gui creators
derive from this class to provide a gui to the current viewer
bool add_gui(const std::string &label, T &value, const std::string &gui_type="", const std::string &options="")
Add a composed gui of the given gui_type for the given value.
data::ref_ptr< control< T > > add_member_control(cgv::base::base *base_ptr, const std::string &label, T &value, const std::string &gui_type="", const std::string &options="", const std::string &align="\n")
add control with callback to cgv::base::on_set method on cgv::gui::control::value_change
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
bool reflect_base(B &base_ref)
reflect a base class with its members
bool reflect_member(const std::string &member_name, T &member_ref, bool hard_cast=false)
call this to reflect a member by member name and reference to the member.
attribute array manager used to upload arrays to gpu
base class for all drawables, which is independent of the used rendering API.
bool validate_attributes(const context &ctx) const
check additionally the group attributes
void manage_singleton(context &ctx, const std::string &renderer_name, int &ref_count, int ref_count_change)
used by derived classes to manage singletons
bool has_attribute(const context &ctx, const std::string &name)
check for attribute
shader_program & ref_prog()
derived renderer classes have access to shader program
bool attributes_persist() const
return whether attributes persist after a call to disable
void draw_impl(context &ctx, PrimitiveType pt, size_t start, size_t count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1)
default implementation of draw method with support for indexed rendering and different primitive type...
bool set_uniform(const context &ctx, const std::string &name, const T &value, bool generate_error=false)
Set the value of a uniform by name, where the type can be any of int, unsigned, float,...
bool set_attribute(const context &ctx, const std::string &name, const T &value)
set constant default value of a vertex attribute by attribute name, if name does not specify an attri...
renderer that supports point splatting
bool validate_attributes(const context &ctx) const override
check additionally the group attributes
void enable_attribute_array_manager(const context &ctx, attribute_array_manager &aam) override
call this before setting attribute arrays to manage attribute array in given manager
bool enable(context &ctx) override
overload to activate group style
bool has_tangents
whether tangents are specified
void remove_radius_array(const context &ctx)
remove the radius attribute
void remove_tangent_array(const context &ctx)
remove the tangent attribute
bool has_radii
whether radii are specified
void disable_attribute_array_manager(const context &ctx, attribute_array_manager &aam) override
call this after last render/draw call to ensure that no other users of renderer change attribute arra...
vec3 eye_pos
the view eye position
void draw(context &ctx, size_t start, size_t count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1) override
convenience function to render with default settings
bool disable(context &ctx) override
disable renderer
void enable_attribute_array_manager(const context &ctx, attribute_array_manager &aam) override
call this before setting attribute arrays to manage attribute array in given manager
void disable_attribute_array_manager(const context &ctx, attribute_array_manager &aam) override
call this after last render/draw call to ensure that no other users of renderer change attribute arra...
bool enable(context &ctx) override
overload to activate group style
bool disable(context &ctx) override
disable renderer
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
cgv::math::fvec< float, 4 > vec4
declare type of 4d single precision floating point vectors (used for homogeneous coordinates)
interface for gui creators
bool create(provider *p, const std::string &label, void *value_ptr, const std::string &value_type, const std::string &gui_type, const std::string &options, bool *)
attempt to create a gui and return whether this was successful
this reflection traits implementation is used for external self_reflect implementations of instances ...
float radius
default tube radius, initialized to 1
float radius_scale
multiplied to the tube radius, initialized to 1
traits class with a static function get_name() of type const char* that returns the type name of the ...