20 float radius_scale = 1.0f;
24 bool show_caps =
true;
25 bool rounded_caps =
false;
27 bool enable_texturing =
false;
28 enum TextureBlendMode {
32 TBM_INVERSE_MULTIPLY = 3,
34 } texture_blend_mode = TextureBlendMode::TBM_MIX;
35 float texture_blend_factor = 1.0f;
36 bool texture_tile_from_center =
false;
37 vec2 texture_offset = { 0.0f };
38 vec2 texture_tiling = { 1.0f };
39 bool texture_use_reference_length =
false;
40 float texture_reference_length = 1.0f;
42 bool enable_ambient_occlusion =
false;
43 float ao_offset = 0.04f;
44 float ao_distance = 0.8f;
45 float ao_strength = 1.0f;
47 vec3 tex_offset = { 0.0f };
48 vec3 tex_scaling = { 1.0f };
49 vec3 tex_coord_scaling = { 1.0f };
50 float texel_size = 1.0f;
51 float cone_angle_factor = 1.0f;
52 std::vector<vec3> sample_dirs = std::vector<vec3>(3, { 0.0f, 1.0f, 0.0f });
58 bool has_radii =
false;
66 texture* albedo_texture =
nullptr;
67 texture* density_texture =
nullptr;
74 bool set_albedo_texture(
texture* tex);
75 bool set_density_texture(
texture* tex);
77 bool enable(
context& ctx)
override;
79 template <
typename T =
float>
80 void set_radius_array(
const context& ctx,
const std::vector<T>& radii) { has_radii =
true; set_attribute_array(ctx,
"radius", radii); }
82 template <
typename T =
float>
83 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); }
85 void remove_radius_array(
const context& ctx);
87 template <
typename T =
float>
89 set_composed_attribute_array(ctx,
"position", &spheres.front(), spheres.size(),
reinterpret_cast<const cgv::math::fvec<T, 3>&
>(spheres.front()));
90 ref_composed_attribute_array(ctx,
"radius",
"position", &spheres.front(), spheres.size(), spheres[0][3]);
95 bool validate_attributes(
const context& ctx)
const override;
97 bool disable(
context& ctx)
override;
99 void draw(
context& ctx,
size_t start,
size_t count,
100 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1)
override;
102 void clear(
const context& ctx)
override;
base class for all drawables, which is independent of the used rendering API.
the texture class encapsulates all functionality independent of the rendering api.