add spotlights to mirrors (slow T_T, but faster than ray tracing)
This commit is contained in:
parent
a97d6a0553
commit
4296c6ac4b
|
@ -168,6 +168,8 @@ pub struct MessageOnVehicleEntry(pub String);
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct PlayersFlashLight;
|
pub struct PlayersFlashLight;
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
|
pub struct MirrorLight;
|
||||||
|
#[derive(Component)]
|
||||||
pub struct WantsMaxRotation(pub f64);
|
pub struct WantsMaxRotation(pub f64);
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct WantsMaxVelocity(pub f64);
|
pub struct WantsMaxVelocity(pub f64);
|
||||||
|
|
34
src/cmd.rs
34
src/cmd.rs
|
@ -101,6 +101,7 @@ struct ParserState {
|
||||||
is_planet: bool,
|
is_planet: bool,
|
||||||
is_point_of_interest: bool,
|
is_point_of_interest: bool,
|
||||||
is_tidally_locked: bool,
|
is_tidally_locked: bool,
|
||||||
|
is_mirror: bool,
|
||||||
orbit_distance: Option<f64>,
|
orbit_distance: Option<f64>,
|
||||||
orbit_object_id: Option<String>,
|
orbit_object_id: Option<String>,
|
||||||
orbit_phase: Option<f64>,
|
orbit_phase: Option<f64>,
|
||||||
|
@ -163,6 +164,7 @@ impl Default for ParserState {
|
||||||
is_planet: false,
|
is_planet: false,
|
||||||
is_point_of_interest: false,
|
is_point_of_interest: false,
|
||||||
is_tidally_locked: false,
|
is_tidally_locked: false,
|
||||||
|
is_mirror: false,
|
||||||
orbit_distance: None,
|
orbit_distance: None,
|
||||||
orbit_object_id: None,
|
orbit_object_id: None,
|
||||||
orbit_phase: None,
|
orbit_phase: None,
|
||||||
|
@ -442,6 +444,9 @@ pub fn load_defs(mut ew_spawn: EventWriter<SpawnEvent>) {
|
||||||
["sphere", "yes"] => {
|
["sphere", "yes"] => {
|
||||||
state.is_sphere = true;
|
state.is_sphere = true;
|
||||||
}
|
}
|
||||||
|
["mirror", "yes"] => {
|
||||||
|
state.is_mirror = true;
|
||||||
|
}
|
||||||
["id", id] => {
|
["id", id] => {
|
||||||
state.id = id.to_string();
|
state.id = id.to_string();
|
||||||
}
|
}
|
||||||
|
@ -915,6 +920,9 @@ fn spawn_scenes(
|
||||||
state.angular_momentum = DVec3::ZERO;
|
state.angular_momentum = DVec3::ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// command: mirror yes
|
||||||
|
state.is_mirror = true;
|
||||||
|
|
||||||
// command: scale 10.0
|
// command: scale 10.0
|
||||||
state.model_scale = 10.0;
|
state.model_scale = 10.0;
|
||||||
|
|
||||||
|
@ -1239,6 +1247,32 @@ fn spawn_entities(
|
||||||
if !state.ar_models.is_empty() {
|
if !state.ar_models.is_empty() {
|
||||||
actor.insert(hud::AugmentedRealityOverlayBroadcaster);
|
actor.insert(hud::AugmentedRealityOverlayBroadcaster);
|
||||||
}
|
}
|
||||||
|
if state.is_mirror {
|
||||||
|
actor.with_children(|builder| {
|
||||||
|
// TODO: rotate the light appropriately
|
||||||
|
builder.spawn((
|
||||||
|
world::DespawnOnPlayerDeath,
|
||||||
|
actor::MirrorLight,
|
||||||
|
SpotLightBundle {
|
||||||
|
transform: Transform {
|
||||||
|
translation: Vec3::new(0.0, 0.0, 1.0),
|
||||||
|
rotation: Quat::from_rotation_y(180f32.to_radians()),
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
spot_light: SpotLight {
|
||||||
|
intensity: 2e7,
|
||||||
|
color: Color::WHITE,
|
||||||
|
shadows_enabled: false,
|
||||||
|
inner_angle: PI32 / 16.0,
|
||||||
|
outer_angle: PI32 / 13.0,
|
||||||
|
range: 1000.0,
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
if state.is_player {
|
if state.is_player {
|
||||||
actor.with_children(|builder| {
|
actor.with_children(|builder| {
|
||||||
builder.spawn((
|
builder.spawn((
|
||||||
|
|
Loading…
Reference in a new issue