Skip to content

Commit 76e010d

Browse files
authored
Move bevy_mikktspace out of tree (#19798)
# Objective - Have safe bevy_mikktspace by landing #9050 - Don't have C in-tree Related issues and PRs: - Closes #9050 - Closes #8429 - Fixes #7372 ## Solution - Rebase to main - Remove glam dependency so lock-step update is not necessary anymore - Make it standalone: https://github.com/atlv24/bevy_mikktspace - Transfer to bevy org ## Testing - Test suite made by Layl
1 parent 94ed750 commit 76e010d

File tree

12 files changed

+10
-3537
lines changed

12 files changed

+10
-3537
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ These are generally BSD-like, but exact details vary by crate:
118118
If the README of a crate contains a 'License' header (or similar), the additional copyright notices and license terms applicable to that crate will be listed.
119119
The above licensing requirement still applies to contributions to those crates, and sections of those crates will carry those license terms.
120120
The [license](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) field of each crate will also reflect this.
121-
For example, [`bevy_mikktspace`](./crates/bevy_mikktspace/README.md#license-agreement) has code under the Zlib license (as well as a copyright notice when choosing the MIT license).
122121

123122
The [assets](assets) included in this repository (for our [examples](./examples/README.md)) typically fall under different open licenses.
124123
These will not be included in your game (unless copied in by you), and they are not distributed in the published bevy crates.

crates/bevy_mesh/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bevy_math = { path = "../bevy_math", version = "0.17.0-dev" }
1616
bevy_reflect = { path = "../bevy_reflect", version = "0.17.0-dev" }
1717
bevy_ecs = { path = "../bevy_ecs", version = "0.17.0-dev" }
1818
bevy_transform = { path = "../bevy_transform", version = "0.17.0-dev" }
19-
bevy_mikktspace = { path = "../bevy_mikktspace", version = "0.17.0-dev" }
19+
bevy_mikktspace = { version = "0.17.0-dev" }
2020
bevy_derive = { path = "../bevy_derive", version = "0.17.0-dev" }
2121
bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-features = false, features = [
2222
"std",

crates/bevy_mesh/src/mikktspace.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@ impl bevy_mikktspace::Geometry for MikktspaceGeometryHelper<'_> {
4747
self.uvs[self.index(face, vert)]
4848
}
4949

50-
fn set_tangent_encoded(&mut self, tangent: [f32; 4], face: usize, vert: usize) {
50+
fn set_tangent(
51+
&mut self,
52+
tangent_space: Option<bevy_mikktspace::TangentSpace>,
53+
face: usize,
54+
vert: usize,
55+
) {
5156
let idx = self.index(face, vert);
52-
self.tangents[idx] = tangent;
57+
self.tangents[idx] = tangent_space.unwrap_or_default().tangent_encoded();
5358
}
5459
}
5560

@@ -65,7 +70,7 @@ pub enum GenerateTangentsError {
6570
#[error("the '{0}' vertex attribute should have {1:?} format")]
6671
InvalidVertexAttributeFormat(&'static str, VertexFormat),
6772
#[error("mesh not suitable for tangent generation")]
68-
MikktspaceError,
73+
MikktspaceError(#[from] bevy_mikktspace::GenerateTangentSpaceError),
6974
}
7075

7176
pub(crate) fn generate_tangents_for_mesh(
@@ -113,10 +118,7 @@ pub(crate) fn generate_tangents_for_mesh(
113118
uvs,
114119
tangents,
115120
};
116-
let success = bevy_mikktspace::generate_tangents(&mut mikktspace_mesh);
117-
if !success {
118-
return Err(GenerateTangentsError::MikktspaceError);
119-
}
121+
bevy_mikktspace::generate_tangents(&mut mikktspace_mesh)?;
120122

121123
// mikktspace seems to assume left-handedness so we can flip the sign to correct for this
122124
for tangent in &mut mikktspace_mesh.tangents {

crates/bevy_mikktspace/Cargo.toml

Lines changed: 0 additions & 36 deletions
This file was deleted.

crates/bevy_mikktspace/LICENSE-APACHE

Lines changed: 0 additions & 176 deletions
This file was deleted.

crates/bevy_mikktspace/LICENSE-MIT

Lines changed: 0 additions & 26 deletions
This file was deleted.

crates/bevy_mikktspace/README.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)