Ignore:
Timestamp:
Mar 10, 2015 1:50:22 PM (9 years ago)
Author:
ldelgass
Message:

Fix legend rendering: use colormap min/max to interpolate values (OSG transfer
functions aren't normalized)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/ColorMap.cpp

    r5105 r5118  
    2828    unsigned char *dst = imgData->data();
    2929    //unsigned char *src = map->data();
     30    float min = map->getMinimum();
     31    float max = map->getMaximum();
    3032    if (height > width) {
    3133        for (int i = 0; i < height; i++) {
    3234            float x = (float)i/(height-1);
    33             osg::Vec4f rgb = map->getColor(x);
     35            float val = min + (max - min) * x;
     36            osg::Vec4f rgb = map->getColor(val);
    3437            unsigned char color[3];
    3538            if (opaque) {
     
    5558            for (int j = 0; j < width; j++) {
    5659                float x = (float)j/(width-1);
    57                 osg::Vec4f rgb = map->getColor(x);
     60                float val = min + (max - min) * x;
     61                osg::Vec4f rgb = map->getColor(val);
    5862                unsigned char color[3];
    5963                if (opaque) {
Note: See TracChangeset for help on using the changeset viewer.