Commit Graph

1493 Commits

Author SHA1 Message Date
Koen Schmeets
552fe354aa Fix commit 07992cecaa. 2019-11-26 14:34:30 +00:00
whitequark
0501f0c99e Don't call GL functions in OpenGl3Renderer::GetIdent.
GetIdent is called from an UI event callback, at which point there
might well not be an active GL context. Before this commit, that
would return a NULL pointer and result in a crash.
2019-11-26 11:23:37 +00:00
whitequark
22525e6515 CMake: update policy to 3.11.
In particular this enables linking with GLVND on Linux by default.
2019-11-26 11:23:37 +00:00
whitequark
07992cecaa Remove unused offscreen GL renderer.
This was used for Gtk 2 and old macOS, but all of those use direct
rendering now.
2019-11-26 11:23:37 +00:00
Maximilian Federle
a60d4df179 Refactor Travis config
- Fix invalid osx_image xcode8.2
- Drop depreceated sudo keyword
- Run debian build on bionic image & re-enable building with ui
- Split build into separate jobs & stages for better separation of concerns
2019-11-26 07:58:20 +00:00
whitequark
fb536a155d Test for -ffile-prefix-map support instead of comparing versions.
Comparing versions is not viable because Apple clang has its own
versioning scheme which is also undocumented.
2019-11-24 18:55:46 +00:00
whitequark
690f87cf4a On GNU-compatible compilers, avoid embedding paths into binaries.
This is helpful for reproducible builds, and also makes it easier
to debug binaries built on another system.
2019-11-23 16:57:35 +00:00
whitequark
14e095c93a Don't show unusable fonts in font selector.
Before this commit, certain fonts (e.g. Terminus) would appear in
the selector but cause a crash (assertion failure) if they are used.
After this commit, we make sure all preconditions are met before
showing a font there.

Also, improve error reporting to always print font filename.
2019-11-23 16:17:01 +00:00
whitequark
e74137dc67 Fix misuse of glTexImage2D (again).
This was originally changed in 74aa80b6, but the fix broke stipping
because it incorrectly changed the logic. Revert that, and just make
the textures smaller instead.
2019-11-23 15:56:57 +00:00
Ryan Pavlik
2fe17a46c2 Remove prototype for an unimplemented function. 2019-11-23 15:35:51 +00:00
Ryan Pavlik
38f42871c7 Remove an integer cast. 2019-11-23 15:35:39 +00:00
Ryan Pavlik
93184c54ac Use standard std::count_if. NFC. 2019-11-23 15:35:29 +00:00
whitequark
8c750cef9c Freeze the scrollbar while editor is open in property browser.
Before this commit, the scrollbar would move freely, without changing
the position of the viewport. It would be reset after editing is
finished.
2019-11-23 15:34:52 +00:00
whitequark
f0359556d8 Recompute property browser viewport on resize.
Before this commit, resizing the property browser would cut off
the rows at the bottom, or else add black space, until next refresh.

This could be perhaps more elegantly done by adding an onResize event
but given that each of them would be followed by onRender anyway, it
seems there's no benefit to adding onResize.
2019-11-23 15:04:31 +00:00
whitequark
54015b6777 Call glGetError() after glFinish(), not glFlush().
As I understand it, both glGetError() and glFinish() are serializing
and blockig, so it makes more sense to call them at the same time.
glFlush() does not block.
2019-11-23 14:50:19 +00:00
Thomas Roughton
9b61f988be macOS: Don't use offscreen rendering.
Since Catalina or earlier this no longer causes artifacts when Cocoa
controls are overlaid on a GL layer. Conversely, offscreen rendering
is very slow, especially on HiDPI screens.

Co-Authored-By: Koen Schmeets <hello@koenschmeets.nl>
2019-11-23 14:50:18 +00:00
Ryan A. Pavlik
e386d405d6 Make some arguments const/const references, where possible. NFC.
Found and suggested by clang-tidy.May help performance by reducing copies,
depending on frequency of call, etc.
2019-11-23 14:07:31 +00:00
whitequark
65d0bdffdb Split Canvas::FinishFrame out of Canvas::FlushFrame.
When drawing the graphics window, we flush it twice: once to draw
the geometry, and another time to draw the UI overlay (toolbar,
selection marquee, and FPS counter). Calling glFinish() each time
is (on most platforms) just pointlessly slow, but on macOS Catalina,
without offscreen rendering, it causes the toolbar to flicker.

Instead of calling glFinish() twice per frame in that case, call
glFlush() twice and then glFinish() once we really are done.
2019-11-23 13:35:16 +00:00
ruevs
ec3056773e Simplify UNION and DIFFERENCE boolean operations.
Union and difference are optimized by replacing the expression
  (!inShell && !inFace)
which is equivqlent to
  (!inShell && !inSame && !inOpp)
with
  outSide
