-
-
Notifications
You must be signed in to change notification settings - Fork 938
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port PrusaSlicer's Measure & Cut gizmos (#2603)
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](https://github.com/SoftFever/OrcaSlicer/assets/1537155/b7ec85d7-1013-4d8e-9914-c2b4d8cb5360) ![image](https://github.com/SoftFever/OrcaSlicer/assets/1537155/1e97d744-99c0-402d-9b23-456d95e07bba) ![image](https://github.com/SoftFever/OrcaSlicer/assets/1537155/f0a5dbea-677a-43f5-918b-c6817ff659c8) Fixes #717 Fixes #1150 Fixes #1590
- Loading branch information
Showing
208 changed files
with
21,650 additions
and
9,664 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#version 110 | ||
|
||
uniform vec4 top_color; | ||
uniform vec4 bottom_color; | ||
|
||
varying vec2 tex_coord; | ||
|
||
void main() | ||
{ | ||
gl_FragColor = mix(bottom_color, top_color, tex_coord.y); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#version 110 | ||
|
||
attribute vec3 v_position; | ||
attribute vec2 v_tex_coord; | ||
|
||
varying vec2 tex_coord; | ||
|
||
void main() | ||
{ | ||
tex_coord = v_tex_coord; | ||
gl_Position = vec4(v_position, 1.0); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#version 110 | ||
|
||
uniform mat4 view_model_matrix; | ||
uniform mat4 projection_matrix; | ||
|
||
attribute vec3 v_position; | ||
|
||
void main() | ||
{ | ||
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 110 | ||
|
||
const vec3 ZERO = vec3(0.0, 0.0, 0.0); | ||
|
||
uniform vec4 uniform_color; | ||
|
||
varying vec3 clipping_planes_dots; | ||
|
||
void main() | ||
{ | ||
if (any(lessThan(clipping_planes_dots, ZERO))) | ||
discard; | ||
|
||
gl_FragColor = uniform_color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#version 110 | ||
|
||
uniform mat4 view_model_matrix; | ||
uniform mat4 projection_matrix; | ||
uniform mat4 volume_world_matrix; | ||
|
||
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane. | ||
uniform vec2 z_range; | ||
// Clipping plane - general orientation. Used by the SLA gizmo. | ||
uniform vec4 clipping_plane; | ||
|
||
attribute vec3 v_position; | ||
|
||
varying vec3 clipping_planes_dots; | ||
|
||
void main() | ||
{ | ||
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded. | ||
vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0); | ||
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z); | ||
|
||
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#version 110 | ||
|
||
uniform sampler2D uniform_texture; | ||
|
||
varying vec2 tex_coord; | ||
|
||
void main() | ||
{ | ||
gl_FragColor = texture2D(uniform_texture, tex_coord); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 110 | ||
|
||
uniform mat4 view_model_matrix; | ||
uniform mat4 projection_matrix; | ||
|
||
attribute vec3 v_position; | ||
attribute vec2 v_tex_coord; | ||
|
||
varying vec2 tex_coord; | ||
|
||
void main() | ||
{ | ||
tex_coord = v_tex_coord; | ||
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0); | ||
} |
Oops, something went wrong.