Commit Graph

1096 Commits (27ac3c7b5f55611980761482d4a0221d30bc27c9)

Author SHA1 Message Date
whitequark 27ac3c7b5f Internationalize the toolbar. 2017-01-05 12:27:28 +00:00
whitequark 529e1bfd63 Internationalize the main menu. 2017-01-05 12:17:09 +00:00
Elvira Khabirova 4f04406121 Implement a gettext .po file parser. 2017-01-05 12:14:40 +00:00
whitequark 387c5c5144 Fix a tearing issue while dragging a new rect.
Before this commit, dragging a new rect would result in one
of the lines lagging behind, because it is drawn in the middle
of regeneration. After this commit, the rectangle stays rectangular.

For a reason I do not understand, this only fixes Win32; GTK
continues to exhibit the bug, whereas Cocoa has never exhibited it
but the render latency seems to have lowered slightly.
2017-01-03 01:47:29 +00:00
whitequark 934f33f4c0 Update zlib, libpng and Freetype submodules to latest versions.
In particular this fixes an issue with the Freetype build system
where re-running CMake would rebuild it from scratch every time.
2017-01-03 01:28:07 +00:00
whitequark c385740087 Fix a dereference of an iterator one past the end. 2017-01-03 01:21:38 +00:00
whitequark 9f697af138 Win32: don't display dialogs for CRT assertions, like for aborts.
Among other annoyances this causes our CI builds to hang infinitely
without any indication in the console.
2017-01-03 01:11:16 +00:00
whitequark 6b8f937894 Win32: fix compatibility with MSVC x64 builds. 2017-01-03 00:52:24 +00:00
whitequark d8932772ef Don't crash when trying to load a non-existent vector/bitmap character. 2017-01-02 23:48:13 +00:00
whitequark 02ab358bd9 Allow the digit group separator, "_", in expressions. 2017-01-02 23:34:36 +00:00
whitequark daf3c7b070 GTK, Win32: always map keypad decimal separator to dot.
We only accept dot as a decimal separator, but the OS locale
may use a comma there.
2017-01-02 23:34:18 +00:00
whitequark f1d4c4a50c README: point to CONTRIBUTING where relevant. 2017-01-02 22:40:36 +00:00
whitequark 2eb934243b README: update Windows version requirement. 2017-01-02 22:24:27 +00:00
whitequark e127b28a2d CMake: allow building the CLI without the GUI. 2017-01-02 22:13:20 +00:00
whitequark 9253e5f229 GTK: update gtkmm dependency.
Pre-3.22 gtkmm doesn't have Gtk::GLArea::set_use_es(), which we
require.
2017-01-02 20:46:18 +00:00
whitequark 6bb73a162c GTK: remove GlWidget, use standard Gtk::GLArea.
This removes a large number of hacks from the codebase, speeds up
the rendering, and removes tearing when dragging entities.
2017-01-02 16:21:05 +00:00
whitequark 7dbbd75969 Drop support for GTK 2.
It's a deprecated platform that has weird OpenGL-related bugs and
is incompatible with using EGL anyway. It was clear we're going
to drop it, the only question was when. Answer: now.
2017-01-02 16:20:12 +00:00
EvilSpirit 25631d4fb2 Choose entities to select in a way appropriate for the operation.
Before this commit, when an entity is clicked at or dragged, and it
shares a place with other entities, which of them is selected is
decided more or less at random. This is particularly annoying when
dragging.

After this commit, when clicking, an entity from the current group
is given preference, and when dragging, an entity from a request
is given preference. This allows e.g. dragging points of a sketch
even when an extrusion of that sketch is active.
2017-01-02 12:21:01 +00:00
Evil-Spirit d99a133982 Do ScheduleGenerateAll in MarkGroupDirty.
This generally simplifies code, and also fixes a bug where adding
a datum point would not regenerate the sketch.
2016-12-26 07:58:00 +00:00
EvilSpirit 9148d0cb91 Force DOF check every time a constraint is added.
Before this commit, it was possible to add some redundant constraints
(e.g. vertical, horizontal or midpoint) without failing the sketch,
because SolveBySubstitution() removed the redundant equations.
However, this could result in the solve failing later because
the system didn't converge, without any pointers as to the true
cause of the failure.
2016-12-21 19:40:33 +00:00
EvilSpirit 10251c6484 In OpenGl2Renderer, do not issue a draw call per DrawVectorText call.
This significantly improves performance with ANGLE.
2016-12-21 18:58:20 +00:00
EvilSpirit 727c0a97dc Draw projected lines for pt-line-distance constraints in 3d. 2016-12-21 18:43:42 +00:00
EvilSpirit 5763972ed8 Don't apply scale twice for text if both height and stroke are in mm. 2016-12-21 18:34:15 +00:00
whitequark 626ffeab1f github: add an ISSUE_TEMPLATE file. 2016-12-13 11:44:31 +00:00
whitequark d6e2ac8328 test: add tests for ExprParser, and fix two crashes. 2016-12-13 11:27:59 +00:00
whitequark 11adaf20b7 README: update Linux dependencies. 2016-12-13 09:57:56 +00:00
whitequark 15571ef58e Fix swapped operands in boolean operators in expression parser. 2016-12-13 09:46:31 +00:00
whitequark 3dd2fc0093 Add CONTRIBUTING.md. 2016-12-10 06:10:23 +00:00
whitequark 435682729e Unix: add FreeBSD compatibility for FindLocalResourceDir(). 2016-12-07 16:02:54 +00:00
whitequark 374d1b5e7f Win32: simplify.
Sanitization done by the removed code is already performed
by CommandLineToArgvW.
2016-12-06 17:32:07 +00:00
whitequark 6fcf1bbe79 Somewhat improve rendering of transparent meshes.
After this commit, any transparent triangles are drawn last, which
causes them to not clobber the depth buffer, and so if they overlap
some opaque triangles, then these opaque triangles will be visible.

There are still issues with overlapping transparent triangles,
and with transparent triangles overlapping outlines and entities.
2016-12-05 03:11:34 +00:00
whitequark 4a0b4fd8d3 Win32: unbreak solvespace-cli.
It was broken because of three bugs:
  * Uninitialized variables in RunCommand;
  * Trying to use (OEM-encoded) main() argc/argv arguments instead
    of GetCommandLineW();
  * Trying to pass relative paths directly into ssfopen.
2016-12-05 01:24:17 +00:00
whitequark 679a1f0ded Win32/MSVC: garbage-collect symbols even in debug builds.
This shrinks debug build binaries by ~1/3.
2016-12-04 20:42:53 +00:00
whitequark d1ddc6ee07 Win32: fix inclusion of manifest, to get back visual styles.
This commit fixes four issues:
  * Instead of WRITE,APPEND, resource.rc was generated using
    WRITE,WRITE, which erased #include <windows.h> and prevented
    any symbolic definitions (like RT_MANIFEST) from working.
    This silently included them using a string type instead,
    which did nothing.
  * WINVER is bumped to Win7, since that's what we target now.
  * Index of RT_MANIFEST is changed to 2, since that's what
    it has to be when ISOLATION_AWARE_ENABLED is defined.
  * Platform is not restricted to X86 in manifest, since there
    is no point in doing so.
2016-12-04 20:33:46 +00:00
whitequark 6989a3d068 CMake: Cairo is required for CLI, not just tests. 2016-12-04 19:05:51 +00:00
Evil-Spirit 3858cbe249 Fix a possible use-after-free in OpenGl2Batch.
IdList could reallocate its storage after we grab an interior
pointer, so just make a copy instead.
2016-12-03 08:22:12 +00:00
whitequark b975380493 Fix refactoring issue in gl2shader.h.
Oops, I accidentally changed the order of fields where I shouldn't
have; add a comment to avoid this in the future.
2016-12-02 11:13:31 +00:00
whitequark 47244c5e89 Implement a command-line interface.
This commit adds a basic command-line interface. This interface
allows rendering thumbnails and exporting data in batch mode.
2016-11-29 04:01:07 +00:00
EvilSpirit dbc567ed89 Reload linked files before upgrading legacy data.
Before this commit, if constraints with newly introduced params were
loaded from a file that linked other files, the upgrade code would
attempt to look up a non-existent entity.
2016-11-28 16:58:31 +00:00
whitequark 9301dec98d Use the same code for loading resources in all executables.
All of our executables need resources; e.g. the vector font is
a resource and it is necessary for generation. Before this commit,
the GUI executable loaded the resources in a nice way, and everything
else did it in a very ad-hoc, fragile way.

After this commit, all executables are placed in <build>/bin and
follow the same algorithm:
  * On Windows, resources are compiled and linked into every
    executable.
  * On Linux, resources are copied into <build>/res (which is
    tried first) and <prefix>/share/solvespace (which is tried
    second).
  * On macOS, resources are copied into <build>/res (which is
    tried first) and <build>/bin/solvespace.app/Contents/Resources
    (which is tried second).

In practice this means that we can add as many executables as we want
without duplicating lots of code. In addition, on macOS, we can
place supplementary executables into the bundle, and they can use
resources from the bundle transparently.
2016-11-28 06:18:42 +00:00
EvilSpirit 7681f6df74 Refactor insertion into BSP tree.
Before this commit, inserting into BSP tree could easily overflow
the stack because we allocate very large stack frames and, on
convex geometries (e.g. a sphere), the BSP tree degenerates into
a "BSP list", thus requiring one large stack frame per triangle.
This can be reproduced by exporting a 2d shaded view of sphere.

After this commit, the stack frames only contan a pointer to
a supplementary data structure, and moreover it only allocates
its fields on demand, conserving heap memory as well.

As a side effect, an arbitrary classifier limit of 50 vertices
is removed.
2016-11-27 21:04:31 +00:00
EvilSpirit d37f53e190 Improve performance of face picking.
This commit implements two improvements. First, it rewrites
SMesh::FirstIntersectionWith() to use an optimal (as currently known)
ray tracing algorithm. Second, it rejects triangles without
an associated face entity outright.
2016-11-27 15:14:10 +00:00
whitequark 7758844f96 Do not re-solve groups that converge but fail rank test.
This partially reverts commit 3a585ea.

We no longer need this because the VectorsParallel() is gone, and
there is no chance of pivoting wrong when solving.
2016-11-27 14:25:53 +00:00
EvilSpirit f5485cbf24 Rewrite equations generated for same-orientation constraints.
This has the same motivations and implementation as in 3d6d873.
2016-11-27 14:25:50 +00:00
EvilSpirit 78d141cf9c Rewrite equations generated for curve-line tangent constraints (in 3d).
This has the same motivations and implementation as in 3d6d873.
2016-11-27 14:25:44 +00:00
EvilSpirit 3d6d873906 Rewrite equations generated for parallel constraints (in 3d).
Before this commit, parallel constraints in 3d are fragile:
constraints that are geometrically fine can end up singular anyway
because VectorsParallel() pivots wrong but converges anyway.
After this commit, much like in cc07058, the constraints are written
in a different form: instead of trying to remove two degrees of
freedom out of three, all three are removed, and one added; namely,
the constraint introduces a free parameter, signed length ratio.
2016-11-27 13:43:48 +00:00
EvilSpirit cc07058e48 Rewrite equations generated for pt-on-line constraints.
Before this commit, pt-on-line constraints are buggy. To reproduce,
extrude a circle, then add a datum point and constrain it to the
axis of the circle, then move it. The cylinder will collapse.

To quote Jonathan:

> On investigation, I (a) confirm that the problem is
> the unconstrained extrusion depth going to zero, and (b) retract
> my earlier statement blaming extrude and other similar non-entity
> parameter treatment for this problem; you can easily reproduce it
> with a point in 3d constrained to lie on any line whose length
> is free.
>
> PT_ON_LINE is written using VectorsParallel, for no obvious reason.
> Rewriting that constraint to work on two projected distances (using
> any two basis vectors perpendicular to the line) should fix that
> problem, since replacing the "point on line in 3d" constraint with
> two "point on line in 2d" constraints works. That still has
> the hairy ball problem of choosing the basis vectors, which you
> can't do with a continuous function; you'd need Vector::Normal()
> or equivalent.
>
> You could write three equations and make the constraint itself
> introduce one new parameter for t. I don't know how well that
> would work numerically, but it would avoid the hairy ball problem,
> perhaps elegant at the cost of speed.

Indeed, this commit implements the latter solution: it introduces
an additional free parameter. The point being coincident with
the start of the line corresponds to the parameter being zero, and
point being coincident with the end corresponds to one).

In effect, instead of constraining two of three degrees of freedom
(for which the equations do not exist because of the hairy ball
theorem), it constrains three and adds one more.
2016-11-26 19:35:38 +00:00
EvilSpirit 8f93136d8a DXF: Import Z coordinate from DXF/DWG files. 2016-11-26 08:25:54 +00:00
whitequark 41365c5f9f DXF: Fix export of wireframe as 3D DXF.
Before this commit, polylines got flattened but all other entities
got exported with the proper Z coordinate. After this commit, all
entities are exported with proper Z coordinate.

Also, instead of exporting LWPOLYLINE (2d only), POLYLINE (2d/3d)
is exported; as a bonus it is more compatible with 3rd party
software, since it is older.
2016-11-26 08:18:14 +00:00
EvilSpirit aaab8a09d4 Fix a crash when extruding TTF text. 2016-11-21 17:35:24 +00:00