-
Notifications
You must be signed in to change notification settings - Fork 0
/
transferfunction1d.h
79 lines (61 loc) · 2 KB
/
transferfunction1d.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* Transfer function based on tutorial from Graphics Runner:
* . http://graphicsrunner.blogspot.com/2009/01/volume-rendering-101.html
* . http://graphicsrunner.blogspot.com/2009/01/volume-rendering-102-transfer-functions.html
*
* Format:
* |interpolation_type // can be "linear" or "cubic"
* |type // 0, 1 or 2
* Next Line based on the type in the previous line
* |max_density[for type = 1, 2] extinction_input[for type = 2]
* |number_of_rgb_values
* |r g b isovalue
* |r g b isovalue
* |...
* |number_of_a_or_t_values
* |a/t isovalue
* |a/t isovalue
* |...
**/
#ifndef VOLREND_TRANSFERFUNCTION1D_H
#define VOLREND_TRANSFERFUNCTION1D_H
#include "transferfunction.h"
#include <vector>
#include <iostream>
#include "glm/glm.hpp"
namespace vr
{
class TransferFunction1D : public TransferFunction
{
public:
TransferFunction1D (int max_value = 255);
~TransferFunction1D ();
virtual const char* GetNameClass ();
virtual glm::vec4 Get (double value, double max_data_value = -1.0);
virtual float GetOpc (double value, double max_input_value = -1.0);
virtual float GetExt (double value, double max_input_value = -1.0);
void SetExtinctionCoefficientInput (bool s);
void AddRGBControlPoint (TransferControlPoint rgb);
void AddAlphaControlPoint (TransferControlPoint alpha);
void ClearControlPoints ();
glm::vec3 GetRGBPointOnSpline (float s);
glm::vec3 GetAlphaPointOnSpline (float s);
//If we don't have a file with the values of the TF, we need to compute the TF
void Build (TFInterpolationType type);
void PrintControlPoints ();
void PrintTransferFunction ();
bool Save ();
bool Load ();
TFInterpolationType m_interpolation_type;
bool m_built;
private:
void BuildLinear ();
std::vector<TransferControlPoint> m_cpt_rgb;
std::vector<TransferControlPoint> m_cpt_alpha;
glm::dvec4* m_transferfunction;
glm::vec3* m_gradients;
int max_density;
bool extinction_coef_type;
};
}
#endif