restore real size of moons. add setting "large_moons"
This commit is contained in:
parent
569a88df19
commit
8e27525b35
|
@ -66,6 +66,7 @@ struct ParserState {
|
||||||
is_clickable: bool,
|
is_clickable: bool,
|
||||||
is_targeted_on_startup: bool,
|
is_targeted_on_startup: bool,
|
||||||
is_sun: bool,
|
is_sun: bool,
|
||||||
|
is_moon: bool,
|
||||||
is_point_of_interest: bool,
|
is_point_of_interest: bool,
|
||||||
has_physics: bool,
|
has_physics: bool,
|
||||||
has_ring: bool,
|
has_ring: bool,
|
||||||
|
@ -116,6 +117,7 @@ impl Default for ParserState {
|
||||||
is_clickable: true,
|
is_clickable: true,
|
||||||
is_targeted_on_startup: false,
|
is_targeted_on_startup: false,
|
||||||
is_sun: false,
|
is_sun: false,
|
||||||
|
is_moon: false,
|
||||||
is_point_of_interest: false,
|
is_point_of_interest: false,
|
||||||
has_physics: true,
|
has_physics: true,
|
||||||
has_ring: false,
|
has_ring: false,
|
||||||
|
@ -257,11 +259,10 @@ pub fn load_defs(
|
||||||
state.is_clickable = false;
|
state.is_clickable = false;
|
||||||
}
|
}
|
||||||
["moon", "yes"] => {
|
["moon", "yes"] => {
|
||||||
state.model_scale *= 3.0;
|
state.is_moon = true;
|
||||||
}
|
}
|
||||||
["sun", "yes"] => {
|
["sun", "yes"] => {
|
||||||
state.is_sun = true;
|
state.is_sun = true;
|
||||||
state.model_scale *= 5.0;
|
|
||||||
}
|
}
|
||||||
["ring", "yes"] => {
|
["ring", "yes"] => {
|
||||||
state.has_ring = true;
|
state.has_ring = true;
|
||||||
|
@ -490,6 +491,7 @@ fn spawn_entities(
|
||||||
for state_wrapper in er_spawn.read() {
|
for state_wrapper in er_spawn.read() {
|
||||||
let state = &state_wrapper.0;
|
let state = &state_wrapper.0;
|
||||||
if state.class == DefClass::Actor {
|
if state.class == DefClass::Actor {
|
||||||
|
// Preprocessing
|
||||||
let relative_pos = if let Some(id) = &state.relative_to {
|
let relative_pos = if let Some(id) = &state.relative_to {
|
||||||
match id2pos.0.get(&id.to_string()) {
|
match id2pos.0.get(&id.to_string()) {
|
||||||
Some(pos) => {
|
Some(pos) => {
|
||||||
|
@ -503,7 +505,15 @@ fn spawn_entities(
|
||||||
} else {
|
} else {
|
||||||
state.pos
|
state.pos
|
||||||
};
|
};
|
||||||
|
let scale = Vec3::splat(if state.is_sun {
|
||||||
|
5.0
|
||||||
|
} else if state.is_moon && settings.large_moons {
|
||||||
|
3.0
|
||||||
|
} else {
|
||||||
|
1.0
|
||||||
|
} * state.model_scale);
|
||||||
|
|
||||||
|
// Spawn the actor
|
||||||
let actor_entity;
|
let actor_entity;
|
||||||
{
|
{
|
||||||
let mut actor = commands.spawn_empty();
|
let mut actor = commands.spawn_empty();
|
||||||
|
@ -534,18 +544,12 @@ fn spawn_entities(
|
||||||
actor.insert(PbrBundle {
|
actor.insert(PbrBundle {
|
||||||
mesh: sphere_handle,
|
mesh: sphere_handle,
|
||||||
material: sphere_material_handle,
|
material: sphere_material_handle,
|
||||||
transform: Transform {
|
transform: Transform::from_scale(scale),
|
||||||
scale: Vec3::splat(state.model_scale),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
} else if let Some(model) = &state.model {
|
} else if let Some(model) = &state.model {
|
||||||
actor.insert(SpatialBundle {
|
actor.insert(SpatialBundle {
|
||||||
transform: Transform {
|
transform: Transform::from_scale(scale),
|
||||||
scale: Vec3::splat(state.model_scale),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
skeleton::load(model.as_str(), &mut actor, &*asset_server);
|
skeleton::load(model.as_str(), &mut actor, &*asset_server);
|
||||||
|
|
|
@ -61,6 +61,7 @@ pub struct Settings {
|
||||||
pub shadows_sun: bool,
|
pub shadows_sun: bool,
|
||||||
pub shadows_pointlights: bool,
|
pub shadows_pointlights: bool,
|
||||||
pub shadowmap_resolution: usize,
|
pub shadowmap_resolution: usize,
|
||||||
|
pub large_moons: bool,
|
||||||
pub key_selectobject: MouseButton,
|
pub key_selectobject: MouseButton,
|
||||||
pub key_zoom: MouseButton,
|
pub key_zoom: MouseButton,
|
||||||
pub key_map: KeyCode,
|
pub key_map: KeyCode,
|
||||||
|
@ -175,6 +176,7 @@ impl Default for Settings {
|
||||||
shadows_sun: true,
|
shadows_sun: true,
|
||||||
shadows_pointlights: false,
|
shadows_pointlights: false,
|
||||||
shadowmap_resolution: 2048,
|
shadowmap_resolution: 2048,
|
||||||
|
large_moons: false,
|
||||||
key_selectobject: MouseButton::Left,
|
key_selectobject: MouseButton::Left,
|
||||||
key_zoom: MouseButton::Right,
|
key_zoom: MouseButton::Right,
|
||||||
key_map: KeyCode::KeyM,
|
key_map: KeyCode::KeyM,
|
||||||
|
|
Loading…
Reference in a new issue