which is equivalent, since SShell::Class::OUTSIDE is the only remaining possibility.
2019-11-23 13:22:15 +00:00
Koen Schmeets
b5ccf5acf5 macOS: fix CMake Xcode generator.
This is done by setting `CMAKE_RUNTIME_OUTPUT_DIRECTORY` to `$<1:${CMAKE_BINARY_DIR}/bin>`
2019-11-23 13:20:45 +00:00
Koen Schmeets
0dcc8f3369 Fix Xcode auto-fixable issues 2019-11-23 13:08:22 +00:00
whitequark
74aa80b645 Fix misuse of glTexImage2D.
Per the OpenGL documentation:
> GL_INVALID_VALUE may be generated if level is greater than
> log2(max), where max is the returned value of GL_MAX_TEXTURE_SIZE.

Although we always passed `log2(max) + 1` as `level`, for some reason
none of the GL implementations we run on ever returned an error.
It also appears there is a bug in ANGLE that crashes the process
instead in this case if the C++ runtime performs bound checks on
vector::operator[]=.
2019-11-22 02:11:10 +00:00
phkahler
5d78f993ce Make helix origin create a line even if it's in a different group.
Helix should always make a line for the axis.
2019-09-20 01:09:58 +00:00
phkahler
162897eca7 Reimplement DivPivoting as DivProjected.
The old implementation was an approximation, whereas the new one is exact.
2019-09-20 01:09:25 +00:00
EvilSpirit
7f9117b2bf Calculate area of selected faces, if any. 2019-09-11 10:38:10 +00:00
EvilSpirit
915f55aabc Show volume of current group alongside total volume. 2019-09-11 10:38:10 +00:00
Ryan Pavlik
a0e992374d Clean up virtual, override, default, and void params. NFC.
Found by clang-tidy.
2019-09-11 10:31:07 +00:00
Ryan Pavlik
ae417fc14c Use emplace_back. NFC.
Found by clang-tidy.
2019-09-11 10:31:07 +00:00
Ryan Pavlik
34dccbf935 Don't call static methods through an instance. NFC.
Found by clang-tidy.
2019-09-11 10:31:07 +00:00
Maximilian Federle
219df31c53 Linux: add support for building snap packages. 2019-09-11 10:12:53 +00:00
Ryan Pavlik
b1e280e75f Fix undefined behavior in IdList::end(). 2019-09-11 09:44:30 +00:00
Ryan Pavlik
ec13839c92 Modify clang-format config to avoid single-line things. NFC. 2019-09-11 09:43:03 +00:00
Ryan Pavlik
bedea1ef3c Avoid undefined behavior from out-of-range access. NFC. 2019-09-10 06:44:34 +00:00
Ryan Pavlik
b8ee0e941b Remove extraneous semicolon. NFC. 2019-09-10 06:44:34 +00:00
Ryan Pavlik
78819ffca3 Fix "virtual function without virtual destructor" warning. NFC. 2019-09-10 06:44:34 +00:00
Ryan Pavlik
c959af1149 Fix a comment. NFC.
Found by clang-tidy.
2019-09-10 06:44:34 +00:00
Ryan Pavlik
3e566d7e67 Remove std::move from trivially-copyable types. NFC.
Found by clang-tidy
2019-09-10 06:44:34 +00:00
Ryan Pavlik
c0904e2ba8 Use IsEmpty() or .empty() to check if a container is empty. NFC.
Most found by clang-tidy.
2019-09-10 04:22:21 +00:00
Ryan Pavlik
61c0167ad7 Fix TTF iteration in case of an empty list. 2019-09-10 04:22:07 +00:00
Ryan Pavlik
15838dc5a1 For loop cleanup. NFC. 2019-09-10 04:21:57 +00:00
Ryan Pavlik
231dff6cd9 Add and use List::Last(). NFC. 2019-09-10 04:20:38 +00:00
whitequark
c5f3cd151a Use the same @todo hot comment style everywhere. 2019-09-10 04:07:42 +00:00
Ryan Pavlik
d514a26f92 Fix use-after-free in revolve and helix.
Pointers get invalidated if a list has to be re-allocated.
CopyEntity can do that.
2019-09-10 04:07:42 +00:00
Ryan A. Pavlik
a4c0022815 Fix a warning about a virtual destructor. 2019-09-10 03:33:05 +00:00
Ryan A. Pavlik
43b2261e9c CLI/testsuite: do not crash if a dialog is displayed. 2019-09-10 03:23:31 +00:00
phkahler
22e4011cb6 use std::vector in helix operations instead of fixed length array. Remove limit on number of sections. Delete definition of Revolved struct. 2019-08-25 14:30:37 +00:00
phkahler
e22c522c81 use std::vector in lathe operations instead of fixed length array 2019-08-25 14:30:37 +00:00
phkahler
2dd50d0f3a Only allow lathe, revolve and helix for 2d sketches. 2019-08-25 14:30:37 +00:00
Ryan Pavlik
13820bf27d Revert "IdList::RemoveTagged switch to std::remove_if from iteration. NFC."
This reverts commit 0bb6a348e3.
2019-08-20 23:28:43 +00:00
Ryan Pavlik
b284e80785 Improve NextAfter. NFC. 2019-08-20 15:57:11 +00:00