00001 #pragma once
00002
00003 #ifndef TRANSFERFUNC_H
00004 #define TRANSFERFUNC_H
00005
00006 #include "Volume.h"
00007 #include "TfpList.h"
00008
00009 #include "ColorChooser.h"
00010 #include "Shaders.h"
00011 #include "common.h"
00012
00016 class TransferFunc
00017 {
00018 public:
00019 TransferFunc(const float _x, const float _y, const float _width, const float _height, const int _numberBars,
00020 Volume *_volume, ColorChooser *_chooserColor, Shaders *_shader);
00021 ~TransferFunc();
00022
00023 void setPointList(TfpList *_pointList);
00024 TfpList* getListPoints();
00025 void render();
00026 bool isTFClicked(const float xWorld, const float yWorld);
00027 void handleClick(const int button, const int state, const float xWorld, const float yWorld);
00028 void updateTFTextureData();
00029
00030 protected:
00031 void initHistogram();
00032 void drawHistogram();
00033 void drawTfpPolynom();
00034 void drawTfPoint(TfPoint* prePoint, TfPoint* point);
00035 void drawDensityDistribution();
00036
00037 private:
00039 float width;
00041 float height;
00043 float x;
00045 float y;
00046
00048 Volume *volume;
00050 TfpList *pointList;
00052 ColorChooser *chooserColor;
00054 Shaders *shader;
00055
00057 int numberBars;
00059 int *histo;
00061 float *logHistHeights;
00063 int maxHisto;
00065 bool pointDragged;
00066
00068 unsigned char* transferTextureData;
00070 GLuint transferTexture;
00071
00072
00073 };
00074 #endif TRANSFERFUNC_H