Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port PrusaSlicer's Measure & Cut gizmos #2603

Merged
merged 107 commits into from
Nov 19, 2023
Merged

Conversation

Noisyfox
Copy link
Collaborator

@Noisyfox Noisyfox commented Nov 4, 2023

Build on top of #2520 and replaces it.

This PR includes:

  • Rewrite the opengl rendering code, which now renders (almost) everything using shaders instead of legacy opengl function calls
  • Rewriting the gizmo mouse handling code that moves the mouse handling coding into each gizmo themselves
  • Rewriting the mouse picking code, now it uses ray casting to figure out what's under the mouse cursor
  • Porting of the PrusaSlicer's measure tool
  • Replacing existing cuting tool with the better one PrusaSlicer has
  • Updating of other gizmos using PrusaSlicer's latest code base

There was a plan to also port PrusaSlicer's emboss & svg tools, but this PR is already very big and the changes needed for emboss will be even bigger and might take forever to finish. So I decided to separate them so we can get something out and start rolling out testing builds for people to play with as soon as possible.

This was developed mainly using Windows, be prepared it could have graphic issue under Linux & macOS.

Huge credit to Prusa for their amazing job!

image
image
image

Fixes #717
Fixes #1150
Fixes #1590

enricoturri1966 and others added 30 commits November 4, 2023 11:41
- only 2 gizmo use cone

(cherry picked from commit prusa3d/PrusaSlicer@3c7390e)
(cherry picked from commit 4647fc4)
1) allow for custom vertex data layout

2) allow for custom index data format

3) allow for any OpenGL primitive type

(cherry picked from commit prusa3d/PrusaSlicer@afcac6e)
…nd texture rendering

Tech ENABLE_GLBEGIN_GLEND_REMOVAL - A few fixes in layers editing profile rendering

(cherry picked from commit prusa3d/PrusaSlicer@a939d8e)
(cherry picked from commit prusa3d/PrusaSlicer@8c807db)
…er from 3DBed.hpp and replaced with GLModel

(cherry picked from commit prusa3d/PrusaSlicer@6b04142)
…ay with GLModel - GLGizmoFlatten::PlaneData::vbo

(cherry picked from commit prusa3d/PrusaSlicer@ffa3a1d)
…mat in dependence of data size, where possible

(cherry picked from commit prusa3d/PrusaSlicer@4d2d77e)
…ostly unused, to avoid wasting GPU memory. Use a shared GLModel for Gizmos inheriting from GLGizmoPainterBase. Initialization of GLModels moved from constructor to render methods

(cherry picked from commit prusa3d/PrusaSlicer@e3d5cd4)
…ay with GLModel:

TriangleSelectorGUI::m_iva_enforcers

TriangleSelectorGUI::m_iva_blockers

TriangleSelectorGUI::m_iva_seed_fills

TriangleSelectorGUI::m_varrays

GLGizmoPainterBase::s_sphere

(cherry picked from commit prusa3d/PrusaSlicer@8916a00)
…ur from GLGizmoPainterBase.hpp/.cpp and replaced with GLModel

(cherry picked from commit prusa3d/PrusaSlicer@df3d670)
…ay with GLModel: MeshClipper::m_vertex_array

(cherry picked from commit prusa3d/PrusaSlicer@be69227)
…ay with GLModel: GLVolume geometry + removed class GLIndexedVertexArray from codebase

(cherry picked from commit prusa3d/PrusaSlicer@1eac357)
…e_arc():

Tech ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL - Fix in GLModel::render()

(cherry picked from commit prusa3d/PrusaSlicer@2379588)
@Noisyfox
Copy link
Collaborator Author

Noisyfox commented Nov 10, 2023

No juice. Dark theme is fixed but the crashing continues. I even tried to compile the slicer on my PC as I used to do, neither master of SoftFever branches compile. Usually, when I cannot compile the slicer on my PC, something is off, unless those branches aren't ready and I need to fetch a 1.7.0 branch or something ( sorry I am not a developer and hate coding )

