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)));
|
commands.insert_resource(AsteroidModel2(asset_server.load(ASSET_ASTEROID2)));
|
||||||
|
|
||||||
// Generate starmap
|
// Generate starmap
|
||||||
let sphere_handle = meshes.add(Sphere::new(1.0));
|
let sphere_handle = meshes.add(Circle::new(1.0));
|
||||||
let mut starcount = 0;
|
let mut starcount = 0;
|
||||||
for star in stars::STARS {
|
for star in stars::STARS {
|
||||||
let mag = star.3;
|
let mag = star.3;
|
||||||
|
@ -167,6 +167,12 @@ pub fn setup(
|
||||||
} else {
|
} else {
|
||||||
star.6.to_string()
|
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((
|
commands.spawn((
|
||||||
Star,
|
Star,
|
||||||
hud::IsClickable {
|
hud::IsClickable {
|
||||||
|
@ -176,12 +182,11 @@ pub fn setup(
|
||||||
PbrBundle {
|
PbrBundle {
|
||||||
mesh: sphere_handle.clone(),
|
mesh: sphere_handle.clone(),
|
||||||
material: star_color_handle,
|
material: star_color_handle,
|
||||||
transform: Transform::from_xyz(
|
transform: Transform {
|
||||||
mesh_distance * star.0,
|
translation,
|
||||||
mesh_distance * star.1,
|
rotation,
|
||||||
mesh_distance * star.2,
|
scale: Vec3::splat(scale_size(mag)),
|
||||||
)
|
},
|
||||||
.with_scale(Vec3::splat(scale_size(mag))),
|
|
||||||
..default()
|
..default()
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue