17 if (trackedIndex >= 0) {
18 return makeAuto<ParticleTracker>(trackedIndex);
23 return makeAuto<MedianTracker>(offset);
40 if (data.ortho.cutoff.value() == 0._f) {
46 return makeAuto<OrthoCamera>(data);
48 return makeAuto<PerspectiveCamera>(data);
50 return makeAuto<FisheyeCamera>(data);
52 return makeAuto<SphericalCamera>(data);
76 renderer = makeAuto<NullRenderer>();
79 renderer = makeAuto<ParticleRenderer>(settings);
82 renderer = makeAuto<MeshRenderer>(scheduler, settings);
85 renderer = makeAuto<RayMarcher>(scheduler, settings);
88 renderer = makeAuto<VolumeRenderer>(scheduler, settings);
91 renderer = makeAuto<ContourRenderer>(scheduler, settings);
104 return makeAuto<LambertBrdf>(1._f);
106 return makeAuto<PhongBrdf>(1._f);
119 return makeAuto<LogarithmicColorMap>(factor);
122 return makeAuto<FilmicColorMap>();
133 return makeAuto<VelocityColorizer>(
getPalette(
id));
135 return makeAuto<AccelerationColorizer>(
getPalette(
id));
137 return makeAuto<DirectionColorizer>(
Vector(0._f, 0._f, 1._f),
getPalette(
id));
141 return makeAuto<DensityPerturbationColorizer>(
getPalette(
id));
145 return makeAuto<EnergyColorizer>(
getPalette(
id));
147 return makeAuto<TemperatureColorizer>();
149 return makeAuto<StressColorizer>(
getPalette(
id));
151 return makeAuto<YieldReductionColorizer>(
getPalette(
id));
153 return makeAuto<DamageActivationColorizer>(
getPalette(
id));
155 return makeAuto<RadiusColorizer>(
getPalette(
id));
159 return makeAuto<UvwColorizer>();
161 return makeAuto<ParticleIdColorizer>(settings);
163 return makeAuto<ComponentIdColorizer>(
166 return makeAuto<ComponentIdColorizer>(
169 return makeAuto<AggregateIdColorizer>(settings);
173 return makeAuto<MaterialColorizer>(settings);
175 return makeAuto<BeautyColorizer>();
183 return makeAuto<TypedColorizer<Size>>(quantity, std::move(palette));
185 return makeAuto<TypedColorizer<Float>>(quantity, std::move(palette));
187 return makeAuto<TypedColorizer<Vector>>(quantity, std::move(palette));
189 return makeAuto<TypedColorizer<TracelessTensor>>(quantity, std::move(palette));
191 return makeAuto<TypedColorizer<SymmetricTensor>>(quantity, std::move(palette));
251 const float x0 = float(range.
lower());
252 const float dx = float(range.
size());
254 { x0 + 0.2f * dx,
Rgba(0.1f, 0.1f, 0.1f) },
255 { x0 + 0.6f * dx,
Rgba(0.9f, 0.9f, 0.9f) },
256 { x0 + 0.8f * dx,
Rgba(1.f, 1.f, 0.f) },
257 { x0 + dx,
Rgba(0.6f, 0.f, 0.f) } },
265 const float x0 = float(range.
lower());
266 const float dx = float(range.
size());
270 { x0 + 0.001f * dx,
Rgba(0.0f, 0.0f, 0.2f) },
271 { x0 + 0.01f * dx,
Rgba(0.0f, 0.0f, 1.0f) },
272 { x0 + 0.1f * dx,
Rgba(1.0f, 0.0f, 0.2f) },
273 { x0 + dx,
Rgba(1.0f, 1.0f, 0.2f) } },
277 { x0 + 0.001f * dx,
Rgba(0.0f, 0.0f, 0.2f) },
278 { x0 + 0.01f * dx,
Rgba(0.0f, 0.0f, 1.0f) },
279 { x0 + 0.1f * dx,
Rgba(1.0f, 0.0f, 0.2f) },
280 { x0 + dx,
Rgba(1.0f, 1.0f, 0.2f) } },
284 const float pi = float(
PI);
286 { pi / 3.f,
Rgba(1.f, 0.1f, 1.f) },
287 { 2.f * pi / 3.f,
Rgba(1.f, 0.1f, 0.1f) },
288 { 3.f * pi / 3.f,
Rgba(1.f, 1.f, 0.1f) },
289 { 4.f * pi / 3.f,
Rgba(0.1f, 1.f, 0.1f) },
290 { 5.f * pi / 3.f,
Rgba(0.1f, 1.f, 1.f) },
291 { 2.f * pi,
Rgba(0.1f, 0.1f, 1.f) } },
296 { x0 + 0.5f * dx,
Rgba(0.7f, 0.7f, 0.7f) },
297 { x0 + dx,
Rgba(1.f, 0.1f, 0.1f) } },
301 { x0 + 0.01f * dx,
Rgba(0.1f, 0.1f, 0.1f) },
302 { x0 + 0.05f * dx,
Rgba(0.9f, 0.9f, 0.9f) },
303 { x0 + 0.2f * dx,
Rgba(1.f, 1.f, 0.f) },
304 { x0 + dx,
Rgba(0.6f, 0.f, 0.f) } },
308 { x0 + 0.001f * dx,
Rgba(0.1f, 0.1f, 1.f) },
309 { x0 + 0.01f * dx,
Rgba(1.f, 0.f, 0.f) },
310 { x0 + 0.1f * dx,
Rgba(1.0f, 0.6f, 0.4f) },
311 { x0 + dx,
Rgba(1.f, 1.f, 0.f) } },
314 return Palette({ { 0._f,
Rgba(0.1f, 0.1f, 0.1f) }, { 1._f,
Rgba(0.9f, 0.9f, 0.9f) } }, scale);
317 { x0 + 0.5f * dx,
Rgba(0.7f, 0.7f, 0.7f) },
318 { x0 + dx,
Rgba(1.f, 0.1f, 0.1f) } },
322 { x0 + 0.5f * dx,
Rgba(0.7f, 0.7f, 0.7f) },
323 { x0 + dx,
Rgba(1.f, 0.1f, 0.1f) } },
331 { -1.e4f,
Rgba(0.f, 0.f, 0.2f) },
332 { 0.f,
Rgba(0.2f, 0.2f, 0.2f) },
333 { 1.e4f,
Rgba(0.8f, 0.8f, 0.8f) },
334 { 2.e4f,
Rgba(1.f, 1.f, 0.2f) },
335 { x0 + dx,
Rgba(0.5f, 0.f, 0.f) } },
339 { x0 + 0.001f * dx,
Rgba(0.1f, 0.1f, 1.f) },
340 { x0 + 0.01f * dx,
Rgba(1.f, 0.f, 0.f) },
341 { x0 + 0.1f * dx,
Rgba(1.0f, 0.6f, 0.4f) },
342 { x0 + dx,
Rgba(1.f, 1.f, 0.f) } },
346 { x0 + 0.1f * dx,
Rgba(0.9f, 0.9f, 0.9f) },
347 { x0 + 0.25f * dx,
Rgba(1.f, 1.f, 0.2f) },
348 { x0 + 0.5f * dx,
Rgba(1.f, 0.5f, 0.f) },
349 { x0 + dx,
Rgba(0.5f, 0.f, 0.f) } },
357 { x0 + 0.3f * dx,
Rgba(0.3f, 0.3f, 1.f) },
358 { x0 + 0.5f * dx,
Rgba(0.9f, 0.9f, 0.9f) },
359 { x0 + 0.7f * dx,
Rgba(1.f, 0.f, 0.f) },
360 { x0 + dx,
Rgba(1.f, 1.f, 0.f) } },
363 return Palette({ { x0,
Rgba(0.1f, 0.1f, 0.1f) }, { x0 + dx,
Rgba(0.9f, 0.9f, 0.9f) } }, scale);
365 return Palette({ { x0,
Rgba(0.1f, 0.1f, 0.1f) }, { x0 + dx,
Rgba(0.9f, 0.9f, 0.9f) } }, scale);
369 { 0.1f * x0,
Rgba(0.f, 0.f, 0.2f) },
370 { 0.f,
Rgba(0.2f, 0.2f, 0.2f) },
371 { 0.1f * (x0 + dx),
Rgba(0.8f, 0.8f, 0.8f) },
372 { x0 + dx,
Rgba(1.0f, 0.6f, 0.f) } },
377 { 0.01f * dx,
Rgba(0.f, 0.f, 0.2f) },
378 { 0.05f * dx,
Rgba(0.2f, 0.2f, 0.2f) },
379 { 0.2f * dx,
Rgba(0.8f, 0.8f, 0.8f) },
380 { dx,
Rgba(1.0f, 0.6f, 0.f) } },
385 { 0.25f * dx,
Rgba(0.f, 0.f, 0.2f) },
386 { 0.5f * dx,
Rgba(0.2f, 0.2f, 0.2f) },
387 { 0.75f * dx,
Rgba(0.8f, 0.8f, 0.8f) },
388 { dx,
Rgba(1.0f, 0.6f, 0.f) } },
392 const float actDx =
max(dx,
sqrt(3.f) + 0.2f);
393 const float eps = 0.05f;
395 {
sqrt(3.f) - eps,
Rgba(0.9f, 0.9f, 0.9f) },
397 {
sqrt(3.f) + eps,
Rgba(0.9f, 0.9f, 0.9f) },
398 { actDx,
Rgba(0.5f, 0.0f, 0.0f) } },
402 return Palette({ { x0,
Rgba(0.1f, 0.1f, 0.1f) }, { x0 + dx,
Rgba(0.9f, 0.9f, 0.9f) } }, scale);
405 { x0 + 0.5f * dx,
Rgba(0.7f, 0.7f, 0.7f) },
406 { x0 + dx,
Rgba(1.f, 0.1f, 0.1f) } },
410 { x0 + 0.5f * dx,
Rgba(0.7f, 0.7f, 0.7f) },
411 { x0 + dx,
Rgba(1.f, 0.1f, 0.1f) } },
414 return getDefaultPalette(
Interval(x0, x0 + dx));
#define SPH_ASSERT(x,...)
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
Defines projection transforming 3D particles onto 2D screen.
Object converting quantity values of particles into colors.
@ TOTAL_STRESS
Total stress (sigma = S - pI)
@ FLAG
Particles of different bodies are colored differently.
@ COROTATING_VELOCITY
Velocities with a respect to the rotating body.
@ MOVEMENT_DIRECTION
Projected direction of motion.
@ RADIUS
Radii/smoothing lenghts of particles.
@ SUMMED_DENSITY
Density computed from particle masses by direct summation of neighbours.
@ DENSITY_PERTURBATION
Relative difference of density and initial density (rho/rho0 - 1)
@ COMPONENT_ID
Color assigned to each component (group of connected particles)
@ VELOCITY
Particle velocities.
@ YIELD_REDUCTION
Reduction of stress tensor due to yielding (1 - f_vonMises)
@ PARTICLE_ID
Each particle drawn with different color.
@ TOTAL_ENERGY
Sum of kinetic and internal energy for given particle.
@ BOUND_COMPONENT_ID
Color assigned to each group of gravitationally bound particles.
@ DAMAGE_ACTIVATION
Ratio of the stress and the activation strain.
@ BOUNDARY
Shows boundary particles.
@ AGGREGATE_ID
Color assigned to each aggregate.
@ TEMPERATURE
Temperature, computed from internal energy.
@ ACCELERATION
Acceleration of particles.
@ BEAUTY
Attempts to show the real-world look.
@ MATERIAL_ID
Particles with different materials are colored differently.
@ UVW
Shows UV mapping, u-coordinate in red and v-coordinate in blur.
Renderer drawing iso-contours of specified quantity.
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr INLINE T max(const T &f1, const T &f2)
INLINE T sqrt(const T f)
Return a squared root of a value.
constexpr Float PI
Mathematical constants.
Renderer visualizing the surface as triangle mesh.
#define NAMESPACE_SPH_END
const NothingType NOTHING
@ HYBRID
Logarithic scale for values > 1 and < -1, linear scale on interval <-1, 1>
@ LINEAR
Control points are interpolated on linear scale.
@ LOGARITHMIC
Control points are interpolated on logarithmic scale. All points must be positive!
Renderer drawing individual particles as dots.
QuantityMetadata getMetadata(const QuantityId key)
Returns the quantity information using quantity ID.
QuantityId
Unique IDs of basic quantities of SPH particles.
@ BULK_DENSITY
Bulk density, may be lower than the material density.
@ AV_ALPHA
Coefficient alpha of the artificial viscosity. Coefficient beta is always 2*alpha.
@ FLAG
ID of original body, used to implement discontinuities between bodies in SPH.
@ VELOCITY_DIVERGENCE
Velocity divergence.
@ STRAIN_RATE_CORRECTION_TENSOR
Correction tensor used to improve conservation of total angular momentum.
@ DEVIATORIC_STRESS
Deviatoric stress tensor, always a traceless tensor.
@ PRESSURE
Pressure, affected by yielding and fragmentation model, always a scalar quantity.
@ AV_BALSARA
Balsara factor.
@ MOMENT_OF_INERTIA
Moment of inertia of particles, analogy of particle masses for rotation.
@ VELOCITY_GRADIENT
Velocity gradient.
@ ENERGY
Specific internal energy, always a scalar quantity.
@ VELOCITY_ROTATION
Velocity rotation.
@ DENSITY
Density, always a scalar quantity.
@ DELTASPH_DENSITY_GRADIENT
@ MASS
Paricles masses, always a scalar quantity.
@ NEIGHBOUR_CNT
Number of neighbouring particles (in radius h * kernel.radius)
@ SOUND_SPEED
Sound speed, always a scalar quantity.
@ AV_STRESS
Artificial stress by Monaghan .
@ VIBRATIONAL_VELOCITY
Vibrational particle velocity, used by the block model of acoustic fluidization.
@ EPS_MIN
Activation strait rate.
@ VELOCITY_GRADIENT_OF_DIVERGENCE
BasicVector< Float > Vector
Helper type allowing to "derive" from enum class.
Container of key-value pairs.
INLINE TValue get(const GuiSettingsId id) const
Interface defining a camera or view, used by a renderer.
Interface for objects assigning colors to particles.
virtual Optional< Palette > getPalette() const =0
Returns recommended palette for drawing this colorizer.
virtual std::string name() const =0
Returns the name of the colorizer.
virtual void setPalette(const Palette &newPalette)=0
Modifies the palette used by ths colorizer.
Interface used to implement renderers.
virtual void initialize(const Storage &storage, const IColorizer &colorizer, const ICamera &camera)=0
Prepares the objects for rendering and updates its data.
virtual void render(const RenderParams ¶ms, Statistics &stats, IRenderOutput &output) const =0
Draws particles into the bitmap, given the data provided in initialize.
virtual void cancelRender()=0
Stops the rendering if it is currently in progress.
virtual bool isInitialized() const =0
Checks if the renderer has been initialized.
Object representing a 1D interval of real numbers.
INLINE Float lower() const
Returns lower bound of the interval.
INLINE Float size() const
Returns the size of the interval.
INLINE Type & value()
Returns the reference to the stored value.
Represents a color palette, used for mapping arbitrary number to a color.
bool getPalette(const std::string &name, Palette &palette) const
GuiSettings & getGuiSettings()
static const Settings & getDefaults()
\brief Returns a reference to object containing default values of all settings.
Object holding various statistics about current run.
Container storing all quantities used within the simulations.
@ COLORMAP_LOGARITHMIC_FACTOR
@ CAMERA_ORTHO_CUTOFF
Max z-coordinate of particle to be displayed by ortho renderer.
@ RENDERER
Selected renderer.
@ CAMERA_ORTHO_FOV
View field of view (zoom). Special value 0 means the field of view is computed from the bounding box.
@ PARTICLE
2D section showing particles as points
@ MESH
Surfaces of bodies are meshed using Marching cubes and drawed as triangles.
@ RAYMARCHER
Raymarcher that computes intersections with implicit surface.
@ VOLUME
Volumetric renderer.
@ CONTOUR
Draws contours (iso-lines) of quantities.
@ NONE
No particle visualization.
AutoPtr< IColorMap > getColorMap(const GuiSettings &settings)
AutoPtr< IColorizer > getColorizer(const Project &project, const ExtColorizerId id)
AutoPtr< ITracker > getTracker(const GuiSettings &settings)
AutoPtr< IBrdf > getBrdf(const GuiSettings &settings)
Palette getPalette(const ExtColorizerId id)
AutoPtr< IRenderer > getRenderer(const GuiSettings &settings)
AutoPtr< ICamera > getCamera(const GuiSettings &settings, const Pixel size)
SharedPtr< IScheduler > getScheduler(const RunSettings &settings=RunSettings::getDefaults())
@ OVERLAP
Specifies that overlapping particles belong into the same component.
Pixel imageSize
Size of the image.
Parameters of the rendered image.