1#include "surface_renderer.h"
2#include <cgv_gl/gl/gl.h>
3#include <cgv_gl/gl/gl_tools.h>
4#include <cgv_gl/gl/gl_context.h>
23 has_texcoords =
false;
27 remove_attribute_array(ctx,
"normal");
30 has_texcoords =
false;
31 remove_attribute_array(ctx,
"texcoord");
37 set_attribute_array(ctx,
"normal", element_type, vbo, offset_in_bytes, nr_elements, stride_in_bytes);
44 set_attribute_array(ctx,
"texcoord", element_type, vbo, offset_in_bytes, nr_elements, stride_in_bytes);
51 if (cull_per_primitive) {
53 glDisable(GL_CULL_FACE);
56 glCullFace(srs.
culling_mode == CM_FRONTFACE ? GL_FRONT : GL_BACK);
57 glEnable(GL_CULL_FACE);
76 if (cull_per_primitive) {
78 glDisable(GL_CULL_FACE);
82 has_texcoords =
false;
104#include <cgv/gui/provider.h>
113 void* value_ptr,
const std::string& value_type,
114 const std::string& gui_type,
const std::string& options,
bool*)
123 "enums='Color Front=1,Color Back=2,Opacity Front=4,Opacity Back=8'");
152#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.
void align(const std::string &_align)
send pure alignment information
bool begin_tree_node(const std::string &label, const T &value, bool initial_visibility=false, const std::string &options="", gui_group_ptr ggp=gui_group_ptr())
Begin a sub tree of a tree structured gui.
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
void end_tree_node(const T &value)
template specialization that allows to specify value reference plus node_instance by using the result...
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.
virtual void set_color(const rgba &clr)
set the current color
virtual void set_material(const cgv::media::illum::surface_material &mat)
set the current material
bool disable(context &ctx)
disable renderer
void enable_attribute_array_manager(const context &ctx, attribute_array_manager &aam)
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)
call this after last render/draw call to ensure that no other users of renderer change attribute arra...
bool enable(context &ctx)
overload to activate group style
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 has_colors
track whether color attribute is defined
bool attributes_persist() const
return whether attributes persist after a call to disable
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,...
void set_texcoord_array(const context &ctx, const std::vector< T > &texcoords)
templated method to set the texcoord attribute array from a vector of texcoords of type T
void set_normal_array(const context &ctx, const std::vector< T > &normals)
templated method to set the normal attribute array from a vector of normals of type T,...
void remove_normal_array(const context &ctx)
remove the normal attribute
void remove_texcoord_array(const context &ctx)
remove the texcoord attribute
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
a vertex buffer is an unstructured memory block on the GPU.
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 ...
render style used for group information
CullingMode culling_mode
culling mode for point splats, set to CM_OFF in constructor
float surface_opacity
default value for the surface opacity when map color to material is used
ColorMapping map_color_to_material
material side[s] where color is to be mapped to the diffuse material component, defaults to CM_COLOR ...
IlluminationMode illumination_mode
illumination mode defaults to IM_ONE_SIDED
cgv::media::illum::textured_surface_material material
material of surface
cgv::media::illum::surface_material::color_type surface_color
default value for color when map color to material is used
compact type description of data that can be sent to the context; convertible to int
traits class with a static function get_name() of type const char* that returns the type name of the ...