Changeset 830


Ignore:
Timestamp:
Dec 19, 2007 9:19:52 AM (13 years ago)
Author:
vrinside
Message:

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

Location:
trunk/vizservers/nanovis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/vizservers/nanovis/TransferFunction.cpp

    r380 r830  
    1717
    1818#include "TransferFunction.h"
     19#include <memory.h>
    1920
    2021
    21 TransferFunction::TransferFunction(int _size, float* data){
     22TransferFunction::TransferFunction(int _size, float* data)
     23{
     24    tex = new Texture1D(_size, GL_FLOAT);
    2225
    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);
    2430
    25   tex->initialize_float_rgba(data);
    26   id = tex->id;
     31    tex->initialize_float_rgba(data);
     32    id = tex->id;
    2733}
    2834
    2935
    30 TransferFunction::~TransferFunction(){ delete tex; }
     36TransferFunction::~TransferFunction()
     37{
     38    delete [] data;
     39    delete tex;
     40}
    3141
    32 void TransferFunction::update(float* data){
    33   tex->update_float_rgba(data);
     42void TransferFunction::update(float* data)
     43{
     44    memcpy(this->data, data, sizeof(float) * size);
     45
     46    tex->update_float_rgba(data);
    3447}
    3548
  • trunk/vizservers/nanovis/TransferFunction.h

    r776 r830  
    2424class TransferFunction{
    2525  int size;     //the resolution of the color map, how many (RGBA) quadraples
     26  float* data;
    2627  Texture1D* tex; //the texture storing the colors
    2728
     
    3233  void update(float* data);
    3334    Texture1D* getTexture();
     35  float* getData() { return data; }
    3436};
    3537
Note: See TracChangeset for help on using the changeset viewer.