16 bool SsfToPngApp::OnInit() {
17 if (wxTheApp->argc < 2) {
18 std::cout <<
"Usage: ssftopng file.ssf" << std::endl;
23 gui.
set(GuiSettingsId::ORTHO_FOV, 0._f)
24 .
set(GuiSettingsId::ORTHO_VIEW_CENTER, 0.5_f *
Vector(1024, 768, 0))
42 .
set(GuiSettingsId::PERSPECTIVE_TARGET,
Vector(-4.e4, -3.8e4_f, 0._f))
43 .
set(GuiSettingsId::PERSPECTIVE_POSITION,
Vector(-4.e4, -3.8e4_f, 6.e5_f))
44 .
set(GuiSettingsId::ORTHO_PROJECTION, OrthoEnum::XY)
45 .
set(GuiSettingsId::ORTHO_CUTOFF, 0._f)
46 .
set(GuiSettingsId::ORTHO_ZOFFSET, -1.e8_f)
61 params.size =
Pixel(1024, 768);
64 Movie movie(gui, std::move(renderer), std::move(colorizers), std::move(params));
66 const Float totalRotation = 4._f *
PI;
67 const Float step = 0.02_f;
72 std::string file(wxTheApp->argv[1]);
78 const Vector target = gui.
get<
Vector>(GuiSettingsId::PERSPECTIVE_TARGET);
80 for (
Float phi = 0._f; phi < totalRotation; phi += step) {
83 gui.
set(GuiSettingsId::PERSPECTIVE_POSITION,
position);
86 movie.save(storage, stats);
87 std::cout << int(phi * 100 / totalRotation) << std::endl;
89 }
catch (
const std::exception& e) {
90 std::cout <<
"Failed: " << e.what() << std::endl;
95 gui.
set(GuiSettingsId::PERSPECTIVE_TARGET,
Vector(0._f))
96 .
set(GuiSettingsId::PERSPECTIVE_POSITION,
Vector(0._f, 0._f, -6.5e5_f))
97 .
set(GuiSettingsId::PERSPECTIVE_TRACKED_PARTICLE, 201717);
99 const Path dir(std::string(wxTheApp->argv[1]));
105 Path ssf = dir / path;
108 std::cout <<
"Processing " << ssf.
native() << std::endl;
119 params.size =
Pixel(800, 800);
122 Movie movie(gui, std::move(renderer), std::move(colorizers), std::move(params));
133 movie.save(storage, stats);
135 }
catch (
const std::exception& e) {
136 std::cout <<
"Failed: " << e.what() << std::endl;
Defines projection transforming 3D particles onto 2D screen.
Object converting quantity values of particles into colors.
ColorizerId
Special colorizers that do not directly correspond to quantities.
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr Float PI
Mathematical constants.
Periodically saves rendered images to disk.
@ MASS
Paricles masses, always a scalar quantity.
IMPLEMENT_APP(SsfToPngApp)
Implements IScheduler interface using TBB.
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
BasicVector< Float > Vector
INLINE Vector getNormalized(const Vector &v)
Generic dynamically allocated resizable storage.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
INLINE const TError & error() const
Returns the error message.
INLINE TValue get(const GuiSettingsId id) const
INLINE GuiSettings & set(const GuiSettingsId id, const TValue &value)
Exception thrown when file cannot be read, it has invalid format, etc.
Object managing periodic rendering of images and saving them to given paths.
static Optional< Size > getDumpIdx(const Path &path)
Extracts the dump index from given path generated by OutputFile.
Object representing a path on a filesystem.
Path & replaceExtension(const std::string &newExtension)
Changes the extension of the file.
std::string native() const
Returns the native version of the path.
GuiSettings & getGuiSettings()
Object holding various statistics about current run.
Container storing all quantities used within the simulations.
static SharedPtr< Tbb > getGlobalInstance()
@ RAYTRACE_ITERATION_LIMIT
@ IMAGES_NAME
Mask of the image names, having d where the output number will be placed.
@ PARTICLE_RADIUS
Displayed radius of particle in units of smoothing length.
@ SURFACE_RESOLUTION
Size of the grid used in MarchingCubes (in code units, not h).
@ RENDERER
Selected renderer.
@ SURFACE_LEVEL
Value of iso-surface being constructed; lower value means larget bodies.
@ SURFACE_SUN_INTENSITY
Intentity of the sun.
@ IMAGES_SAVE
If true, rendered images are saved to disk.
@ SURFACE_SUN_POSITION
Direction to the sun used for shading.
@ SURFACE_AMBIENT
Ambient color for surface renderer.
AutoPtr< IColorizer > getColorizer(const Project &project, const ExtColorizerId id)
AutoPtr< IRenderer > getRenderer(const GuiSettings &settings)
AutoPtr< ICamera > getCamera(const GuiSettings &settings, const Pixel size)
DirectoryAdapter iterateDirectory(const Path &directory)
Vector position(const Float a, const Float e, const Float u)
Computes the position on the elliptic trajectory.
Parameters of the rendered image.
AutoPtr< ICamera > camera
Camera used for rendering.