source: nanovis/branches/1.1/TransferFunction.h @ 4888

Last change on this file since 4888 was 4819, checked in by ldelgass, 9 years ago

merge r4067 from trunk

  • Property svn:eol-style set to native
File size: 1.8 KB
RevLine 
[2798]1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
[379]2/*
3 * ----------------------------------------------------------------------
4 * ColorMap.h: color map class contains an array of (RGBA) values
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
[3502]10 *  Copyright (c) 2004-2013  HUBzero Foundation, LLC
[379]11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
[2820]16#ifndef TRANSFER_FUNCTION_H
17#define TRANSFER_FUNCTION_H
[379]18
[3568]19#include <string>
20
[3492]21#include <vrmath/Vector3f.h>
22
[379]23#include "Texture1D.h"
24
[3463]25class TransferFunction
[2820]26{
[973]27public:
[3568]28    TransferFunction(const char *name, int size, float *data);
[2831]29
[973]30    void update(float *data);
[2831]31
[973]32    void update(int size, float *data);
[2831]33
34    GLuint id()
35    {
36        return _id;
[1493]37    }
[2831]38
39    void id(GLuint id)
40    {
41        _id = id;
[1493]42    }
[2831]43
44    Texture1D *getTexture()
45    {
46        return _tex;
[973]47    }
[2831]48
49    float *getData()
50    {
51        return _data;
[973]52    }
[2831]53
54    int getSize() const
55    {
56        return _size;
[1493]57    }
[2831]58
59    const char *name() const
60    {
[3568]61        return _name.c_str();
[1493]62    }
[2831]63
[4819]64    static void sample(float fraction, float *keys, vrmath::Vector3f *keyValues, int count, vrmath::Vector3f *ret);
[2831]65
[4819]66    static void sample(float fraction, float *keys, float *keyValues, int count, float *ret);
[2831]67
68protected :
69    ~TransferFunction();
70
71private:
[2844]72    /// the resolution of the color map, how many (RGBA) quadraples
73    int _size;
74    float *_data;
75    Texture1D *_tex;    ///< the texture storing the colors
[3568]76    std::string _name;
[2844]77    GLuint _id;         ///< OpenGL texture identifier
[379]78};
79
80#endif
Note: See TracBrowser for help on using the repository browser.