mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Fix IcoSphere UV coordinates (#1871)
Changes made: - Swap Y/Z when calculating UV coordinates - Correct mapping in the UV coordinates - Fix typo in Azimuth
This commit is contained in:
parent
b80814681a
commit
df3f40afd4
1 changed files with 5 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue