![]() |
LibCarna Version 3.4.0
|
Represents a mapping of intensity values to RGBA colors, that can be queried in a shader. More...
#include <ColorMap.hpp>
Public Member Functions | |
ColorMap (unsigned int resolution=DEFAULT_RESOLUTION) | |
Instantiates. | |
~ColorMap () | |
Deletes the maintained OpenGL texture and sampler objects. | |
void | clear () |
Clears the color map. All intensity values are mapped to base::Color::BLACK_NO_ALPHA after calling this method. | |
ColorMap & | writeLinearSegment (const base::math::Span< float > &intensityRange, const base::math::Span< base::Color > colorRange) |
Linearly maps all intensity values from intensityRange to colorRange. | |
ColorMap & | writeLinearSegment (float intensityFirst, float intensityLast, const base::Color &colorFirst, const base::Color &colorLast) |
ColorMap & | writeLinearSpline (const std::vector< base::Color > &colors) |
Writes a linear segment with writeLinearSegment for each subsequent pair of colors. The colors are spaced equidistantly to cover the whole range of values in \([0, 1]\). | |
const std::vector< base::Color > & | getColorList () const |
Returns the list of colors stored in the color map. | |
void | bind (int unit) const |
Binds this texture and the corresponding sampler to unit. | |
ColorMap & | operator= (const ColorMap &other) |
Writes the content the other color map into this. | |
void | setMinimumIntensity (float minimumIntensity) |
Sets the minimum intensity value. Intensity values below this value are treated as 0. | |
float | minimumIntensity () const |
Returns the minimum intensity value. Intensity values below this value are treated as 0. | |
void | setMaximumIntensity (float maximumIntensity) |
Sets the maximum intensity value. Intensity values above this value are treated as 1. | |
float | maximumIntensity () const |
Returns the maximum intensity value. Intensity values above this value are treated as 1. | |
Static Public Attributes | |
static const unsigned int | DEFAULT_RESOLUTION = ( 1 << 16 ) |
Holds the default resolution of the color map (16bit). | |
static const float | DEFAULT_MINIMUM_INTENSITY |
Holds the default value for minimumIntensity. | |
static const float | DEFAULT_MAXIMUM_INTENSITY |
Holds the default value for maximumIntensity. | |
Represents a mapping of intensity values to RGBA colors, that can be queried in a shader.
Definition at line 44 of file ColorMap.hpp.
|
explicit |
Instantiates.
The parameter resolution determines the resolution of the color map. If your data is 8bit, using a 8bit color map is sufficient. If your data is 32bit, you probably also want to use a 32bit color map.
Sets the maximum intensity value. Intensity values above this value are treated as 1.
0 <= maximumIntensity <= 1
maximumIntensity() == maximumIntensity
minimumIntensity() <= maximumIntensity()
Sets the minimum intensity value. Intensity values below this value are treated as 0.
0 <= minimumIntensity <= 1
minimumIntensity() == minimumIntensity
minimumIntensity() <= maximumIntensity()
ColorMap & LibCarna::base::ColorMap::writeLinearSegment | ( | const base::math::Span< float > & | intensityRange, |
const base::math::Span< base::Color > | colorRange | ||
) |
Linearly maps all intensity values from intensityRange to colorRange.
The first/last intensity values from intensityRange are mapped to the first/last values of colorRange, respectively. The values are interpolated linearly in between.
Nothing happens if the last intensity value of intensityRange is smaller than the first. If the first and the last intensity values of intensityRange correspond to the same entry of the color map, the mean of the first and the last values from colorRange is written.
ColorMap & LibCarna::base::ColorMap::writeLinearSegment | ( | float | intensityFirst, |
float | intensityLast, | ||
const base::Color & | colorFirst, | ||
const base::Color & | colorLast | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Holds the default value for maximumIntensity.
Definition at line 61 of file ColorMap.hpp.
Holds the default value for minimumIntensity.
Definition at line 59 of file ColorMap.hpp.
Holds the default resolution of the color map (16bit).
Definition at line 57 of file ColorMap.hpp.
Written by Leonid Kostrykin © 2021–2025. Based on Carna (© 2010-2016).
Documentation generated by Doxygen