Also, the file GLCanvas3D.cpp seems to be a lot different from master. I am totally noob when it comes to windowing on Linux, I will see if I can find out what is wrong.

Peek 2023-11-09 09-33

I think the crash has been fixed now. Your gif really helps, thanks!

…ing part to other side

+ Added check objects after cut
+ CutUtils: Ensuring that volumes start with solid parts after solid parts merging for proper slicing

(cherry picked from commit prusa3d/PrusaSlicer@a9410ed)
@HakunMatat4
Copy link

@Noisyfox yup, beautiful. Out of curiosity, what was causing that?
I might start using this one now as my main one.

@Noisyfox
Copy link
Collaborator Author

Noisyfox commented Nov 11, 2023

@Noisyfox yup, beautiful. Out of curiosity, what was causing that? I might start using this one now as my main one.

I have to write some extra code to support plate selection as well as mouse interaction with those 6 icons next to the bed, and I made a few mistakes there. It failed to release the mouse detector when creating new projects and caused the crash. Linux Mint does something slightly differently which triggers the issue.

@Noisyfox Noisyfox added this to the 1.9.0 milestone Nov 16, 2023
@Noisyfox Noisyfox added the enhancement New feature or request label Nov 16, 2023
@discip
Copy link
Contributor

discip commented Nov 18, 2023

@Noisyfox

  1. Thank you very much for being persistent in getting this done! 😃👍🏻

    The toolbar looks much nicer now.
    Although in my opinion it appears to be blurrier compared to the current look. 😅

  2. Also, I encountered what igiannakas mentioned earlier on:

Transparency on the model when browsing layers seems to not be too transparent :) Personally I am not a fan of the model outline but that's a taste thing I suppose.

Latest commit:
image
image

Current state:
image
image

@SoftFever
Copy link
Owner

It looks all good.
@Noisyfox Thanks for the fantastic work!

For any issues, let's use ticket to track them and discord to discuss

@SoftFever SoftFever merged commit e9f519d into SoftFever:main Nov 19, 2023
12 checks passed
@cpasoft
Copy link

cpasoft commented Nov 19, 2023

I love it... thanks @Noisyfox. I agree, you've done a fantastic work...

@Noisyfox Noisyfox deleted the dev/gizmo branch November 19, 2023 12:27
@SoftFever
Copy link
Owner

@Noisyfox

  1. Thank you very much for being persistent in getting this done! 😃👍🏻

    The toolbar looks much nicer now.
    Although in my opinion it appears to be blurrier compared to the current look. 😅
  2. Also, I encountered what igiannakas mentioned earlier on:

Transparency on the model when browsing layers seems to not be too transparent :) Personally I am not a fan of the model outline but that's a taste thing I suppose.

Latest commit: image image

Current state: image image

Looks like the shading effect was not turn off for the transparent mode.

@Noisyfox
Copy link
Collaborator Author

Yeah I'm working on this issue right now.

@igiannakas
Copy link
Contributor

Hey @Noisyfox I've been getting a crash when closing the application on MacOS - ARM64 build consistently. I think it's related to this PR as it is triggered by the below with the m_objects_model being a null pointer which is used in the WX framework. I've tried debugging it but have failed miserably...

ObjectList::~ObjectList()
{
delete m_objects_model;
}

@igiannakas
Copy link
Contributor

Crash log attached.
Crash Log.txt

@@ -304,6 +310,7 @@ ObjectList::ObjectList(wxWindow* parent) :

ObjectList::~ObjectList()
{
delete m_objects_model;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is causing crash when closing the application. Hence probably why the original BBL code did not have the destructor invoked.

@igiannakas
Copy link
Contributor

I've opened a tiny PR to remove that line but feel that this is just a workaround, unless there is something upstream that can be debugged - #2904

@igiannakas igiannakas mentioned this pull request Dec 5, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: viewport zoom % and/or measuring tool Ruler [FEATURE REQUEST] Measure tool