1 #pragma once 2 3 #include "common/ForwardDecl.h" 4 #include "gui/objects/Color.h" 5 #include "gui/objects/Point.h" 6 #include "objects/geometry/Vector.h" 7 #include "objects/utility/EnumMap.h" 8 #include "objects/wrappers/ExtendedEnum.h" 9 #include "objects/wrappers/Function.h" 10 #include "system/Settings.h" 11 12 NAMESPACE_SPH_BEGIN 13 14 enum class RendererEnum { 15 /// No particle visualization 16 NONE, 17 18 /// 2D section showing particles as points 19 PARTICLE, 20 21 /// Surfaces of bodies are meshed using Marching cubes and drawed as triangles. 22 MESH, 23 24 /// Raymarcher that computes intersections with implicit surface. 25 RAYMARCHER, 26 27 /// Volumetric renderer 28 VOLUME, 29 30 /// Draws contours (iso-lines) of quantities 31 CONTOUR, 32 33 }; 34 35 enum class CameraEnum { 36 ORTHO, 37 PERSPECTIVE, 38 FISHEYE, 39 SPHERICAL, 40 }; 41 42 enum class PlotEnum { 43 /// Evolution of the total internal energy in time 44 INTERNAL_ENERGY = 1 << 0, 45 46 /// Evolution of the total kinetic energy in time 47 KINETIC_ENERGY = 1 << 1, 48 49 /// Evolution of the total energy (sum of total kinetic energy and total internal energy) in time 50 /// \todo Currently does not contain potential energy! 51 TOTAL_ENERGY = 1 << 2, 52 53 /// Evolution of the total momentum in time 54 TOTAL_MOMENTUM = 1 << 3, 55 56 /// Evolution of the total angular momentum in time 57 TOTAL_ANGULAR_MOMENTUM = 1 << 4, 58 59 /// Relative change of total energy 60 RELATIVE_ENERGY_CHANGE = 1 << 5, 61 62 /// Current size-frequency distribution 63 CURRENT_SFD = 1 << 6, 64 65 /// Predicted size-frequency distribution 66 PREDICTED_SFD = 1 << 7, 67 68 /// Speed histogram 69 SPEED_HISTOGRAM = 1 << 8, 70 71 /// Angular histogram (in x-y plane) of velocity directions 72 ANGULAR_HISTOGRAM_OF_VELOCITIES = 1 << 9, 73 74 /// Evolution of the selected quantity for the selected particle in time. 75 SELECTED_PARTICLE = 1 << 10, 76 77 ALL = INTERNAL_ENERGY | KINETIC_ENERGY | TOTAL_ENERGY | TOTAL_MOMENTUM | TOTAL_ANGULAR_MOMENTUM, 78 }; 79 80 enum class BrdfEnum { 81 LAMBERT, 82 PHONG, 83 }; 84 85 enum class ColorMapEnum { 86 LINEAR, 87 LOGARITHMIC, 88 FILMIC, 89 }; 90 91 enum class PaneEnum { 92 RENDER_PARAMS = 1 << 0, 93 PALETTE = 1 << 1, 94 PARTICLE_DATA = 1 << 2, 95 PLOTS = 1 << 3, 96 STATS = 1 << 4, 97 }; 98 99 enum class GuiSettingsId { 100 /// Selected renderer 101 RENDERER, 102 103 CAMERA_TYPE, 104 105 CAMERA_WIDTH, 106 107 CAMERA_HEIGHT, 108 109 CAMERA_POSITION, 110 111 CAMERA_VELOCITY, 112 113 CAMERA_ORBIT, 114 115 CAMERA_TARGET, 116 117 CAMERA_UP, 118 119 /// View field of view (zoom). Special value 0 means the field of view is computed from the bounding box. 120 CAMERA_ORTHO_FOV, 121 122 CAMERA_PERSPECTIVE_FOV, 123 124 CAMERA_CLIP_NEAR, 125 126 CAMERA_CLIP_FAR, 127 128 CAMERA_AUTOSETUP, 129 130 CAMERA_TRACK_PARTICLE, 131 132 CAMERA_TRACK_MEDIAN, 133 134 CAMERA_TRACKING_OFFSET, 135 136 VIEW_WIDTH, 137 138 VIEW_HEIGHT, 139 140 VIEW_MAX_FRAMERATE, 141 142 REFRESH_ON_TIMESTEP, 143 144 /// Size of the grid cell in simulation units (not window units); if zero, no grid is drawn 145 VIEW_GRID_SIZE, 146 147 BACKGROUND_COLOR, 148 149 COLORMAP_TYPE, 150 151 COLORMAP_LOGARITHMIC_FACTOR, 152 153 REDUCE_LOWFREQUENCY_NOISE, 154 155 BLOOM_INTENSITY, 156 157 SHOW_KEY, 158 159 FORCE_GRAYSCALE, 160 161 ANTIALIASED, 162 163 SMOOTH_PARTICLES, 164 165 RENDER_GHOST_PARTICLES, 166 167 /// Displayed radius of particle in units of smoothing length 168 PARTICLE_RADIUS, 169 170 /// Max z-coordinate of particle to be displayed by ortho renderer 171 CAMERA_ORTHO_CUTOFF, 172 173 /// Size of the grid used in MarchingCubes (in code units, not h). 174 SURFACE_RESOLUTION, 175 176 /// Value of iso-surface being constructed; lower value means larget bodies 177 SURFACE_LEVEL, 178 179 /// Direction to the sun used for shading 180 SURFACE_SUN_POSITION, 181 182 /// Intentity of the sun 183 SURFACE_SUN_INTENSITY, 184 185 SURFACE_EMISSION, 186 187 /// Ambient color for surface renderer 188 SURFACE_AMBIENT, 189 190 RAYTRACE_SUBSAMPLING, 191 192 RAYTRACE_ITERATION_LIMIT, 193 194 RAYTRACE_HDRI, 195 196 RAYTRACE_BRDF, 197 198 RAYTRACE_SHADOWS, 199 200 RAYTRACE_SPHERES, 201 202 VOLUME_EMISSION, 203 204 VOLUME_ABSORPTION, 205 206 CONTOUR_SPACING, 207 208 CONTOUR_GRID_SIZE, 209 210 CONTOUR_SHOW_LABELS, 211 212 DEFAULT_COLORIZER, 213 214 DEFAULT_PANES, 215 216 /// Title of the window appearing on taskbar 217 WINDOW_TITLE, 218 219 WINDOW_WIDTH, 220 221 WINDOW_HEIGHT, 222 223 PLOT_INTEGRALS, 224 225 PLOT_INITIAL_PERIOD, 226 227 PLOT_OVERPLOT_SFD, 228 }; 229 230 class GuiSettings : public Settings<GuiSettingsId> { 231 public: 232 using Settings<GuiSettingsId>::Settings; 233 234 Function<void(GuiSettingsId id)> accessor; 235 236 template <typename TValue> get(const GuiSettingsId id)237 INLINE TValue get(const GuiSettingsId id) const { 238 return Settings<GuiSettingsId>::get<TValue>(id); 239 } 240 241 template <typename TValue> set(const GuiSettingsId id,const TValue & value)242 INLINE GuiSettings& set(const GuiSettingsId id, const TValue& value) { 243 Settings<GuiSettingsId>::set(id, value); 244 245 if (accessor) { 246 accessor(id); 247 } 248 return *this; 249 } 250 }; 251 252 template <> 253 INLINE Pixel GuiSettings::get<Pixel>(const GuiSettingsId id) const { 254 const Interval i = this->get<Interval>(id); 255 return Pixel(int(i.lower()), int(i.upper())); 256 } 257 258 template <> 259 INLINE Rgba GuiSettings::get<Rgba>(const GuiSettingsId id) const { 260 const Vector v = this->get<Vector>(id); 261 return Rgba(float(v[X]), float(v[Y]), float(v[Z]), float(v[H])); 262 } 263 264 template <> 265 INLINE GuiSettings& GuiSettings::set<Rgba>(const GuiSettingsId id, const Rgba& color) { 266 this->set(id, Vector(color.r(), color.g(), color.b(), color.a())); 267 return *this; 268 } 269 270 NAMESPACE_SPH_END 271