source: trunk/vizservers/nanovis/TransferFunction.cpp @ 837

Last change on this file since 837 was 830, checked in by vrinside, 17 years ago

Make it keep original color data in order to apply it to point primitives of point primitive based rendering.

File size: 1.2 KB
Line 
1
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-2006  Purdue Research Foundation
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
17
18#include "TransferFunction.h"
19#include <memory.h>
20
21
22TransferFunction::TransferFunction(int _size, float* data)
23{
24    tex = new Texture1D(_size, GL_FLOAT);
25
26    // _size : # of slot, 4 : rgba
27    size = _size * 4;
28    this->data = new float[size];
29    memcpy(this->data, data, sizeof(float) * size);
30
31    tex->initialize_float_rgba(data);
32    id = tex->id;
33}
34
35
36TransferFunction::~TransferFunction()
37{
38    delete [] data;
39    delete tex;
40}
41
42void TransferFunction::update(float* data)
43{
44    memcpy(this->data, data, sizeof(float) * size);
45
46    tex->update_float_rgba(data);
47}
48
49
Note: See TracBrowser for help on using the repository browser.