1#include "device_color_scale.h"
14 arguments.mapping_options |= DeviceColorScaleMappingOptions::kClamped;
15 update_color_scale_specific_arguments(arguments);
20 auto color_scale = get_color_scale();
22 return color_scale->quantize(texture_resolution);
24 return std::vector<cgv::rgba>(texture_resolution, { 0.0f });
30 out_arguments.mapping_options |= DeviceColorScaleMappingOptions::kDiverging;
31 out_arguments.midpoint =
color_scale->get_midpoint();
32 out_arguments.exponent =
color_scale->get_pow_exponent();
36 if(
color_scale->get_transform() == cgv::media::ContinuousMappingTransform::Log) {
38 out_arguments.log_sign = domain[0] < 0.0f && domain[1] < 0.0f ? -1.0f : 1.0f;
39 out_arguments.log_base = std::log(
color_scale->get_log_base());
40 out_arguments.log_midpoint = std::log(out_arguments.log_sign *
color_scale->get_midpoint()) / out_arguments.log_base;
41 out_arguments.log_lower_bound = std::log(out_arguments.log_sign * domain[0]) / out_arguments.log_base;
42 out_arguments.log_upper_bound = std::log(out_arguments.log_sign * domain[1]) / out_arguments.log_base;
46void device_discrete_color_scale::update_color_scale_specific_arguments(device_color_scale_arguments& out_arguments)
const {
47 size_t count = std::min(
color_scale->get_indexed_color_count(), device_color_scale_arguments::k_max_indexed_color_count);
48 out_arguments.indexed_color_count =
static_cast<uint8_t
>(count);
49 out_arguments.sample_mode = DeviceColorScaleSampleMode::kDiscrete;
std::shared_ptr< cgv::media::continuous_color_scale > color_scale
device_color_scale_arguments get_arguments() const
Get the color scale arguments of the underlying color scale implementation.
std::vector< cgv::rgba > get_texture_data(size_t texture_resolution) const
Get the texture data of the underlying color scales's color ramp or indexed colors.
namespace for api independent GPU programming
this header is dependency free
cgv::math::fvec< float, 2 > vec2
declare type of 2d single precision floating point vectors
Color scale arguments as used by the graphics device or shader program.
uint16_t transform
The next three fields "transform, mapping_options and sample_mode" take up 4 bytes in total.