diff --git a/src/render/material.rs b/src/render/material.rs index 3d1463c..154ba76 100755 --- a/src/render/material.rs +++ b/src/render/material.rs @@ -1,6 +1,5 @@ use std::sync::Arc; -use super::texture::RenderTexture; use super::texture::RenderTexture; pub struct MaterialSpecular { diff --git a/src/render/shaders/base.wgsl b/src/render/shaders/base.wgsl index 211d7e7..dfbdc76 100755 --- a/src/render/shaders/base.wgsl +++ b/src/render/shaders/base.wgsl @@ -1,6 +1,5 @@ // Vertex shader -const max_light_count: u32 = 16u; const max_light_count: u32 = 16u; struct VertexInput { @@ -25,7 +24,6 @@ struct PointLight { position: vec4, color: vec4, - intensity: f32, constant: f32, linear: f32, @@ -34,10 +32,6 @@ struct PointLight { ambient: f32, diffuse: f32, specular: f32, - - ambient: f32, - diffuse: f32, - specular: f32, }; struct DirectionalLight { @@ -113,17 +107,9 @@ struct Material { shininess: f32, } -struct Material { - ambient: vec4, - diffuse: vec4, - specular: vec4, - shininess: f32, -} - @group(0) @binding(0) var t_diffuse: texture_2d; @group(0) @binding(1) -@group(0) @binding(1) var s_diffuse: sampler; @group(4) @binding(0) @@ -199,14 +185,12 @@ fn blinn_phong_point_light(world_pos: vec3, world_norm: vec3, point_li let diffuse_strength = max(dot(world_norm, light_dir), 0.0); var diffuse_color = light_color * (diffuse_strength * material.diffuse.xyz); - var diffuse_color = light_color * (diffuse_strength * material.diffuse.xyz); //// end of diffuse //// //// specular //// let view_dir = normalize(camera_view_pos - world_pos); let half_dir = normalize(view_dir + light_dir); - let specular_strength = pow(max(dot(world_norm, half_dir), 0.0), material.shininess); var specular_color = specular_strength * (light_color * specular_factor); //// end of specular //// @@ -216,9 +200,6 @@ fn blinn_phong_point_light(world_pos: vec3, world_norm: vec3, point_li let attenuation = 1.0 / (point_light.constant + point_light.linear * distance + point_light.quadratic * (distance * distance)); - //ambient_color *= attenuation * point_light.intensity * point_light.ambient; - //diffuse_color *= attenuation * point_light.intensity * point_light.diffuse; - //specular_color *= attenuation * point_light.intensity * point_light.specular; //// end of point light attenuation //// ambient_color *= point_light.ambient * attenuation;