mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'revert-2644c51b' into 'master'
Revert "Merge branch 'infrandomness/remove_alpha' into 'master'" See merge request veloren/veloren!3132
This commit is contained in:
commit
d83a1039eb
@ -71,7 +71,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Made the hotbar link to items by item definition id and component composition instead of specific inventory slots.
|
- Made the hotbar link to items by item definition id and component composition instead of specific inventory slots.
|
||||||
- Made loot boxes drop items instead of doing nothing in order to loot forcing
|
- Made loot boxes drop items instead of doing nothing in order to loot forcing
|
||||||
- Refactored agent code file structure
|
- Refactored agent code file structure
|
||||||
- Changed the way light strength is rendered by moving processing from shader code (GPU) to CPU code
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -84,7 +84,8 @@ vec3 light_at(vec3 wpos, vec3 wnorm) {
|
|||||||
|
|
||||||
float strength = attenuation_strength(difference);
|
float strength = attenuation_strength(difference);
|
||||||
|
|
||||||
vec3 color = srgb_to_linear(L.light_col.rgb);
|
// Multiply the vec3 only once
|
||||||
|
vec3 color = srgb_to_linear(L.light_col.rgb) * (strength * L.light_col.a);
|
||||||
|
|
||||||
light += color * (max(0, max(dot(normalize(difference), wnorm), 0.15)) + LIGHT_AMBIANCE);
|
light += color * (max(0, max(dot(normalize(difference), wnorm), 0.15)) + LIGHT_AMBIANCE);
|
||||||
}
|
}
|
||||||
@ -193,12 +194,12 @@ float lights_at(vec3 wpos, vec3 wnorm, vec3 /*cam_to_frag*/view_dir, vec3 mu, ve
|
|||||||
is_direct = true;
|
is_direct = true;
|
||||||
#endif
|
#endif
|
||||||
vec3 lrf = light_reflection_factor(/*direct_norm_dir*/wnorm, /*cam_to_frag*/view_dir, direct_light_dir, k_d, k_s, alpha, voxel_norm, voxel_lighting);
|
vec3 lrf = light_reflection_factor(/*direct_norm_dir*/wnorm, /*cam_to_frag*/view_dir, direct_light_dir, k_d, k_s, alpha, voxel_norm, voxel_lighting);
|
||||||
vec3 direct_light = PI * color * square_factor * lrf;
|
vec3 direct_light = PI * color * strength * square_factor * lrf;
|
||||||
/* is_direct = true; */
|
/* is_direct = true; */
|
||||||
float computed_shadow = ShadowCalculationPoint(i, -difference, wnorm, wpos/*, light_distance*/);
|
float computed_shadow = ShadowCalculationPoint(i, -difference, wnorm, wpos/*, light_distance*/);
|
||||||
// directed_light += is_direct ? max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor : vec3(0.0);
|
// directed_light += is_direct ? max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor : vec3(0.0);
|
||||||
// Non-physically emulate ambient light nearby
|
// Non-physically emulate ambient light nearby
|
||||||
float ambiance = (dot(-wnorm, direct_light_dir) * 0.5 + 0.5) * square_factor;
|
float ambiance = (dot(-wnorm, direct_light_dir) * 0.5 + 0.5) * strength * square_factor;
|
||||||
#ifdef FIGURE_SHADER
|
#ifdef FIGURE_SHADER
|
||||||
// Non-physical hack. Subtle, but allows lanterns to glow nicely
|
// Non-physical hack. Subtle, but allows lanterns to glow nicely
|
||||||
// TODO: Make lanterns use glowing cells instead
|
// TODO: Make lanterns use glowing cells instead
|
||||||
|
@ -30,7 +30,7 @@ vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color) {
|
|||||||
|
|
||||||
float strength = pow(attenuation_strength_real(difference), spread);
|
float strength = pow(attenuation_strength_real(difference), spread);
|
||||||
|
|
||||||
vec3 light_color = srgb_to_linear(L.light_col.rgb) * L.light_col.a;
|
vec3 light_color = srgb_to_linear(L.light_col.rgb) * strength * L.light_col.a;
|
||||||
|
|
||||||
const float LIGHT_AMBIANCE = 0.025;
|
const float LIGHT_AMBIANCE = 0.025;
|
||||||
color += light_color
|
color += light_color
|
||||||
|
@ -204,8 +204,7 @@ impl Light {
|
|||||||
pub fn new(pos: Vec3<f32>, col: Rgb<f32>, strength: f32) -> Self {
|
pub fn new(pos: Vec3<f32>, col: Rgb<f32>, strength: f32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
pos: Vec4::from(pos).into_array(),
|
pos: Vec4::from(pos).into_array(),
|
||||||
col: (Rgba::new(strength * col.r, strength * col.g, strength * col.b, 0.0) * strength)
|
col: Rgba::new(col.r, col.g, col.b, strength).into_array(),
|
||||||
.into_array(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ impl Debug {
|
|||||||
if let Some(model) = renderer.create_model(&shape.mesh()) {
|
if let Some(model) = renderer.create_model(&shape.mesh()) {
|
||||||
let locals = renderer.create_debug_bound_locals(&[DebugLocals {
|
let locals = renderer.create_debug_bound_locals(&[DebugLocals {
|
||||||
pos: [0.0; 4],
|
pos: [0.0; 4],
|
||||||
color: [1.0 * 1.0, 0.0, 0.0, 0.0],
|
color: [1.0, 0.0, 0.0, 1.0],
|
||||||
ori: [0.0, 0.0, 0.0, 1.0],
|
ori: [0.0, 0.0, 0.0, 1.0],
|
||||||
}]);
|
}]);
|
||||||
self.models.insert(id, (model, locals));
|
self.models.insert(id, (model, locals));
|
||||||
@ -202,7 +202,7 @@ impl Debug {
|
|||||||
let lc = srgba_to_linear(color.into());
|
let lc = srgba_to_linear(color.into());
|
||||||
let new_locals = [DebugLocals {
|
let new_locals = [DebugLocals {
|
||||||
pos,
|
pos,
|
||||||
color: [lc.a * lc.r, lc.a * lc.g, lc.a * lc.b, 0.0],
|
color: [lc.r, lc.g, lc.b, lc.a],
|
||||||
ori,
|
ori,
|
||||||
}];
|
}];
|
||||||
renderer.update_consts(locals, &new_locals);
|
renderer.update_consts(locals, &new_locals);
|
||||||
|
@ -1188,11 +1188,11 @@ impl Scene {
|
|||||||
});
|
});
|
||||||
let hb_pos = [pos.0.x, pos.0.y, pos.0.z + *z_min, 0.0];
|
let hb_pos = [pos.0.x, pos.0.y, pos.0.z + *z_min, 0.0];
|
||||||
let color = if group == Some(&comp::group::ENEMY) {
|
let color = if group == Some(&comp::group::ENEMY) {
|
||||||
[0.5 * 1.0, 0.0, 0.0, 0.0]
|
[1.0, 0.0, 0.0, 0.5]
|
||||||
} else if group == Some(&comp::group::NPC) {
|
} else if group == Some(&comp::group::NPC) {
|
||||||
[0.0, 0.0, 1.0 * 0.5, 0.0]
|
[0.0, 0.0, 1.0, 0.5]
|
||||||
} else {
|
} else {
|
||||||
[0.0, 1.0 * 0.5, 0.0, 0.0]
|
[0.0, 1.0, 0.0, 0.5]
|
||||||
};
|
};
|
||||||
let ori = ori.to_quat();
|
let ori = ori.to_quat();
|
||||||
let hb_ori = [ori.x, ori.y, ori.z, ori.w];
|
let hb_ori = [ori.x, ori.y, ori.z, ori.w];
|
||||||
|
Loading…
Reference in New Issue
Block a user