Commit Graph

1203 Commits (33b6e5173724ebb207c4d8450a561448b2e07e5d)

Author SHA1 Message Date
whitequark 8af3a933cf Implement SPolygon::TriangulateInto. 2016-08-01 00:48:37 +00:00
whitequark 7f0083aa1d CMake: correctly use if(STREQUAL).
If an operand is a string, it should be quoted to prevent expansion.
This doesn't matter with "GNU", but does with "MSVC" (which expands
to "YES").
2016-08-01 00:48:37 +00:00
whitequark 14cf0e09df Win32: emit dbp() output to stderr as well in Debug builds. 2016-08-01 00:48:37 +00:00
whitequark c83421a2b5 Win32: unbreak window icon. 2016-08-01 00:46:56 +00:00
whitequark d0e32849b2 Fix a typo in Group::DrawFilledPaths. 2016-07-31 11:58:54 +00:00
whitequark 50b2b8adfd Unbreak background image display.
Before this commit, background image was drawn with alpha=0, which
caused it to be not drawn at all. This was an error introduced
during rebasing.
2016-07-31 11:57:46 +00:00
whitequark 613aa8c579 Reimplement 6846010 correctly.
The bug was actually not in ReadPng*, but in WritePng.
2016-07-31 11:57:17 +00:00
whitequark 803665404e Add support for BGR formats to Pixmap, and RGB conversion.
The Cairo image surface backend uses the BGR format for "RGB24"
for some reason, and we need to handle that.
2016-07-25 11:00:07 +00:00
whitequark 6d5d88f01e Fix off-by-one bug in Pixmap::WritePng. 2016-07-25 10:58:25 +00:00
whitequark 6846010416 Fix a flip bug in ReadPngIntoPixmap.
The only user of that was the background image, and it was flipped
again when it was rendered, so the two bugs masked out each other.
This adds a `bool flip` to ReadPng and FromPng, since that's cheap
to do when writing the PNG file, expensive on the pixel arrays,
and sometimes inconvenient in OpenGL due to offsets.
2016-07-25 10:58:03 +00:00
whitequark 0c90cd799d Align normals and workplanes to pixel grid.
They look much sharper and nicer this way, and more similar to 2.0.
2016-07-25 10:56:36 +00:00
whitequark bcd8c3e790 CMake: do not leak solvespace-specific compiler flags.
Before this commit, our warning flags and definitions were leaking
into the vendored dependencies.
2016-07-25 04:22:03 +00:00
whitequark 6607a48357 CMake: refactor inclusion of external libraries.
This commit makes common external packages always be included through
find_package to eliminate differences in variables set, wraps
find_package for vendored libraries on Windows to factor out common
code, and removes miscellaneous useless code elsewhere in dependency
handling.

This also fixes a problem where pkg-config would pick up `build`
libraries instead of `host` when cross-compiling.
2016-07-25 04:22:02 +00:00
whitequark 7265121b24 Refactor GlOffscreen; remove the GLEW dependency.
It was never really needed, since both Linux and OS X, where
GlOffscreen is used, guarantee that the API we need is present,
on all OS versions we're interested in.

Also, reorganize GlOffscreen consistently with the rest of our
codebase, and don't use RAII for OpenGL resource management because
of its requirement for an active context.
2016-07-25 04:21:55 +00:00
whitequark 216091a366 README: clarify binary package situation.
We now build and distribute Windows executables for every release,
so mention that. Conversely, the Debian packages are basically
unusable, so drop them for now.
2016-07-25 04:21:54 +00:00
EvilSpirit 7f411d1593 Unify displayEdges and displayOutlines.
This has the following benefits:
  * Less geometry to generate; we can do both in one pass;
  * Less geometry to draw;
  * Eliminate overdraw of outlines on top of emphasized edges;
  * In future, being able to seamlessly stitch stippled lines.

The contour edges are now also drawn before emphasized edges;
this makes intersections of contour and emphasized edges look better
as the thinner emphasized edge doesn't clobber the depth buffer.
2016-07-23 22:41:16 +00:00
whitequark e7c8c1c8f2 Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
  * It is now possible to port SolveSpace to a later version of
    OpenGL, such as OpenGLES 2, so that it runs on platforms that
    only have that OpenGL version;
  * The majority of geometry is now rendered without references to
    the camera in C++ code, so a renderer can now submit it to
    the video card once and re-rasterize with a different projection
    matrix every time the projection is changed, avoiding expensive
    reuploads;
  * The DOGD (draw or get distance) interface is now
    a straightforward Canvas implementation;
  * There are no more direct references to SS.GW.(projection)
    in sketch rendering code, which allows rendering to multiple
    viewports;
  * There are no more unnecessary framebuffer flips on CPU on Cocoa
    and GTK;
  * The platform-dependent GL code is now confined to rendergl1.cpp.
  * The Microsoft and Apple headers required by it that are prone to
    identifier conflicts are no longer included globally;
  * The rendergl1.cpp implementation can now be omitted from
    compilation to run SolveSpace headless or with a different
    OpenGL version.

Note these implementation details of Canvas:
  * GetCamera currently always returns a reference to the field
    `Camera camera;`. This is so that a future renderer that caches
    geometry in the video memory can define it as asserting, which
    would provide assurance against code that could accidentally
    put something projection-dependent in the cache;
  * Line and triangle rendering is specified through a level of
    indirection, hStroke and hFill. This is so that a future renderer
    that batches geometry could cheaply group identical styles.
  * DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
    This is so that a future renderer into an output format that
    uses 2d transforms (e.g. SVG) could easily derive those.

Some additional internal changes were required to enable this:
  * Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
    This is so that the renderer could cache uploaded textures
    between API calls, which requires it to capture a (weak)
    reference.
  * The PlatformPathEqual function was properly extracted into
    platform-specific code. This is so that the <windows.h> header
    could be included only where needed (in platform/w32* as well
    as rendergl1.cpp).
  * The SBsp{2,3}::DebugDraw functions were removed. They can be
    rewritten using the Canvas API if they are ever needed.

While no visual changes were originally intended, some minor fixes
happened anyway:
  * The "emphasis" yellow line from top-left corner is now correctly
    rendered much wider.
  * The marquee rectangle is now pixel grid aligned.
  * The hidden entities now do not clobber the depth buffer, removing
    some minor artifacts.
  * The workplane "tab" now scales with the font used to render
    the workplane name.
  * The workplane name font is now taken from the normals style.
  * Workplane and constraint line stipple is insignificantly
    different. This is so that it can reuse the existing stipple
    codepaths; rendering of workplanes and constraints predates
    those.

Some debug functionality was added:
  * In graphics window, an fps counter that becomes red when
    rendering under 60fps is drawn.
2016-07-23 22:31:18 +00:00
whitequark bd2da7fe3f GTK3: fix color chooser.
On GTK2, even with a modal grab, mouse button events go through
to the text window. On GTK3 this is not the case.
2016-07-21 08:49:23 +00:00
whitequark 89da072427 GTK3: fix a broken type cast introduced in 66746d1. 2016-07-21 08:48:05 +00:00
whitequark b0d37c1e78 Replace platform-specific GetMilliseconds using std::chrono. 2016-07-21 06:07:46 +00:00
EvilSpirit a4a121694c Reimplement commit 0b999f4 correctly. 2016-07-21 05:45:12 +00:00
EvilSpirit 6e17780e01 Draw projection lines for point-line distance constraints.
This is only visible when the point and line lie within the workplane,
but the constraint label does not.
2016-07-20 07:52:05 +00:00
whitequark ad2371cfae Unix: compatibility with platforms where backtrace() is not in libc.
Also, don't depend on backtrace() when built as libslvs; it is not
the responsbility of the library to use it.
2016-07-19 15:40:52 +00:00
whitequark 8ccc9fe56c When snapping constraints to grid, snap the reference point. 2016-07-19 14:29:25 +00:00
whitequark 8747745a14 Multiply constraint values by scale when pasting with transformation. 2016-07-19 12:12:01 +00:00
whitequark 33e292a6bc Unix: prioritize local resource directory over installed one. 2016-07-19 09:31:58 +00:00
whitequark cbf84a9d2b Unix: don't use argv[0] when determining resource directory.
This makes invocations like this work:
  ~/solvespace/build$ src/solvespace
