Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

114
vendor/bevy_mikktspace/examples/cube.obj vendored Normal file
View File

@@ -0,0 +1,114 @@
v 0.5 -0.5 0.5
v 0.5 -0.5 -0.5
v 0.5 0.5 -0.5
v 0.5 0.5 0.5
v 0.5 0 0
v -0.5 0.5 0.5
v -0.5 0.5 -0.5
v -0.5 -0.5 -0.5
v -0.5 -0.5 0.5
v -0.5 0 0
v 0.5 0.5 0.5
v 0.5 0.5 -0.5
v -0.5 0.5 -0.5
v -0.5 0.5 0.5
v 0 0.5 0
v -0.5 -0.5 0.5
v -0.5 -0.5 -0.5
v 0.5 -0.5 -0.5
v 0.5 -0.5 0.5
v 0 -0.5 0
v -0.5 0.5 0.5
v -0.5 -0.5 0.5
v 0.5 -0.5 0.5
v 0.5 0.5 0.5
v 0 0 0.5
v 0.5 0.5 -0.5
v 0.5 -0.5 -0.5
v -0.5 -0.5 -0.5
v -0.5 0.5 -0.5
v 0 0 -0.5
vn 0.57735026 -0.57735026 0.57735026
vn 0.57735026 -0.57735026 -0.57735026
vn 0.57735026 0.57735026 -0.57735026
vn 0.57735026 0.57735026 0.57735026
vn 1 0 0
vn -0.57735026 0.57735026 0.57735026
vn -0.57735026 0.57735026 -0.57735026
vn -0.57735026 -0.57735026 -0.57735026
vn -0.57735026 -0.57735026 0.57735026
vn -1 0 0
vn 0.57735026 0.57735026 0.57735026
vn 0.57735026 0.57735026 -0.57735026
vn -0.57735026 0.57735026 -0.57735026
vn -0.57735026 0.57735026 0.57735026
vn 0 1 0
vn -0.57735026 -0.57735026 0.57735026
vn -0.57735026 -0.57735026 -0.57735026
vn 0.57735026 -0.57735026 -0.57735026
vn 0.57735026 -0.57735026 0.57735026
vn 0 -1 0
vn -0.57735026 0.57735026 0.57735026
vn -0.57735026 -0.57735026 0.57735026
vn 0.57735026 -0.57735026 0.57735026
vn 0.57735026 0.57735026 0.57735026
vn 0 0 1
vn 0.57735026 0.57735026 -0.57735026
vn 0.57735026 -0.57735026 -0.57735026
vn -0.57735026 -0.57735026 -0.57735026
vn -0.57735026 0.57735026 -0.57735026
vn 0 0 -1
vt 0 0
vt 0 1
vt 1 1
vt 1 0
vt 0.5 0.5
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 0.5 0.5
vt 0 0
vt 0 1
vt 0 1
vt 0 0
vt 0 0.5
vt 0 0
vt 0 1
vt 0 1
vt 0 0
vt 0 0.5
vt 0 0
vt 0 1
vt 1 1
vt 1 0
vt 0.5 0.5
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 0.5 0.5
f 1/1/1 2/2/2 5/5/5
f 2/2/2 3/3/3 5/5/5
f 3/3/3 4/4/4 5/5/5
f 4/4/4 1/1/1 5/5/5
f 6/6/6 7/7/7 10/10/10
f 7/7/7 8/8/8 10/10/10
f 8/8/8 9/9/9 10/10/10
f 9/9/9 6/6/6 10/10/10
f 11/11/11 12/12/12 15/15/15
f 12/12/12 13/13/13 15/15/15
f 13/13/13 14/14/14 15/15/15
f 14/14/14 11/11/11 15/15/15
f 16/16/16 17/17/17 20/20/20
f 17/17/17 18/18/18 20/20/20
f 18/18/18 19/19/19 20/20/20
f 19/19/19 16/16/16 20/20/20
f 21/21/21 22/22/22 25/25/25
f 22/22/22 23/23/23 25/25/25
f 23/23/23 24/24/24 25/25/25
f 24/24/24 21/21/21 25/25/25
f 26/26/26 27/27/27 30/30/30
f 27/27/27 28/28/28 30/30/30
f 28/28/28 29/29/29 30/30/30
f 29/29/29 26/26/26 30/30/30

View File

@@ -0,0 +1,266 @@
//! This example demonstrates how to generate a mesh.
#![allow(
clippy::bool_assert_comparison,
clippy::useless_conversion,
reason = "Crate auto-generated with many non-idiomatic decisions. See #7372 for details."
)]
#![expect(clippy::print_stdout, reason = "Allowed in examples.")]
use glam::{Vec2, Vec3};
type Face = [u32; 3];
#[derive(Debug)]
struct Vertex {
position: Vec3,
normal: Vec3,
tex_coord: Vec2,
}
struct Mesh {
faces: Vec<Face>,
vertices: Vec<Vertex>,
}
fn vertex(mesh: &Mesh, face: usize, vert: usize) -> &Vertex {
let vs: &[u32; 3] = &mesh.faces[face];
&mesh.vertices[vs[vert] as usize]
}
impl bevy_mikktspace::Geometry for Mesh {
fn num_faces(&self) -> usize {
self.faces.len()
}
fn num_vertices_of_face(&self, _face: usize) -> usize {
3
}
fn position(&self, face: usize, vert: usize) -> [f32; 3] {
vertex(self, face, vert).position.into()
}
fn normal(&self, face: usize, vert: usize) -> [f32; 3] {
vertex(self, face, vert).normal.into()
}
fn tex_coord(&self, face: usize, vert: usize) -> [f32; 2] {
vertex(self, face, vert).tex_coord.into()
}
fn set_tangent_encoded(&mut self, tangent: [f32; 4], face: usize, vert: usize) {
println!(
"{face}-{vert}: v: {v:?}, vn: {vn:?}, vt: {vt:?}, vx: {vx:?}",
face = face,
vert = vert,
v = vertex(self, face, vert).position,
vn = vertex(self, face, vert).normal,
vt = vertex(self, face, vert).tex_coord,
vx = tangent,
);
}
}
fn make_cube() -> Mesh {
struct ControlPoint {
uv: [f32; 2],
dir: [f32; 3],
}
let mut faces = Vec::new();
let mut ctl_pts = Vec::new();
let mut vertices = Vec::new();
// +x plane
{
let base = ctl_pts.len() as u32;
faces.push([base, base + 1, base + 4]);
faces.push([base + 1, base + 2, base + 4]);
faces.push([base + 2, base + 3, base + 4]);
faces.push([base + 3, base, base + 4]);
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [1.0, -1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [1.0, -1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [1.0, 1.0],
dir: [1.0, 1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [1.0, 0.0],
dir: [1.0, 1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.5, 0.5],
dir: [1.0, 0.0, 0.0],
});
}
// -x plane
{
let base = ctl_pts.len() as u32;
faces.push([base, base + 1, base + 4]);
faces.push([base + 1, base + 2, base + 4]);
faces.push([base + 2, base + 3, base + 4]);
faces.push([base + 3, base, base + 4]);
ctl_pts.push(ControlPoint {
uv: [1.0, 0.0],
dir: [-1.0, 1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [1.0, 1.0],
dir: [-1.0, 1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [-1.0, -1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [-1.0, -1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.5, 0.5],
dir: [-1.0, 0.0, 0.0],
});
}
// +y plane
{
let base = ctl_pts.len() as u32;
faces.push([base, base + 1, base + 4]);
faces.push([base + 1, base + 2, base + 4]);
faces.push([base + 2, base + 3, base + 4]);
faces.push([base + 3, base, base + 4]);
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [1.0, 1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [1.0, 1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [-1.0, 1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [-1.0, 1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 0.5],
dir: [0.0, 1.0, 0.0],
});
}
// -y plane
{
let base = ctl_pts.len() as u32;
faces.push([base, base + 1, base + 4]);
faces.push([base + 1, base + 2, base + 4]);
faces.push([base + 2, base + 3, base + 4]);
faces.push([base + 3, base, base + 4]);
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [-1.0, -1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [-1.0, -1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [1.0, -1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [1.0, -1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 0.5],
dir: [0.0, -1.0, 0.0],
});
}
// +z plane
{
let base = ctl_pts.len() as u32;
faces.push([base, base + 1, base + 4]);
faces.push([base + 1, base + 2, base + 4]);
faces.push([base + 2, base + 3, base + 4]);
faces.push([base + 3, base, base + 4]);
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [-1.0, 1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [-1.0, -1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [1.0, 1.0],
dir: [1.0, -1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [1.0, 0.0],
dir: [1.0, 1.0, 1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.5, 0.5],
dir: [0.0, 0.0, 1.0],
});
}
// -z plane
{
let base = ctl_pts.len() as u32;
faces.push([base, base + 1, base + 4]);
faces.push([base + 1, base + 2, base + 4]);
faces.push([base + 2, base + 3, base + 4]);
faces.push([base + 3, base, base + 4]);
ctl_pts.push(ControlPoint {
uv: [1.0, 0.0],
dir: [1.0, 1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [1.0, 1.0],
dir: [1.0, -1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 1.0],
dir: [-1.0, -1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.0, 0.0],
dir: [-1.0, 1.0, -1.0],
});
ctl_pts.push(ControlPoint {
uv: [0.5, 0.5],
dir: [0.0, 0.0, -1.0],
});
}
for pt in ctl_pts {
let p: Vec3 = pt.dir.into();
let n: Vec3 = p.normalize();
let t: Vec2 = pt.uv.into();
vertices.push(Vertex {
position: (p / 2.0).into(),
normal: n.into(),
tex_coord: t.into(),
});
}
Mesh { faces, vertices }
}
fn main() {
let mut cube = make_cube();
let ret = bevy_mikktspace::generate_tangents(&mut cube);
assert_eq!(true, ret);
}