forked from alankzh/MNavigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RenderPropertyGenerator.h
57 lines (39 loc) · 1.31 KB
/
RenderPropertyGenerator.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
#pragma once
#include <map>
#include <vector>
#include "vtkVolumeProperty.h"
class RenderPropertyGenerator
{
public:
struct volumePropertyArgs {
std::vector<double> gradient_opacity_points;
std::vector<double> color_points;
std::vector<double> scalar_opacity_points;
bool is_shade_on;
double specular_power;
double specular;
double ambient;
double diffuse;
int interpolationType;
};
enum ErrorCode
{
kNoError,
kPresetFileNotExist,
kPresetFileParseError,
};
static void ApplyVolumeProperty(std::string property_name, vtkVolumeProperty* const volume_property);
static volumePropertyArgs GetPropertyArgs(vtkVolumeProperty* const volume_property);
//first try to read user configurations, if failed, read the default presets file.
static ErrorCode LoadPresets();
static void AddPropertyPreset(std::string property_name, vtkVolumeProperty* const volume_property);
static void SavePresetsToLocal();
//shift range -1 to 1
static void ShiftRenderFunction(double shift, vtkVolumeProperty* const volume_property, std::string property_name);
static std::vector<std::string> GetAllAvaiblePresetsName();
private:
static std::map<std::string, volumePropertyArgs> volume_property_library_;
static std::string presets_file_path_;
static std::string user_presets_path_;
static void InitFilePath();
};