source: nanovis/tags/1.2.0/TransferFunction.h @ 5040

Last change on this file since 5040 was 4889, checked in by ldelgass, 9 years ago

Merge r3611:3618 from trunk

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
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 *
10 *  Copyright (c) 2004-2013  HUBzero Foundation, LLC
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 */
16#ifndef NV_TRANSFER_FUNCTION_H
17#define NV_TRANSFER_FUNCTION_H
18
19#include <string>
20
21#include <vrmath/Vector3f.h>
22
23#include "Texture1D.h"
24
25namespace nv {
26
27class TransferFunction
28{
29public:
30    TransferFunction(const char *name, int size, float *data);
31
32    void update(float *data);
33
34    void update(int size, float *data);
35
36    GLuint id()
37    {
38        return _id;
39    }
40
41    void id(GLuint id)
42    {
43        _id = id;
44    }
45
46    Texture1D *getTexture()
47    {
48        return _tex;
49    }
50
51    float *getData()
52    {
53        return _data;
54    }
55
56    int getSize() const
57    {
58        return _size;
59    }
60
61    const char *name() const
62    {
63        return _name.c_str();
64    }
65
66    static void sample(float fraction, float *keys, vrmath::Vector3f *keyValues, int count, vrmath::Vector3f *ret);
67
68    static void sample(float fraction, float *keys, float *keyValues, int count, float *ret);
69
70protected :
71    ~TransferFunction();
72
73private:
74    /// the resolution of the color map, how many (RGBA) quadraples
75    int _size;
76    float *_data;
77    Texture1D *_tex;    ///< the texture storing the colors
78    std::string _name;
79    GLuint _id;         ///< OpenGL texture identifier
80};
81
82}
83
84#endif
Note: See TracBrowser for help on using the repository browser.