Skip to content
Snippets Groups Projects

Halton Colors are introduced as an option for int-values properties. Also,...

Open Denis Kalmykov requested to merge feature-fixedRange_integer_prop_exclude into master
Files
2
@@ -46,6 +46,7 @@
#include "OVMPropertyVisualizerInteger.hh"
#include <ACG/Utils/ColorConversion.hh>
#include <ACG/Utils/LinearTwoColorCoder.hh>
#include <ACG/Utils/HaltonColors.hh>
template <typename MeshT, typename T>
OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo, bool isUnsigned)
@@ -109,6 +110,9 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Handle
auto cc = integerWidget->buildColorCoder();
ACG::HaltonColors hcol;
std::map<T, ACG::Vec4f> val_color_map;
unsigned int range = max - min;
VolumeMeshObject<MeshT>* object;
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
@@ -121,7 +125,13 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Handle
T value = prop[h];
double pos = (value - min) / (double) range;
ACG::Vec4f color;
if ( integerWidget->intRandom->isChecked() )
//if haltonColors is checked
if ((integerWidget->intHaltonColors->isEnabled()) && (integerWidget->intHaltonColors->isChecked())){
if(val_color_map.find(value) == val_color_map.end()){
color = hcol.get_next_color();
val_color_map.emplace(value, color);
} else color = val_color_map.at(value);
} else if ((integerWidget->intRandom->isEnabled()) && (integerWidget->intRandom->isChecked()))
{
// TODO: build appropriate subclass of IColorCoder for this purpose
if ( randomColor.find( value ) == randomColor.end() )
@@ -137,6 +147,8 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Handle
color = cc->color_float4(pos);
}
if ((value > max) || (value < min)) color[3] = 0;
object->colors()[h] = color;
}
}
Loading