cleanup custom material
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
#import bevy_pbr::forward_io::VertexOutput
|
|
||||||
|
|
||||||
@group(2) @binding(1) var material_color_texture: texture_2d<f32>;
|
|
||||||
@group(2) @binding(2) var material_color_sampler: sampler;
|
|
||||||
|
|
||||||
@fragment
|
|
||||||
fn fragment(
|
|
||||||
mesh: VertexOutput,
|
|
||||||
) -> @location(0) vec4<f32> {
|
|
||||||
return textureSample(material_color_texture, material_color_sampler, mesh.uv);
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
// this is made available to the importing module
|
|
||||||
const COLOR_MULTIPLIER: vec4<f32> = vec4<f32>(1.0, 1.0, 1.0, 0.5);
|
|
||||||
34
src/main.rs
34
src/main.rs
@@ -1,7 +1,6 @@
|
|||||||
use bevy::core_pipeline::tonemapping::Tonemapping;
|
use bevy::core_pipeline::tonemapping::Tonemapping;
|
||||||
use bevy::math::*;
|
use bevy::math::*;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
|
|
||||||
use bevy_flycam::prelude::*;
|
use bevy_flycam::prelude::*;
|
||||||
use bevy_trenchbroom::prelude::*;
|
use bevy_trenchbroom::prelude::*;
|
||||||
|
|
||||||
@@ -18,23 +17,6 @@ pub struct MyBaseClass {
|
|||||||
pub my_value: u32,
|
pub my_value: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
const SHADER_ASSET_PATH: &str = "shaders/custom_material.wgsl";
|
|
||||||
|
|
||||||
#[derive(Asset, Reflect, Default, AsBindGroup, Debug, Clone)]
|
|
||||||
struct CustomMaterial {
|
|
||||||
#[uniform(0)]
|
|
||||||
color: LinearRgba,
|
|
||||||
#[texture(1)]
|
|
||||||
#[sampler(2)]
|
|
||||||
color_texture: Option<Handle<Image>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Material for CustomMaterial {
|
|
||||||
fn fragment_shader() -> ShaderRef {
|
|
||||||
SHADER_ASSET_PATH.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
|
|
||||||
@@ -44,22 +26,6 @@ fn main() {
|
|||||||
|
|
||||||
// bevy_flycam setup so we can get a closer look at the scene, mainly for debugging
|
// bevy_flycam setup so we can get a closer look at the scene, mainly for debugging
|
||||||
app.add_plugins(PlayerPlugin);
|
app.add_plugins(PlayerPlugin);
|
||||||
// app.add_plugins(
|
|
||||||
// MaterializePlugin::new(TomlMaterialDeserializer).with_simple_loader_settings(Some(
|
|
||||||
// SimpleGenericMaterialLoaderSettings {
|
|
||||||
// material: |image| {
|
|
||||||
// CustomMaterial {
|
|
||||||
// color_texture: Some(image),
|
|
||||||
// ..Default::default()
|
|
||||||
// }
|
|
||||||
// .into()
|
|
||||||
// },
|
|
||||||
// ..Default::default()
|
|
||||||
// },
|
|
||||||
// )),
|
|
||||||
// );
|
|
||||||
// app.add_plugins(MaterialPlugin::<CustomMaterial>::default());
|
|
||||||
// app.register_generic_material::<CustomMaterial>();
|
|
||||||
|
|
||||||
app.insert_resource(MovementSettings {
|
app.insert_resource(MovementSettings {
|
||||||
sensitivity: 0.00005,
|
sensitivity: 0.00005,
|
||||||
|
|||||||
Reference in New Issue
Block a user