add dummy material_asteroid.wgsl and shading::AsteroidSurface
This commit is contained in:
parent
babbef279a
commit
f56521e49f
9
assets/shaders/material_asteroid.wgsl
Normal file
9
assets/shaders/material_asteroid.wgsl
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#import bevy_pbr::{
|
||||||
|
mesh_view_bindings::globals,
|
||||||
|
forward_io::VertexOutput,
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||||
|
return vec4<f32>(0.0, 0.4, 0.0, 1.0);
|
||||||
|
}
|
10
src/main.rs
10
src/main.rs
|
@ -61,6 +61,7 @@ impl Plugin for OutFlyPlugin {
|
||||||
commands::CommandsPlugin,
|
commands::CommandsPlugin,
|
||||||
effects::EffectsPlugin,
|
effects::EffectsPlugin,
|
||||||
hud::HudPlugin,
|
hud::HudPlugin,
|
||||||
|
shading::ShadingPlugin,
|
||||||
world::WorldPlugin,
|
world::WorldPlugin,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,7 @@ fn debug(
|
||||||
settings: Res<var::Settings>,
|
settings: Res<var::Settings>,
|
||||||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut materials_custom: ResMut<Assets<shading::JupitersRing>>,
|
mut materials_custom: ResMut<Assets<shading::AsteroidSurface>>,
|
||||||
materials: Query<(Entity, &Name, &Handle<StandardMaterial>)>,
|
materials: Query<(Entity, &Name, &Handle<StandardMaterial>)>,
|
||||||
) {
|
) {
|
||||||
if settings.dev_mode && keyboard_input.pressed(KeyCode::KeyP) {
|
if settings.dev_mode && keyboard_input.pressed(KeyCode::KeyP) {
|
||||||
|
@ -110,12 +111,7 @@ fn debug(
|
||||||
dbg!(mat);
|
dbg!(mat);
|
||||||
let mut entity = commands.entity(entity);
|
let mut entity = commands.entity(entity);
|
||||||
entity.remove::<Handle<StandardMaterial>>();
|
entity.remove::<Handle<StandardMaterial>>();
|
||||||
let ring_radius = 229_000_000.0;
|
let material = materials_custom.add(shading::AsteroidSurface {
|
||||||
let jupiter_radius = 71_492_000.0;
|
|
||||||
let material = materials_custom.add(shading::JupitersRing {
|
|
||||||
alpha_mode: AlphaMode::Blend,
|
|
||||||
ring_radius: ring_radius,
|
|
||||||
jupiter_radius: jupiter_radius,
|
|
||||||
});
|
});
|
||||||
entity.insert(material);
|
entity.insert(material);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
|
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
|
||||||
|
|
||||||
|
pub struct ShadingPlugin;
|
||||||
|
impl Plugin for ShadingPlugin {
|
||||||
|
fn build(&self, app: &mut App) {
|
||||||
|
app.add_plugins(MaterialPlugin::<JupitersRing>::default());
|
||||||
|
app.add_plugins(MaterialPlugin::<AsteroidSurface>::default());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||||
pub struct JupitersRing {
|
pub struct JupitersRing {
|
||||||
pub alpha_mode: AlphaMode,
|
pub alpha_mode: AlphaMode,
|
||||||
|
|
|
@ -51,7 +51,6 @@ impl Plugin for WorldPlugin {
|
||||||
app.add_systems(PostUpdate, handle_despawn);
|
app.add_systems(PostUpdate, handle_despawn);
|
||||||
app.add_systems(Update, spawn_despawn_asteroids);
|
app.add_systems(Update, spawn_despawn_asteroids);
|
||||||
app.add_plugins(PhysicsPlugins::default());
|
app.add_plugins(PhysicsPlugins::default());
|
||||||
app.add_plugins(MaterialPlugin::<shading::JupitersRing>::default());
|
|
||||||
//app.add_plugins(PhysicsDebugPlugin::default());
|
//app.add_plugins(PhysicsDebugPlugin::default());
|
||||||
app.insert_resource(Gravity(DVec3::splat(0.0)));
|
app.insert_resource(Gravity(DVec3::splat(0.0)));
|
||||||
app.insert_resource(AsteroidUpdateTimer(
|
app.insert_resource(AsteroidUpdateTimer(
|
||||||
|
|
Loading…
Reference in a new issue