aurora: disable backface culling, making it more visible from the inside
This commit is contained in:
parent
03e96e6ecd
commit
dbfe4a7790
|
@ -1277,7 +1277,9 @@ fn spawn_entities(
|
||||||
mut meshes: ResMut<Assets<Mesh>>,
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
mut materials_jupiter: ResMut<Assets<load::JupitersRing>>,
|
mut materials_jupiter: ResMut<Assets<load::JupitersRing>>,
|
||||||
mut materials_aurora: ResMut<Assets<load::JupitersAurora>>,
|
mut materials_aurora: ResMut<
|
||||||
|
Assets<bevy::pbr::ExtendedMaterial<StandardMaterial, load::JupitersAurora>>,
|
||||||
|
>,
|
||||||
mut id2pos: ResMut<game::Id2Pos>,
|
mut id2pos: ResMut<game::Id2Pos>,
|
||||||
mut achievement_tracker: ResMut<var::AchievementTracker>,
|
mut achievement_tracker: ResMut<var::AchievementTracker>,
|
||||||
mut ew_updateavatar: EventWriter<hud::UpdateAvatarEvent>,
|
mut ew_updateavatar: EventWriter<hud::UpdateAvatarEvent>,
|
||||||
|
@ -1667,9 +1669,7 @@ fn spawn_entities(
|
||||||
world::DespawnOnPlayerDeath,
|
world::DespawnOnPlayerDeath,
|
||||||
MaterialMeshBundle {
|
MaterialMeshBundle {
|
||||||
mesh: meshes.add(Sphere::new(radius).mesh().uv(128, 128)),
|
mesh: meshes.add(Sphere::new(radius).mesh().uv(128, 128)),
|
||||||
material: materials_aurora.add(load::JupitersAurora {
|
material: materials_aurora.add(load::JupitersAurora::material()),
|
||||||
alpha_mode: AlphaMode::Blend,
|
|
||||||
}),
|
|
||||||
transform: Transform::from_translation(absolute_pos.as_vec3()),
|
transform: Transform::from_translation(absolute_pos.as_vec3()),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
|
|
30
src/load.rs
30
src/load.rs
|
@ -19,7 +19,9 @@ pub struct LoadPlugin;
|
||||||
impl Plugin for LoadPlugin {
|
impl Plugin for LoadPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_plugins(MaterialPlugin::<JupitersRing>::default());
|
app.add_plugins(MaterialPlugin::<JupitersRing>::default());
|
||||||
app.add_plugins(MaterialPlugin::<JupitersAurora>::default());
|
app.add_plugins(MaterialPlugin::<
|
||||||
|
ExtendedMaterial<StandardMaterial, JupitersAurora>,
|
||||||
|
>::default());
|
||||||
app.add_plugins(MaterialPlugin::<SkyBox>::default());
|
app.add_plugins(MaterialPlugin::<SkyBox>::default());
|
||||||
app.add_plugins(MaterialPlugin::<
|
app.add_plugins(MaterialPlugin::<
|
||||||
ExtendedMaterial<StandardMaterial, AsteroidSurface>,
|
ExtendedMaterial<StandardMaterial, AsteroidSurface>,
|
||||||
|
@ -117,12 +119,32 @@ pub struct JupitersAurora {
|
||||||
pub alpha_mode: AlphaMode,
|
pub alpha_mode: AlphaMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Material for JupitersAurora {
|
impl MaterialExtension for JupitersAurora {
|
||||||
fn fragment_shader() -> ShaderRef {
|
fn fragment_shader() -> ShaderRef {
|
||||||
"shaders/aurora.wgsl".into()
|
"shaders/aurora.wgsl".into()
|
||||||
}
|
}
|
||||||
fn alpha_mode(&self) -> AlphaMode {
|
}
|
||||||
self.alpha_mode
|
|
||||||
|
impl Default for JupitersAurora {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
alpha_mode: AlphaMode::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl JupitersAurora {
|
||||||
|
pub fn material() -> ExtendedMaterial<StandardMaterial, JupitersAurora> {
|
||||||
|
ExtendedMaterial {
|
||||||
|
base: StandardMaterial {
|
||||||
|
perceptual_roughness: 1.0,
|
||||||
|
alpha_mode: AlphaMode::Blend,
|
||||||
|
opaque_render_method: OpaqueRendererMethod::Auto,
|
||||||
|
cull_mode: None,
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
extension: Self::default(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue