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

[Merged by Bors] - Fix IcoSphere UV coordinates #1871

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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: 5 additions & 5 deletions crates/bevy_render/src/mesh/shape/icosphere.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ impl From<Icosphere> for Mesh {
);
}
let generated = IcoSphere::new(sphere.subdivisions, |point| {
let inclination = point.z.acos();
let azumith = point.y.atan2(point.x);
let inclination = point.y.acos();
let azimuth = point.z.atan2(point.x);

let norm_inclination = 1.0 - (inclination / std::f32::consts::PI);
let norm_azumith = (azumith / std::f32::consts::PI) * 0.5;
let norm_inclination = inclination / std::f32::consts::PI;
let norm_azimuth = 0.5 - (azimuth / std::f32::consts::TAU);

[norm_inclination, norm_azumith]
[norm_azimuth, norm_inclination]
});

let raw_points = generated.raw_points();
Expand Down