CalcMySky  v0.3.1
types.hpp
1 #ifndef INCLUDE_ONCE_845F48B0_96A7_4917_936D_B8A24F58D657
2 #define INCLUDE_ONCE_845F48B0_96A7_4917_936D_B8A24F58D657
3 
4 #include <QObject>
5 #include <QString>
6 
7 #include "util.hpp"
8 
9 enum class PhaseFunctionType
10 {
11  General,
12  Achromatic,
13  Smooth,
14 };
15 
16 inline QString toString(PhaseFunctionType type)
17 {
18  switch(type)
19  {
20  case PhaseFunctionType::General: return "general";
21  case PhaseFunctionType::Achromatic: return "achromatic";
22  case PhaseFunctionType::Smooth: return "smooth";
23  }
24  return QString("bad type %1").arg(static_cast<int>(type));
25 }
26 
27 inline PhaseFunctionType parsePhaseFunctionType(QString const& type, QString const& filename, const int lineNumber)
28 {
29  if(type=="general") return PhaseFunctionType::General;
30  if(type=="achromatic") return PhaseFunctionType::Achromatic;
31  if(type=="smooth") return PhaseFunctionType::Smooth;
32  throw ParsingError(filename, lineNumber, QObject::tr("bad phase function type %1").arg(type));
33 }
34 
35 enum SingleScatteringRenderMode
36 {
37  SSRM_ON_THE_FLY,
38  SSRM_PRECOMPUTED,
39 
40  SSRM_COUNT
41 };
42 constexpr const char* singleScatteringRenderModeNames[SSRM_COUNT]={"on-the-fly", "precomputed"};
43 inline QString toString(SingleScatteringRenderMode mode) { return singleScatteringRenderModeNames[mode]; }
44 
45 
46 #endif
Definition: util.hpp:67