-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add navigation cube #1573
Merged
Merged
Add navigation cube #1573
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0ffdf28
rendering cube infastructure
erenoku cce6511
cube can rotate
erenoku b09f840
add translation add scale for the navigation cube
erenoku d0fedbd
fix mirrored texture
erenoku 0335700
fix aspect ratio of navigation cube changing when the window is resized
erenoku 9151e80
fix issues and add borders to the edges of the cube
erenoku ad3b426
add navigation cube
erenoku 095f12d
minor change in documentation
erenoku e4e8e15
cleanup
erenoku 3f86c02
Fix new clippy lint
erenoku dc8476b
convert to using thiserror instead of anyhow
erenoku cec4a37
embed assets into the binary
erenoku de6bd37
Use a perspective camera to render the navigation cube
erenoku 533f6c2
Rename model_matrix to mvp_matrix
erenoku 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,62 @@ | ||
# Blender 3.4.1 MTL File: 'cube.blend' | ||
# www.blender.org | ||
|
||
newmtl bottom | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd bottom.png | ||
|
||
newmtl front | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd front.png | ||
|
||
newmtl left | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd left.png | ||
|
||
newmtl rear | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd rear.png | ||
|
||
newmtl right | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd right.png | ||
|
||
newmtl top | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd top.png |
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,51 @@ | ||
# Blender 3.4.1 | ||
# www.blender.org | ||
mtllib cube.mtl | ||
o Cube | ||
v 1.000000 1.000000 1.000000 | ||
v 1.000000 -1.000000 1.000000 | ||
v -1.000000 1.000000 1.000000 | ||
v -1.000000 -1.000000 1.000000 | ||
v 1.000000 1.000000 -1.000000 | ||
v 1.000000 -1.000000 -1.000000 | ||
v -1.000000 1.000000 -1.000000 | ||
v -1.000000 -1.000000 -1.000000 | ||
vn -0.0000 1.0000 -0.0000 | ||
vn -1.0000 -0.0000 -0.0000 | ||
vn -0.0000 -0.0000 -1.0000 | ||
vn -0.0000 -1.0000 -0.0000 | ||
vn -0.0000 -0.0000 1.0000 | ||
vn 1.0000 -0.0000 -0.0000 | ||
vt 0.999900 0.000100 | ||
vt 0.999900 0.999900 | ||
vt 0.000100 0.999900 | ||
vt 0.999900 0.999900 | ||
vt 0.999900 0.000100 | ||
vt 0.000100 0.000100 | ||
vt 0.000100 0.000100 | ||
vt 0.999900 0.999900 | ||
vt 0.000100 0.999900 | ||
vt 0.999900 0.000100 | ||
vt 0.000100 0.999900 | ||
vt 0.000100 0.000100 | ||
vt 0.000100 0.999900 | ||
vt 0.999900 0.999900 | ||
vt 0.000100 0.000100 | ||
vt 0.999900 0.000100 | ||
vt 0.000100 0.999900 | ||
vt 0.999900 0.999900 | ||
vt 0.999900 0.000100 | ||
vt 0.000100 0.000100 | ||
s 0 | ||
usemtl top | ||
f 1/1/1 5/14/1 7/17/1 3/7/1 | ||
usemtl left | ||
f 4/10/2 3/8/2 7/17/2 8/20/2 | ||
usemtl front | ||
f 2/5/5 1/2/5 3/9/5 4/12/5 | ||
usemtl right | ||
f 6/16/6 5/14/6 1/3/6 2/6/6 | ||
usemtl rear | ||
f 8/19/3 7/18/3 5/13/3 6/15/3 | ||
usemtl bottom | ||
f 6/16/4 2/4/4 4/11/4 8/20/4 |
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.
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
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
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,59 @@ | ||
pub struct Assets<'a> { | ||
pub cube_obj: &'a [u8], | ||
pub cube_mtl: &'a [u8], | ||
pub front_texture: &'a [u8], | ||
pub right_texture: &'a [u8], | ||
pub rear_texture: &'a [u8], | ||
pub left_texture: &'a [u8], | ||
pub top_texture: &'a [u8], | ||
pub bottom_texture: &'a [u8], | ||
} | ||
|
||
impl<'a> Assets<'a> { | ||
pub fn get_instance() -> Self { | ||
let cube_obj: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/cube.obj"); | ||
let cube_mtl: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/cube.mtl"); | ||
let front_texture: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/front.png"); | ||
let right_texture: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/right.png"); | ||
let rear_texture: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/rear.png"); | ||
let left_texture: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/left.png"); | ||
let top_texture: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/top.png"); | ||
let bottom_texture: &[u8] = | ||
include_bytes!("../../../assets/navigation_cube/bottom.png"); | ||
|
||
Self { | ||
cube_obj, | ||
cube_mtl, | ||
front_texture, | ||
right_texture, | ||
rear_texture, | ||
left_texture, | ||
top_texture, | ||
bottom_texture, | ||
} | ||
} | ||
|
||
pub fn get_asset(&self, file_name: &str) -> &[u8] { | ||
match file_name { | ||
"cube.obj" => self.cube_obj, | ||
"cube.mtl" => self.cube_mtl, | ||
"front.png" => self.front_texture, | ||
"right.png" => self.right_texture, | ||
"rear.png" => self.rear_texture, | ||
"left.png" => self.left_texture, | ||
"top.png" => self.top_texture, | ||
"bottom.png" => self.bottom_texture, | ||
_ => unreachable!( | ||
"An unknown asset: {} is trying to be loaded", | ||
file_name | ||
), | ||
} | ||
} | ||
} |
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
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.
I think the naming of this module and some of the types in it is not ideal. It makes sense when viewed in isolation, but in the larger context of Fornjot, it could be confusing. Someone might search for the code that draws CAD models, and then think they found it here.
It's not a critical issue, and I don't have any better ideas right now. Just making a note, hoping that someone will come with with something better at some point.