WIP better star brightnesses
This commit is contained in:
parent
573d27bb6e
commit
6d98a0e459
11
src/defs.txt
11
src/defs.txt
|
@ -3,7 +3,7 @@ actor 300000 0 500000 jupiter
|
|||
rotationy -1.40
|
||||
angularmomentum 0 0.0001 0
|
||||
|
||||
actor 2000 0 0 asteroid1
|
||||
actor 2000 2000 0 asteroid1
|
||||
scale 200
|
||||
|
||||
actor -2300 10 0 pizzeria
|
||||
|
@ -23,10 +23,6 @@ actor -2265 10 0 suit
|
|||
alive yes
|
||||
pronoun it
|
||||
|
||||
chat error
|
||||
name ERROR
|
||||
msg 0 INIT EXIT "Unspecified conversation ID"
|
||||
|
||||
chat hi_icarus
|
||||
name Icarus
|
||||
msg 2 INIT hi "Requesting permission to communicate..."
|
||||
|
@ -43,6 +39,7 @@ chat hi_icarus
|
|||
msg 2.5 pizza end "Make sure to check out the Pizza place."
|
||||
choice 3 end end1 "Will do, bye!"
|
||||
msg 0 end1 EXIT "Disconnected."
|
||||
lvl info
|
||||
msg 0 end EXIT "Disconnected."
|
||||
lvl info
|
||||
|
||||
|
@ -57,3 +54,7 @@ chat pizzeria
|
|||
msg 10 anyone end "Hello? Is anyone there? Is this a prank?"
|
||||
msg 0 end EXIT "Disconnected."
|
||||
lvl info
|
||||
|
||||
chat error
|
||||
name ERROR
|
||||
msg 0 INIT EXIT "Unspecified conversation ID"
|
||||
|
|
31089
src/nature.rs
31089
src/nature.rs
File diff suppressed because it is too large
Load diff
|
@ -37,8 +37,8 @@ pub struct Settings {
|
|||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Settings {
|
||||
mute_sfx: false,
|
||||
mute_music: false,
|
||||
mute_sfx: true,
|
||||
mute_music: true,
|
||||
volume_sfx: 100,
|
||||
volume_music: 100,
|
||||
font_size_hud: 32.0,
|
||||
|
|
47
src/world.rs
47
src/world.rs
|
@ -145,14 +145,51 @@ pub fn setup(
|
|||
// Generate starmap
|
||||
let sphere_handle = meshes.add(Sphere::new(1.0));
|
||||
for star in nature::STARS {
|
||||
let brightness = star[3] * 2000.0;
|
||||
//let clr = {|c: f32| c * 0.01 * (brightness * 50.0).powf(1.2).clamp(0.1, 100000.0) };
|
||||
//let clr = {|c: f32| c * 0.15 };
|
||||
//let clr = {|c: f32| c * 1.78136 * c.ln() + 5.03726 };
|
||||
//let clr = {|c: f32| c * 1.9293*c.powf(0.1382) };
|
||||
//let clr = {|c: f32| c * 0.0431866*brightness*brightness - 0.688256*brightness + 2.90952 };
|
||||
//let clr = {|c: f32| c * 0.0275015*mag*mag - 0.59251*mag + 2.93566 };
|
||||
//let size = {|mag: f32| 10.0 * 8.0*mag*mag - 100.0*mag + 400.0 };
|
||||
//let size = {|mag: f32| 10.0 * 8.0*mag*mag - 100.0*mag + 400.0 };
|
||||
let mag = star[3];
|
||||
let clr = {|color: f32|
|
||||
if mag < -20.0 {
|
||||
color * 13.0 // Sun
|
||||
} else if mag < 0.0 {
|
||||
color * 5.0
|
||||
} else if mag < 0.5 {
|
||||
color * 4.2
|
||||
} else if mag < 1.5 {
|
||||
color * 3.5
|
||||
} else if mag < 2.5 {
|
||||
color * 2.0
|
||||
} else if mag < 3.5 {
|
||||
color * 1.0
|
||||
} else {
|
||||
color * 0.15
|
||||
}
|
||||
};
|
||||
let size = {|mag: f32|
|
||||
if mag < -20.0 {
|
||||
40000.0f32 // Sun
|
||||
} else if mag < 0.0 {
|
||||
20000.0f32
|
||||
} else if mag < 2.0 {
|
||||
10000.0f32
|
||||
} else {
|
||||
5000.0f32
|
||||
}
|
||||
};
|
||||
let (r, g, b) = nature::star_color_index_to_rgb(star[4]);
|
||||
let star_color_handle = materials.add(StandardMaterial {
|
||||
base_color: Color::rgb(r, g, b),
|
||||
emissive: Color::rgb_linear(r*brightness, g*brightness, b*brightness),
|
||||
base_color: Color::rgb(clr(r), clr(g), clr(b)),
|
||||
//emissive: Color::rgb_linear(r*brightness, g*brightness, b*brightness),
|
||||
unlit: true,
|
||||
..default()
|
||||
});
|
||||
let dist = 1e6;
|
||||
let dist = 1e7;
|
||||
commands.spawn((
|
||||
Star,
|
||||
PbrBundle {
|
||||
|
@ -163,7 +200,7 @@ pub fn setup(
|
|||
dist * star[1],
|
||||
dist * star[2],
|
||||
)
|
||||
.with_scale(Vec3::splat((1000.0*star[3]).clamp(500.0, 2000.0))),
|
||||
.with_scale(Vec3::splat(size(mag))),
|
||||
..default()
|
||||
}
|
||||
));
|
||||
|
|
|
@ -28,10 +28,11 @@ import math
|
|||
# Meissa (orion's head, 8th brightest star in orion) = 3.33
|
||||
MAX_APPARENT_MAGNITUDE = 7.0
|
||||
|
||||
print("// The \"STARS\" was autogenerated by \"genrate_starchart.py\" using data")
|
||||
print("// The \"STARS\" constant was autogenerated by \"genrate_starchart.py\" using data")
|
||||
print("// from the HYG database: https://github.com/astronexus/HYG-Database/tree/main/hyg")
|
||||
print("// License: CC BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/")
|
||||
print("")
|
||||
print("// Each star's values: [x, y, z, magnitude, color index]")
|
||||
print("pub const STARS: &[[f32; 5]] = &[")
|
||||
|
||||
|
||||
|
@ -56,27 +57,33 @@ def render(ra, dec, mag, ci, proper):
|
|||
|
||||
brightness = 2.512 ** (0 - mag)
|
||||
|
||||
print(f" [{x:.04}, {y:.04}, {z:.04}, {brightness:.04}, {ci}],{comment}")
|
||||
print(f" [{x:.04}, {y:.04}, {z:.04}, {mag:.04}, {ci}],{comment}")
|
||||
|
||||
|
||||
total = 0
|
||||
count = 0
|
||||
count_extra = 0
|
||||
entries = []
|
||||
with open("assets/tmp/hygdata_v41.csv", "r", encoding="utf-8") as f:
|
||||
for entry in csv.DictReader(f):
|
||||
total += 1
|
||||
ra = entry['ra']
|
||||
dec = entry['dec']
|
||||
mag = entry['mag']
|
||||
ci = entry['ci']
|
||||
proper = entry['proper']
|
||||
proper = "".join([c for c in proper if c.isalnum() or c in ' -_'])
|
||||
if not all([ra, dec, mag, ci]):
|
||||
continue
|
||||
if float(mag) > MAX_APPARENT_MAGNITUDE:
|
||||
continue
|
||||
render(ra, dec, mag, ci, proper)
|
||||
count += 1
|
||||
entries.append(entry)
|
||||
|
||||
entries.sort(key=lambda entry: float(entry['mag']))
|
||||
|
||||
for entry in entries:
|
||||
total += 1
|
||||
ra = entry['ra']
|
||||
dec = entry['dec']
|
||||
mag = entry['mag']
|
||||
ci = entry['ci']
|
||||
proper = entry['proper']
|
||||
proper = "".join([c for c in proper if c.isalnum() or c in ' -_'])
|
||||
if not all([ra, dec, mag, ci]):
|
||||
continue
|
||||
if float(mag) > MAX_APPARENT_MAGNITUDE:
|
||||
continue
|
||||
render(ra, dec, mag, ci, proper)
|
||||
count += 1
|
||||
#for entry in CUSTOM_ENTRIES:
|
||||
# render(entry[0], entry[1], entry[2], entry[3], entry[4])
|
||||
# count_extra += 1
|
||||
|
|
Loading…
Reference in a new issue