Commit Graph

891 Commits

Author SHA1 Message Date
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
whitequark
afafa5ec2e Three.js: allow to configure projRight/projUp.
Also, use a more appealing isometric projection if none specified,
instead of orthographic.

Also, use the scale, offset and projection from the viewport at
the time of export.
2016-06-11 23:13:59 +00:00
whitequark
44223ea332 Three.js: correctly handle browser zoom.
Before this commit, controls went wild on zoom ratios other than 1:1,
and the rendering wasn't too good either.
2016-06-11 23:13:59 +00:00
whitequark
a425395fe3 Add CHANGELOG.md. 2016-06-11 23:13:59 +00:00
whitequark
f8f5095b3d Fix copyright. 2016-06-11 23:13:59 +00:00
whitequark
de6be52293 Fix disabling of autoconstrainter via Ctrl. 2016-06-11 23:13:59 +00:00
whitequark
215b8e4537 Unbreak importing files in the same directory as current file.
This commit fixes a bug introduced in commit 0d7aa0a1.
2016-06-06 17:48:45 +00:00
whitequark
122920d3ee Cocoa: allow dismissing Message/Error NSAlerts using Escape key. 2016-06-03 00:07:30 +00:00
whitequark
14cbd0bbee Cocoa, Win32: embed version info into distributable application.
This shows up in crash dumps, etc, and helps track them back to
a git commit.
2016-06-03 00:07:30 +00:00
Twisted Pair in my Hair
66746d151f GTK: make some dubious implicit type conversions explicit. 2016-05-31 15:40:27 +00:00
whitequark
682bfa2732 Add STL begin()/end() functions to List and IdList.
This will allow us to use it in the C++11 foreach loop, as well
as simplify use of STL <algorithms>.
2016-05-29 14:14:38 +00:00
whitequark
a4e7dea9e3 Remove "generating group 1/10" status message during generation.
It's broken. It expects a valid OpenGL context during generation
that immediately pushes changes to the screen. This is never true
on non-Windows as offscreen rendering is used, and also incompatible
with OpenGL core profile.

Further, right now it displays junk on Windows as well due to some
issue with the bitmap font texture loading.

We will restore it later, in a saner form.
2016-05-27 11:41:17 +00:00
whitequark
faa84c61cf Add SHORT_DASH stipple pattern. 2016-05-27 11:41:17 +00:00