forked from OrcaSlicer/OrcaSlicer
-
Notifications
You must be signed in to change notification settings - Fork 70
Feature render optimize #463
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
Open
Kenshin627
wants to merge
6
commits into
main
Choose a base branch
from
feature_render_optimize
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bc6d358
[Feat]- Render_Optimize: CPU Frustum culling GLVolume
Kenshin627 f7dfa45
[Feat]: render optimize, glToolBar refactor
Kenshin627 fe0ca05
Merge pull request #462 from Snapmaker/feature_render_optimize_initia…
Kenshin627 5321b00
add some Comments in function extract Frustum from vp-matrix
Kenshin627 9d8b320
delete unnecessary tex_coord assignment
Kenshin627 08831fd
merge from main, synchronize update commits from main
Kenshin627 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| #version 110 | ||
|
|
||
| attribute vec3 v_position; | ||
| attribute vec2 v_tex_coord; | ||
|
|
||
| varying vec2 tex_coord; | ||
|
|
||
| void main() | ||
| { | ||
| tex_coord = v_tex_coord; | ||
| tex_coord = v_position.xy * 0.5 + 0.5; | ||
| gl_Position = vec4(v_position, 1.0); | ||
| } |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| #version 140 | ||
|
|
||
| in vec3 v_position; | ||
| in vec2 v_tex_coord; | ||
|
|
||
| out vec2 tex_coord; | ||
|
|
||
| void main() | ||
| { | ||
| tex_coord = v_tex_coord; | ||
| tex_coord = v_position.xy * 0.5 + 0.5; | ||
| gl_Position = vec4(v_position, 1.0); | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
|
|
||
| #include "libslic3r/BoundingBox.hpp" | ||
| #include "3DScene.hpp" | ||
| #include <array> | ||
| #include "../Utils/Frustum.hpp" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不建议使用相对路径,直接用 #include "Utils/Frustum.hpp" |
||
|
|
||
| namespace Slic3r { | ||
| namespace GUI { | ||
|
|
@@ -56,6 +56,7 @@ struct Camera | |
| std::pair<double, double> m_frustrum_zs; | ||
|
|
||
| BoundingBoxf3 m_scene_box; | ||
| Frustum m_frustum; | ||
|
|
||
| public: | ||
| Camera() { set_default_orientation(); } | ||
|
|
@@ -167,6 +168,17 @@ struct Camera | |
| double max_zoom() const { return 250.0; } | ||
| double min_zoom() const { return 0.2 * calc_zoom_to_bounding_box_factor(m_scene_box); } | ||
|
|
||
| /// <summary> | ||
| /// get the current frustrum planes. The planes are in world space and normalized (the normal vector has unit length). | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| const Frustum& GetFrustum() const { return m_frustum; } | ||
|
|
||
| /// <summary> | ||
| /// extract the planes of the frustrum from the current projection and view matrix and update m_frustrum | ||
| /// </summary> | ||
| void UpdateFrustum(); | ||
|
|
||
| private: | ||
| // returns tight values for nearZ and farZ plane around the given bounding box | ||
| // the camera MUST be outside of the bounding box in eye coordinate of the given box | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
变量名不符合规范