Changeset 5118


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

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

Location:
geovis/trunk
Files:
6 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) {
  • geovis/trunk/RenderServer.cpp

    r4956 r5118  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * Copyright (C) 2013  HUBzero Foundation, LLC
     3 * Copyright (C) 2013-2015  HUBzero Foundation, LLC
    44 *
    55 * Author: Leif Delgass <ldelgass@purdue.edu>
  • geovis/trunk/RenderServer.h

    r5105 r5118  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * Copyright (C) 2013-2014  HUBzero Foundation, LLC
     3 * Copyright (C) 2013-2015  HUBzero Foundation, LLC
    44 *
    55 * Author: Leif Delgass <ldelgass@purdue.edu>
  • geovis/trunk/Renderer.cpp

    r5105 r5118  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * Copyright (C) 2004-2013  HUBzero Foundation, LLC
     3 * Copyright (C) 2004-2015  HUBzero Foundation, LLC
    44 *
    55 * Author: Leif Delgass <ldelgass@purdue.edu>
  • geovis/trunk/Renderer.h

    r5105 r5118  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * Copyright (C) 2004-2013  HUBzero Foundation, LLC
     3 * Copyright (C) 2004-2015  HUBzero Foundation, LLC
    44 *
    55 * Author: Leif Delgass <ldelgass@purdue.edu>
  • geovis/trunk/RendererCmd.cpp

    r5107 r5118  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * Copyright (C) 2004-2013  HUBzero Foundation, LLC
     3 * Copyright (C) 2004-2015  HUBzero Foundation, LLC
    44 *
    55 * Author: Leif Delgass <ldelgass@purdue.edu>
Note: See TracChangeset for help on using the changeset viewer.