2016-07-19 09:30:34 +00:00
EvilSpirit 25575b14c7 Allow indexed access to triangle vertices and normals. 2016-06-30 16:40:40 +00:00
EvilSpirit 0b999f4165 Improved outline detection condition.
Before this commit, circles parallel to the camera plane caused
some edges to be randomly marked as outlines.
2016-06-30 16:39:42 +00:00
EvilSpirit 737ff51893 Skip edges with equal L/R normals when calculating outlines. 2016-06-30 16:39:42 +00:00
EvilSpirit 5a2eb9fb50 Allow changing stipple width for default styles.
We already allow changing stipple style, so it makes sense to do
the same for width.
2016-06-30 16:39:27 +00:00
EvilSpirit d0a0a0f8cf Use the same line width for hidden and shown edges, by default. 2016-06-30 16:21:55 +00:00
EvilSpirit 32a2a4dbd9 Fix the "Show degrees of freedom" command.
Before this commit, it never highlighted anything at all.
It was broken when chord tolerance calculation was overhauled.
2016-06-29 16:58:47 +00:00
whitequark da1fc3fd70 DXF: export freehand and zigzag lines as continuous, with a message.
Previously, this resulted in a crash even with no such lines present.
2016-06-29 16:47:23 +00:00
whitequark 131acc5e56 CMake: add a note to packagers about GIT_COMMIT_HASH. 2016-06-28 09:49:37 +00:00
whitequark 21179c2e30 GTK: make Space Navigator actually work.
Before this commit, no events would actually be received.
2016-06-28 09:49:23 +00:00
whitequark a1589401b6 debian: use non-ABI-versioned libpng. 2016-06-26 13:25:33 +00:00
whitequark ced5b78420 Don't crash when hovering one of the predefined workplanes. 2016-06-23 12:10:47 +00:00
whitequark a4e487d298 Don't crash when changing the autosave interval. 2016-06-23 11:56:13 +00:00
whitequark 5c754bd994 Freedesktop: don't hardcode binary path in .desktop file. 2016-06-23 11:25:57 +00:00
whitequark 51f4f27b2b Do not remove autosave after successfully opening file.
If SolveSpace crashes after the open, or hangs and is forcibly
killed, data would be lost. (I lost my data.) Instead, remove
autosave only in two cases: right after a successful save, or right
after a save is declined. This should be completely safe.
2016-06-23 03:00:50 +00:00
whitequark 3a34f63415 Update changelog for 2.2. 2016-06-23 03:00:08 +00:00
whitequark 85cd44df3c Show "Paste" context menu item even when only constraints are copied. 2016-06-20 13:47:14 +00:00
whitequark e0283b2d2e OS X: fix typo in build system. 2016-06-19 19:46:51 +00:00
Thomas Buck fb62e0494b OS X: add 3Dconnexion device support. 2016-06-19 19:25:08 +00:00
whitequark 251948bdbd GTK: don't crash if argv[0]=="solvespace". 2016-06-16 03:05:45 +00:00
whitequark a98cdeeb16 Unix: also install the SolveSpace desktop icon in the xpm format.
This is required by e.g. Debian guidelines.
2016-06-16 02:57:24 +00:00
whitequark 0066f93fb4 Update debian/copyright. 2016-06-16 02:53:43 +00:00
whitequark 3c887d30e3 OS X: find frameworks last.
Before this commit, any available libpng or libfreetype would be
picked, e.g. from Mono.framework. After, homebrew and MacPorts
are prioritized.
2016-06-13 04:15:13 +00:00
whitequark 1dba594949 OS X: sort out window visibility and focus. 2016-06-13 02:08:42 +04:00