Commit Graph

815 Commits (b4e1ce44e8cd9a5220bb25d2b251ee769b7a1f68)

Author SHA1 Message Date
phkahler b4e1ce44e8 Use OpenMP for triangulation 2020-05-09 13:54:52 -04:00
phkahler 7baf58588b No message if cached points to don't converge. Quiet the terminal. 2020-05-08 22:18:30 -04:00
phkahler a7e0a174e3 Don't create redundant edges in UvGridTriangulate into. 2020-05-08 13:24:36 -04:00
phkahler a52d88bc3d Less work in AssembleContour 2020-05-06 18:38:58 -04:00
phkahler 88a0e55f35 Eliminate infinite loop AssemblePolygon 2020-05-06 18:38:58 -04:00
phkahler 7366a6c53d
Bernstein polynomials with no branching. (#591) 2020-05-02 14:56:50 -04:00
phkahler f36ac500a1
Add rotated face from point entity type. Fixes issue 585, problems constraining to Revolve and Helix ends. (#586) 2020-04-24 17:37:55 -04:00
phkahler 700b5d6719
Allow Revolve and Helix end surface selection and constraints. (#584) 2020-04-22 19:55:18 -04:00
phkahler 45eb246865
Eliminate some entity copies in lathe groups. Eliminates a crash due to copy numbers going over 1000. May break some older files with constaints on lathed entities. (#582) 2020-04-21 00:44:27 -04:00
phkahler b55dac7620
Don't create extra copies of entities in Revolve and Helix groups.
Might break some older files with those groups that depend on these
extra entities.

Fixes #549.
2020-04-21 01:24:33 +00:00
Ryan Pavlik e51fdf6fba Use handles instead of pointers in GenerateAll(). NFC. 2020-04-20 18:37:03 +00:00
Tim 72635df56e
Add menu options for line styles / view / configuration.
This is to make them a bit easier to find, since the natural place
to look for config options is somewhere like File->Preferences or
Edit->Settings.
2020-04-01 21:25:18 +00:00
Tim 647171017a
Fix more segfaults in mouse.cpp lambdas (#574)
This changes all the lambdas to have explicit captures, since the use of
implicit captures has led to some memory errors, especially segfaults in
the right-click menu.

I'm not 100% sure that the code is correct anyway - it really needs auditing
to ensure all referenced values are still valid when the menu item is clicked
(e.g. can you change stuff with keyboard shortcuts while the context menu is
visible?), but it should at least be *more* correct!
2020-03-29 01:46:34 +00:00
Tim 485fd012b4
Fix segfault in Remove Spline Point context menu
This was incorrectly capturing `r` by reference and using it after it left
its scope. Changed to  capture by value, and also explicitly capture `this`
in case we were accidentally capturing any other scope variables by reference.

Fixes #571
2020-03-28 15:28:12 +00:00
phkahler f7b6f6930e
Nurbs (#473)
* Limit u,v range between 0 and 1 in Newton. Fixes issue #471
* Change the math for projecting a point onto a plane to work better with non-orthogonal U,V derivatives in several places. Fixes #472.
2020-03-27 15:40:58 -04:00
Roc a6c34bb44d
Fix a crash when trying to show an error with bad separator.
For example, a single dot or colon at the end of the error string.
2020-03-12 23:03:26 +00:00
nabijaczleweli 6017ecdacc Fix two trivial implicit double to int conversion warnings. NFC 2020-03-08 16:33:55 +00:00
ruevs fcb2757d5d Win32: Drastically reduce stack usage at startup. NFC?
See:
https://github.com/solvespace/solvespace/issues/92#issuecomment-567831112

The problem was first introduced here:
dabd57847e

and later "fixed" here:
f324477dd0
by setting the stack size to /STACK:33554432

Solvespace now starts up even with /STACK:554432

According to this:
https://en.cppreference.com/w/cpp/language/value_initialization
```
"2) if T is a class type with a default constructor that is neither user-provided nor deleted (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and then it is default-initialized if it has a non-trivial default constructor; "
```
So removing the `{}` should leave both the `System` and `TextWindow` class instances properly initialized.
2020-02-24 08:41:45 +00:00
ruevs 8ef3cacc33 Fix a bug with 3Dconnexion: SpaceMouse
A warning found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314)
is an actual bug. How does the SpaceMouse (I do not have one) work at all when the global `hSpaceWareDriverClass` is NULL?!

.\src\platform\guiwin.cpp(1392,34): warning C4459: declaration of 'hSpaceWareDriverClass' hides global declaration
.\src\platform\guiwin.cpp(1389,13): message : see declaration of 'SolveSpace::Platform::hSpaceWareDriverClass'
2020-02-20 14:03:31 +00:00
ruevs f6a774d7bf Fix some trivial warnings found by MSVC. NFC.
Found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314)

A bunch of implicit casts 'double' to 'float' and one 'int64_t' to 'unsigned'.

.\src\platform\guiwin.cpp(1237): warning C4701: potentially uninitialized local variable 'cursorName' used
.\src\platform\guiwin.cpp(1237): warning C4703: potentially uninitialized local pointer variable 'cursorName' used

.\src\solvespace.cpp(805,30): warning C4456: declaration of 'gs' hides previous local declaration
.\src\solvespace.cpp(715,17): message : see declaration of 'gs'

.\src\solvespace.cpp(849,47): warning C4456: declaration of 'e' hides previous local declaration
.\src\solvespace.cpp(847,29): message : see declaration of 'e'

.\src\render\render.h(288,51): warning C4458: declaration of 'camera' hides class member
.\src\render\render.h(271,17): message : see declaration of 'SolveSpace::SurfaceRenderer::camera'

.\src\render\render.h(289,57): warning C4458: declaration of 'lighting' hides class member
.\src\render\render.h(272,17): message : see declaration of 'SolveSpace::SurfaceRenderer::lighting'
2020-02-20 14:03:31 +00:00
Koen Schmeets 3ed1719de2
Fix immediate editing of reference constraints.
Before this commit, if immediate editing of constraints was enabled,
then when adding a reference constraint, an editor was incorrectly
opened.
2020-02-05 05:34:33 +00:00
ruevs 16c5fa6889 Fix eight trivial "implicit conversion 'double' to 'int'" warnings. NFC. 2019-12-17 19:35:44 +00:00
whitequark 64c0f62b92 Win32: mark all remaining functions as Unicode. NFC.
Some were missing the *W suffix.
2019-12-06 15:21:51 +00:00
Koen Schmeets 0472b9ea60 macOS: fix tooltips not closing on Catalina. 2019-11-27 12:51:27 +00:00
Koen Schmeets dcdfdec564 Add an option to edit dimension immediately after adding. 2019-11-26 22:34:53 +00:00
Koen Schmeets 58f23aa061 macOS: force show property browser when opening preferences from menu. 2019-11-26 20:31:14 +00:00
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 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
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 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