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

Refactor bevy_mikktspace into idiomatic Rust #4932

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6883f74
Add start of a rewrite
DJMcNab Jun 4, 2022
e27de92
Cleanup `genTangSpace` slightly
DJMcNab Jun 4, 2022
4d93183
Fixup double use of t
DJMcNab Jun 4, 2022
6d01fb4
Migrate to bitflags
DJMcNab Jun 4, 2022
99db5b5
Fix up mixed up flag
DJMcNab Jun 4, 2022
b4ddeec
Use an enum for vertex counts
DJMcNab Jun 4, 2022
84d62cf
Use `impl Geometry` syntax and descope mutable access
DJMcNab Jun 4, 2022
b60fa48
Remove unused deps
DJMcNab Jun 4, 2022
dae89e7
Add some comments
DJMcNab Jun 4, 2022
4eab80c
Update `DegenEpilogue`
DJMcNab Jun 5, 2022
2ad067a
Update GenerateTSpaces
DJMcNab Jun 5, 2022
e20f512
Update `EvalTspace`
DJMcNab Jun 5, 2022
833e2cf
Update `Build4RuleGroups`
DJMcNab Jun 5, 2022
dc044ca
Update InitTriInfo
DJMcNab Jun 5, 2022
bd77441
Update BuildNeighborsFast
DJMcNab Jun 5, 2022
5e545ca
Update DegenPrologue
DJMcNab Jun 5, 2022
226e4e1
Update GenerateSharedVerticesIndexList
DJMcNab Jun 5, 2022
2e7d1b6
Update MergeVertsFast
DJMcNab Jun 5, 2022
58c5dbc
Update GenerateInitialVerticesIndexList
DJMcNab Jun 5, 2022
958ead9
Set iEntries properly
DJMcNab Jun 5, 2022
2083021
Remove unused variables
DJMcNab Jun 6, 2022
2d69723
Re-add asserts
DJMcNab Jun 6, 2022
85f0491
Add some comments
DJMcNab Jun 10, 2022
93d4219
Use a BTreeMap for duplicate detection
DJMcNab Jun 12, 2022
8d9dc67
Comment for the unwrap
DJMcNab Jun 12, 2022
9541c81
Add a `TriangleMap`
DJMcNab Jun 12, 2022
3736c33
Remove some unused code
DJMcNab Jun 17, 2022
4debf94
Replace if zero normalise with normalize_or_zero
DJMcNab Jun 17, 2022
6e8b5e7
Inline `NotZero`
DJMcNab Jun 17, 2022
c49160f
Refactor `BuildNeighborsFast`
DJMcNab Jun 17, 2022
4a5b4d2
Remove some unused code
DJMcNab Jun 19, 2022
0d9cf58
Fixup some comments
DJMcNab Jun 19, 2022
ce31175
Remove an unused mut and unsafe
DJMcNab Jun 19, 2022
cb8ca1b
Refactor `GenerateSharedVerticesIndexList`
DJMcNab Jun 21, 2022
fb4f090
Extract generating the index list into `setup`
DJMcNab Jun 21, 2022
5f4792b
Extract further into modules
DJMcNab Jun 21, 2022
fad05be
Tidy up the output code
DJMcNab Jun 21, 2022
32295ec
Refactor `setup` to not use any unsafety
DJMcNab Jun 21, 2022
c53b21a
Make `DegenPrologue` safe
DJMcNab Jun 22, 2022
e69cea6
Make `DegenEpilogue` safe
DJMcNab Jun 22, 2022
8f094b6
Finish making bevy_mikktspace safe
DJMcNab Jun 23, 2022
425cbee
Make clippy happy
DJMcNab Jun 23, 2022
9e7ff7f
Fix remaining non-case lints
DJMcNab Jun 23, 2022
8c0be14
Fix behaviour changes
DJMcNab Jun 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/bevy_mikktspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
name = "bevy_mikktspace"
version = "0.8.0-dev"
edition = "2021"
authors = ["Benjamin Wasty <[email protected]>", "David Harvey-Macaulay <[email protected]>", "Layl Bongers <[email protected]>"]
authors = [
"Benjamin Wasty <[email protected]>",
"David Harvey-Macaulay <[email protected]>",
"Layl Bongers <[email protected]>",
]
description = "Mikkelsen tangent space algorithm"
documentation = "https://docs.rs/bevy"
homepage = "https://bevyengine.org"
Expand All @@ -12,6 +16,10 @@ keywords = ["bevy", "3D", "graphics", "algorithm", "tangent"]

[dependencies]
glam = "0.20.0"
bitflags = "1.3.2"
# id-arena = "2.2.1"
# smallvec = { version = "1.6", features = ["union"] }
ordered-float = "3.0.0"

[[example]]
name = "generate"
5 changes: 3 additions & 2 deletions crates/bevy_mikktspace/examples/generate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(clippy::bool_assert_comparison, clippy::useless_conversion)]

use bevy_mikktspace::FaceKind;
use glam::{Vec2, Vec3};

pub type Face = [u32; 3];
Expand All @@ -26,8 +27,8 @@ impl bevy_mikktspace::Geometry for Mesh {
self.faces.len()
}

fn num_vertices_of_face(&self, _face: usize) -> usize {
3
fn num_vertices_of_face(&self, _face: usize) -> FaceKind {
FaceKind::Triangle
}

fn position(&self, face: usize, vert: usize) -> [f32; 3] {
Expand Down
Loading