Changeset 830 for trunk/vizservers
- Timestamp:
- Dec 19, 2007 9:19:52 AM (16 years ago)
- Location:
- trunk/vizservers/nanovis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vizservers/nanovis/TransferFunction.cpp
r380 r830 17 17 18 18 #include "TransferFunction.h" 19 #include <memory.h> 19 20 20 21 21 TransferFunction::TransferFunction(int _size, float* data){ 22 TransferFunction::TransferFunction(int _size, float* data) 23 { 24 tex = new Texture1D(_size, GL_FLOAT); 22 25 23 tex = new Texture1D(_size, GL_FLOAT); 26 // _size : # of slot, 4 : rgba 27 size = _size * 4; 28 this->data = new float[size]; 29 memcpy(this->data, data, sizeof(float) * size); 24 30 25 tex->initialize_float_rgba(data);26 id = tex->id;31 tex->initialize_float_rgba(data); 32 id = tex->id; 27 33 } 28 34 29 35 30 TransferFunction::~TransferFunction(){ delete tex; } 36 TransferFunction::~TransferFunction() 37 { 38 delete [] data; 39 delete tex; 40 } 31 41 32 void TransferFunction::update(float* data){ 33 tex->update_float_rgba(data); 42 void TransferFunction::update(float* data) 43 { 44 memcpy(this->data, data, sizeof(float) * size); 45 46 tex->update_float_rgba(data); 34 47 } 35 48 -
trunk/vizservers/nanovis/TransferFunction.h
r776 r830 24 24 class TransferFunction{ 25 25 int size; //the resolution of the color map, how many (RGBA) quadraples 26 float* data; 26 27 Texture1D* tex; //the texture storing the colors 27 28 … … 32 33 void update(float* data); 33 34 Texture1D* getTexture(); 35 float* getData() { return data; } 34 36 }; 35 37
Note: See TracChangeset
for help on using the changeset viewer.