VAPOR3 3.9.4
VolumeParams.h
Go to the documentation of this file.
1#pragma once
2
4#include <vapor/DataMgr.h>
5#include <vapor/STLUtils.h>
6
7namespace VAPoR {
8
10public:
11 enum class Type { Any, DVR, Iso };
12
14 VolumeParams(DataMgr *dataMgr, ParamsBase::StateSave *ssave, std::string classType);
16 virtual ~VolumeParams();
17
18 virtual string GetDefaultAlgorithmName() const;
19
20 virtual bool GetDefaultLightingEnabled() const { return true; }
21 virtual double GetDefaultPhongAmbient() const { return 0.6; }
22 virtual double GetDefaultPhongDiffuse() const { return 0.5; }
23 virtual double GetDefaultPhongSpecular() const { return 0.1; }
24 virtual double GetDefaultPhongShininess() const { return 0.2; }
25
26 static string GetClassType() { return ("VolumeParams"); }
27
30 std::string GetAlgorithm() const;
31
34 void SetAlgorithm(std::string algorithm);
35
36 void SetAlgorithmByUser(std::string algorithm);
39 static std::vector<float> GetSamplingRateMultiples();
40
44
48
49 using RenderParams::GetIsoValues;
50 using RenderParams::SetIsoValues;
51 vector<double> GetIsoValues(const string &variable) override;
52 void SetIsoValues(const string &variable, const vector<double> &values) override;
53
56 void SetLightingEnabled(bool v);
57
60 bool GetLightingEnabled() const;
61
64 void SetPhongAmbient(float v);
65
68 float GetPhongAmbient() const;
69
72 void SetPhongDiffuse(float v);
73
76 float GetPhongDiffuse() const;
77
80 void SetPhongSpecular(float v);
81
84 float GetPhongSpecular() const;
85
88 void SetPhongShininess(float v);
89
92 float GetPhongShininess() const;
93
95 //
96 virtual size_t GetRenderDim() const override { return (3); }
97
99 virtual string GetActualColorMapVariableName() const override
100 {
101 if (GetAlgorithm() == OSPVolmeAlgorithmName)
102 return GetVariableName();
103 else if (GetValueLong(UseColormapVariableTag, 0))
104 return GetColorMapVariableName();
105 else
106 return GetVariableName();
107 }
108
109 static const std::vector<std::string> GetAlgorithmNames(Type type = Type::Any);
110 static void Register(const std::string &name, Type type = Type::Any);
111
112private:
113 void _init();
114
115 struct AlgorithmEntry {
116 const std::string name;
117 const Type type;
118 bool operator==(const VolumeParams::AlgorithmEntry &b) { return std::tie(name, type) == std::tie(b.name, b.type); }
119 };
120 static std::vector<AlgorithmEntry> _algorithms;
121
122 static const std::string _algorithmWasManuallySetByUserTag;
123 static const std::string _isoValuesTag;
124 static const std::string _enabledIsoValuesTag;
125
126public:
127 static const std::string _algorithmTag;
128
130 static const std::string UseColormapVariableTag;
131 static const std::string SamplingRateMultiplierTag;
132
136 static const std::string VolumeDensityTag;
137
138 static const std::string LightingEnabledTag;
139 static const std::string PhongAmbientTag;
140 static const std::string PhongDiffuseTag;
141 static const std::string PhongSpecularTag;
142 static const std::string PhongShininessTag;
143
144 static const std::string OSPDensity;
145 static const std::string OSPSampleRateScalar;
146 static const std::string OSPAmbientLightIntensity;
147 static const std::string OSPDirectionalLightIntensity;
148
149 static const std::string OSPVolmeAlgorithmName;
150};
151
152}; // namespace VAPoR
A cache based data reader.
Definition: DataMgr.h:110
State capture class.
Definition: ParamsBase.h:62
A Params subclass for managing parameters used by Renderers.
Definition: RenderParams.h:43
float GetPhongAmbient() const
long GetSamplingMultiplier() const
static string GetClassType()
Definition: VolumeParams.h:26
void SetAlgorithm(std::string algorithm)
vector< double > GetIsoValues(const string &variable) override
static const std::string OSPVolmeAlgorithmName
Definition: VolumeParams.h:149
void SetPhongShininess(float v)
virtual double GetDefaultPhongShininess() const
Definition: VolumeParams.h:24
void SetSamplingMultiplier(long d)
static const std::string PhongSpecularTag
Definition: VolumeParams.h:141
void SetPhongSpecular(float v)
void SetIsoValues(const string &variable, const vector< double > &values) override
virtual string GetDefaultAlgorithmName() const
virtual double GetDefaultPhongSpecular() const
Definition: VolumeParams.h:23
float GetPhongDiffuse() const
bool GetAlgorithmWasManuallySetByUser() const
void SetPhongAmbient(float v)
virtual double GetDefaultPhongDiffuse() const
Definition: VolumeParams.h:22
std::string GetAlgorithm() const
static const std::string UseColormapVariableTag
If this is enabled, the volume opacity will be controlled by the main variable while the colormapping...
Definition: VolumeParams.h:130
static const std::vector< std::string > GetAlgorithmNames(Type type=Type::Any)
VolumeParams(DataMgr *dataMgr, ParamsBase::StateSave *ssave, XmlNode *node)
virtual size_t GetRenderDim() const override
Definition: VolumeParams.h:96
static const std::string PhongAmbientTag
Definition: VolumeParams.h:139
static void Register(const std::string &name, Type type=Type::Any)
virtual bool GetDefaultLightingEnabled() const
Definition: VolumeParams.h:20
VolumeParams(DataMgr *dataMgr, ParamsBase::StateSave *ssave, std::string classType)
static const std::string SamplingRateMultiplierTag
Definition: VolumeParams.h:131
VolumeParams(DataMgr *dataMgr, ParamsBase::StateSave *ssave)
static const std::string OSPDensity
Definition: VolumeParams.h:144
virtual string GetActualColorMapVariableName() const override
Definition: VolumeParams.h:99
static const std::string LightingEnabledTag
Definition: VolumeParams.h:138
static const std::string OSPAmbientLightIntensity
Definition: VolumeParams.h:146
void SetLightingEnabled(bool v)
void SetAlgorithmWasManuallySetByUser(bool v)
static const std::string _algorithmTag
Definition: VolumeParams.h:127
static const std::string OSPSampleRateScalar
Definition: VolumeParams.h:145
static std::vector< float > GetSamplingRateMultiples()
float GetPhongShininess() const
virtual double GetDefaultPhongAmbient() const
Definition: VolumeParams.h:21
float GetPhongSpecular() const
virtual ~VolumeParams()
static const std::string VolumeDensityTag
Definition: VolumeParams.h:136
void SetAlgorithmByUser(std::string algorithm)
bool GetLightingEnabled() const
void SetPhongDiffuse(float v)
static const std::string PhongDiffuseTag
Definition: VolumeParams.h:140
static const std::string OSPDirectionalLightIntensity
Definition: VolumeParams.h:147
static const std::string PhongShininessTag
Definition: VolumeParams.h:142
An Xml tree.
Definition: XmlNode.h:49
#define PARAMS_API
Definition: common.h:77