mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
Update icosphere dependency and add a limit to subdivisions. (#379)
This commit is contained in:
parent
d64882ffbf
commit
c40e29bca3
2 changed files with 10 additions and 1 deletions
|
@ -38,7 +38,7 @@ once_cell = "1.4.0"
|
|||
downcast-rs = "1.1.1"
|
||||
thiserror = "1.0"
|
||||
anyhow = "1.0"
|
||||
hexasphere = "0.1.5"
|
||||
hexasphere = "1.0.0"
|
||||
parking_lot = "0.10"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -411,6 +411,15 @@ pub mod shape {
|
|||
|
||||
impl From<Icosphere> for Mesh {
|
||||
fn from(sphere: Icosphere) -> Self {
|
||||
if sphere.subdivisions >= 80 {
|
||||
let temp_sphere = Hexasphere::new(sphere.subdivisions, |_| ());
|
||||
|
||||
panic!(
|
||||
"Cannot create an icosphere of {} subdivisions due to there being too many vertices being generated: {} (Limited to 65535 vertices or 79 subdivisions)",
|
||||
sphere.subdivisions,
|
||||
temp_sphere.raw_points().len()
|
||||
);
|
||||
}
|
||||
let hexasphere = Hexasphere::new(sphere.subdivisions, |point| {
|
||||
let inclination = point.z().acos();
|
||||
let azumith = point.y().atan2(point.x());
|
||||
|
|
Loading…
Reference in a new issue