Fix some errors caused by rebasing with origin
This commit is contained in:
parent
66ec18eade
commit
ad35015478
|
@ -1,6 +1,5 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use super::texture::RenderTexture;
|
|
||||||
use super::texture::RenderTexture;
|
use super::texture::RenderTexture;
|
||||||
|
|
||||||
pub struct MaterialSpecular {
|
pub struct MaterialSpecular {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Vertex shader
|
// Vertex shader
|
||||||
|
|
||||||
const max_light_count: u32 = 16u;
|
|
||||||
const max_light_count: u32 = 16u;
|
const max_light_count: u32 = 16u;
|
||||||
|
|
||||||
struct VertexInput {
|
struct VertexInput {
|
||||||
|
@ -25,7 +24,6 @@ struct PointLight {
|
||||||
position: vec4<f32>,
|
position: vec4<f32>,
|
||||||
color: vec4<f32>,
|
color: vec4<f32>,
|
||||||
|
|
||||||
|
|
||||||
intensity: f32,
|
intensity: f32,
|
||||||
constant: f32,
|
constant: f32,
|
||||||
linear: f32,
|
linear: f32,
|
||||||
|
@ -34,10 +32,6 @@ struct PointLight {
|
||||||
ambient: f32,
|
ambient: f32,
|
||||||
diffuse: f32,
|
diffuse: f32,
|
||||||
specular: f32,
|
specular: f32,
|
||||||
|
|
||||||
ambient: f32,
|
|
||||||
diffuse: f32,
|
|
||||||
specular: f32,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DirectionalLight {
|
struct DirectionalLight {
|
||||||
|
@ -113,17 +107,9 @@ struct Material {
|
||||||
shininess: f32,
|
shininess: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Material {
|
|
||||||
ambient: vec4<f32>,
|
|
||||||
diffuse: vec4<f32>,
|
|
||||||
specular: vec4<f32>,
|
|
||||||
shininess: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
@group(0) @binding(0)
|
@group(0) @binding(0)
|
||||||
var t_diffuse: texture_2d<f32>;
|
var t_diffuse: texture_2d<f32>;
|
||||||
@group(0) @binding(1)
|
@group(0) @binding(1)
|
||||||
@group(0) @binding(1)
|
|
||||||
var s_diffuse: sampler;
|
var s_diffuse: sampler;
|
||||||
|
|
||||||
@group(4) @binding(0)
|
@group(4) @binding(0)
|
||||||
|
@ -199,14 +185,12 @@ fn blinn_phong_point_light(world_pos: vec3<f32>, world_norm: vec3<f32>, point_li
|
||||||
|
|
||||||
let diffuse_strength = max(dot(world_norm, light_dir), 0.0);
|
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);
|
||||||
var diffuse_color = light_color * (diffuse_strength * material.diffuse.xyz);
|
|
||||||
//// end of diffuse ////
|
//// end of diffuse ////
|
||||||
|
|
||||||
//// specular ////
|
//// specular ////
|
||||||
let view_dir = normalize(camera_view_pos - world_pos);
|
let view_dir = normalize(camera_view_pos - world_pos);
|
||||||
let half_dir = normalize(view_dir + light_dir);
|
let half_dir = normalize(view_dir + light_dir);
|
||||||
|
|
||||||
|
|
||||||
let specular_strength = pow(max(dot(world_norm, half_dir), 0.0), material.shininess);
|
let specular_strength = pow(max(dot(world_norm, half_dir), 0.0), material.shininess);
|
||||||
var specular_color = specular_strength * (light_color * specular_factor);
|
var specular_color = specular_strength * (light_color * specular_factor);
|
||||||
//// end of specular ////
|
//// end of specular ////
|
||||||
|
@ -216,9 +200,6 @@ fn blinn_phong_point_light(world_pos: vec3<f32>, world_norm: vec3<f32>, point_li
|
||||||
let attenuation = 1.0 / (point_light.constant + point_light.linear * distance +
|
let attenuation = 1.0 / (point_light.constant + point_light.linear * distance +
|
||||||
point_light.quadratic * (distance * 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 ////
|
//// end of point light attenuation ////
|
||||||
|
|
||||||
ambient_color *= point_light.ambient * attenuation;
|
ambient_color *= point_light.ambient * attenuation;
|
||||||
|
|
Loading…
Reference in New Issue