render stars as circles instead of spheres
This commit is contained in:
parent
a2b348fc59
commit
ad9f6dbd39
19
src/world.rs
19
src/world.rs
|
@ -126,7 +126,7 @@ pub fn setup(
|
|||
commands.insert_resource(AsteroidModel2(asset_server.load(ASSET_ASTEROID2)));
|
||||
|
||||
// Generate starmap
|
||||
let sphere_handle = meshes.add(Sphere::new(1.0));
|
||||
let sphere_handle = meshes.add(Circle::new(1.0));
|
||||
let mut starcount = 0;
|
||||
for star in stars::STARS {
|
||||
let mag = star.3;
|
||||
|
@ -167,6 +167,12 @@ pub fn setup(
|
|||
} else {
|
||||
star.6.to_string()
|
||||
};
|
||||
let translation = Vec3::new(
|
||||
mesh_distance * star.0,
|
||||
mesh_distance * star.1,
|
||||
mesh_distance * star.2,
|
||||
);
|
||||
let rotation = Quat::from_rotation_arc(Vec3::Z, (-translation).normalize());
|
||||
commands.spawn((
|
||||
Star,
|
||||
hud::IsClickable {
|
||||
|
@ -176,12 +182,11 @@ pub fn setup(
|
|||
PbrBundle {
|
||||
mesh: sphere_handle.clone(),
|
||||
material: star_color_handle,
|
||||
transform: Transform::from_xyz(
|
||||
mesh_distance * star.0,
|
||||
mesh_distance * star.1,
|
||||
mesh_distance * star.2,
|
||||
)
|
||||
.with_scale(Vec3::splat(scale_size(mag))),
|
||||
transform: Transform {
|
||||
translation,
|
||||
rotation,
|
||||
scale: Vec3::splat(scale_size(mag)),
|
||||
},
|
||||
..default()
|
||||
}
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue