mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Revert some irrelevant stuff.
This commit is contained in:
parent
2e2ab3dc1e
commit
add2cfae04
@ -126,7 +126,7 @@ float lights_at(vec3 wpos, vec3 wnorm, vec3 /*cam_to_frag*/view_dir, vec3 mu, ve
|
|||||||
vec3 directed_light = vec3(0.0);
|
vec3 directed_light = vec3(0.0);
|
||||||
vec3 max_light = vec3(0.0);
|
vec3 max_light = vec3(0.0);
|
||||||
|
|
||||||
const float LIGHT_AMBIANCE = 0.015625;
|
const float LIGHT_AMBIANCE = 0.0;//0.015625;
|
||||||
|
|
||||||
for (uint i = 0u; i < /*light_shadow_count.x*//*0u*/light_shadow_count.x/*32u*/; i ++) {
|
for (uint i = 0u; i < /*light_shadow_count.x*//*0u*/light_shadow_count.x/*32u*/; i ++) {
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ float lights_at(vec3 wpos, vec3 wnorm, vec3 /*cam_to_frag*/view_dir, vec3 mu, ve
|
|||||||
vec3 direct_light = PI * color * strength * square_factor * 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 * strength * square_factor * light_reflection_factor(/*direct_norm_dir*/wnorm, /*cam_to_frag*/view_dir, direct_light_dir, k_d, k_s, alpha, voxel_norm, voxel_lighting);
|
||||||
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);
|
||||||
// directed_light += is_direct ? mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor : vec3(0.0);
|
directed_light += is_direct ? mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor : vec3(0.0);
|
||||||
directed_light += (is_direct ? 1.0 : LIGHT_AMBIANCE) * max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor;// : vec3(0.0);
|
// directed_light += (is_direct ? 1.0 : LIGHT_AMBIANCE) * max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor;// : vec3(0.0);
|
||||||
// directed_light += mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor;
|
// directed_light += mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor;
|
||||||
// ambient_light += is_direct ? vec3(0.0) : vec3(0.0); // direct_light * square_factor * LIGHT_AMBIANCE;
|
// ambient_light += is_direct ? vec3(0.0) : vec3(0.0); // direct_light * square_factor * LIGHT_AMBIANCE;
|
||||||
// ambient_light += is_direct ? direct_light * (1.0 - square_factor * LIGHT_AMBIANCE) : vec3(0.0);
|
// ambient_light += is_direct ? direct_light * (1.0 - square_factor * LIGHT_AMBIANCE) : vec3(0.0);
|
||||||
|
@ -138,7 +138,7 @@ float ShadowCalculationPoint(uint lightIndex, vec3 fragToLight, vec3 fragNorm, /
|
|||||||
|
|
||||||
float ShadowCalculationDirected(in vec3 fragPos)//in vec4 /*light_pos[2]*/sun_pos, vec3 fragPos)
|
float ShadowCalculationDirected(in vec3 fragPos)//in vec4 /*light_pos[2]*/sun_pos, vec3 fragPos)
|
||||||
{
|
{
|
||||||
float bias = 0.001;//0.0005;//-0.0001;// 0.05 / (2.0 * view_distance.x);
|
float bias = 0.000;//0.0005;//-0.0001;// 0.05 / (2.0 * view_distance.x);
|
||||||
float diskRadius = 0.01;
|
float diskRadius = 0.01;
|
||||||
const vec3 sampleOffsetDirections[20] = vec3[]
|
const vec3 sampleOffsetDirections[20] = vec3[]
|
||||||
(
|
(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{
|
use super::{
|
||||||
super::{
|
super::{
|
||||||
ColLightFmt, ColLightInfo, Light, Pipeline, RenderError, Renderer, ShadowDepthStencilFmt,
|
ColLightFmt, ColLightInfo, Pipeline, RenderError, Renderer, ShadowDepthStencilFmt,
|
||||||
TerrainLocals, Texture,
|
TerrainLocals, Texture,
|
||||||
},
|
},
|
||||||
figure, terrain, Globals,
|
figure, terrain, Globals,
|
||||||
@ -30,7 +30,7 @@ gfx_defines! {
|
|||||||
|
|
||||||
locals: gfx::ConstantBuffer<TerrainLocals> = "u_locals",
|
locals: gfx::ConstantBuffer<TerrainLocals> = "u_locals",
|
||||||
globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
||||||
lights: gfx::ConstantBuffer<Light> = "u_lights",
|
// lights: gfx::ConstantBuffer<Light> = "u_lights",
|
||||||
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
||||||
|
|
||||||
// map: gfx::TextureSampler<[f32; 4]> = "t_map",
|
// map: gfx::TextureSampler<[f32; 4]> = "t_map",
|
||||||
@ -42,7 +42,7 @@ gfx_defines! {
|
|||||||
light_shadows: gfx::ConstantBuffer<Locals> = "u_light_shadows",
|
light_shadows: gfx::ConstantBuffer<Locals> = "u_light_shadows",
|
||||||
|
|
||||||
tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::state::Depth {
|
tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::state::Depth {
|
||||||
fun: gfx::state::Comparison::LessEqual,
|
fun: gfx::state::Comparison::Less,
|
||||||
write: true,
|
write: true,
|
||||||
},
|
},
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::preset::depth::LESS_EQUAL_WRITE,//,Stencil::new(Comparison::Always,0xff,(StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))),
|
// tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::preset::depth::LESS_EQUAL_WRITE,//,Stencil::new(Comparison::Always,0xff,(StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))),
|
||||||
@ -67,7 +67,7 @@ gfx_defines! {
|
|||||||
light_shadows: gfx::ConstantBuffer<Locals> = "u_light_shadows",
|
light_shadows: gfx::ConstantBuffer<Locals> = "u_light_shadows",
|
||||||
|
|
||||||
tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::state::Depth {
|
tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::state::Depth {
|
||||||
fun: gfx::state::Comparison::LessEqual,
|
fun: gfx::state::Comparison::Less,
|
||||||
write: true,
|
write: true,
|
||||||
},
|
},
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::preset::depth::LESS_WRITE,//,Stencil::new(Comparison::Always,0xff,(StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))),
|
// tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> = gfx::preset::depth::LESS_WRITE,//,Stencil::new(Comparison::Always,0xff,(StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))),
|
||||||
|
@ -1388,8 +1388,8 @@ impl Renderer {
|
|||||||
globals: &Consts<Globals>,
|
globals: &Consts<Globals>,
|
||||||
terrain_locals: &Consts<terrain::Locals>,
|
terrain_locals: &Consts<terrain::Locals>,
|
||||||
locals: &Consts<shadow::Locals>,
|
locals: &Consts<shadow::Locals>,
|
||||||
lights: &Consts<Light>,
|
/* lights: &Consts<Light>,
|
||||||
/* shadows: &Consts<Shadow>,
|
* shadows: &Consts<Shadow>,
|
||||||
* map: &Texture<LodColorFmt>,
|
* map: &Texture<LodColorFmt>,
|
||||||
* horizon: &Texture<LodTextureFmt>, */
|
* horizon: &Texture<LodTextureFmt>, */
|
||||||
) {
|
) {
|
||||||
@ -1419,7 +1419,7 @@ impl Renderer {
|
|||||||
vbuf: model.vbuf.clone(),
|
vbuf: model.vbuf.clone(),
|
||||||
locals: terrain_locals.buf.clone(),
|
locals: terrain_locals.buf.clone(),
|
||||||
globals: globals.buf.clone(),
|
globals: globals.buf.clone(),
|
||||||
lights: lights.buf.clone(),
|
// lights: lights.buf.clone(),
|
||||||
// shadows: shadows.buf.clone(),
|
// shadows: shadows.buf.clone(),
|
||||||
// noise: (self.noise_tex.srv.clone(), self.noise_tex.sampler.clone()),
|
// noise: (self.noise_tex.srv.clone(), self.noise_tex.sampler.clone()),
|
||||||
// map: (map.srv.clone(), map.sampler.clone()),
|
// map: (map.srv.clone(), map.sampler.clone()),
|
||||||
@ -1443,8 +1443,8 @@ impl Renderer {
|
|||||||
globals: &Consts<Globals>,
|
globals: &Consts<Globals>,
|
||||||
terrain_locals: &Consts<terrain::Locals>,
|
terrain_locals: &Consts<terrain::Locals>,
|
||||||
locals: &Consts<shadow::Locals>,
|
locals: &Consts<shadow::Locals>,
|
||||||
lights: &Consts<Light>,
|
/* lights: &Consts<Light>,
|
||||||
/* shadows: &Consts<Shadow>,
|
* shadows: &Consts<Shadow>,
|
||||||
* map: &Texture<LodColorFmt>,
|
* map: &Texture<LodColorFmt>,
|
||||||
* horizon: &Texture<LodTextureFmt>, */
|
* horizon: &Texture<LodTextureFmt>, */
|
||||||
) {
|
) {
|
||||||
@ -1474,7 +1474,7 @@ impl Renderer {
|
|||||||
vbuf: model.vbuf.clone(),
|
vbuf: model.vbuf.clone(),
|
||||||
locals: terrain_locals.buf.clone(),
|
locals: terrain_locals.buf.clone(),
|
||||||
globals: globals.buf.clone(),
|
globals: globals.buf.clone(),
|
||||||
lights: lights.buf.clone(),
|
// lights: lights.buf.clone(),
|
||||||
// shadows: shadows.buf.clone(),
|
// shadows: shadows.buf.clone(),
|
||||||
// noise: (self.noise_tex.srv.clone(), self.noise_tex.sampler.clone()),
|
// noise: (self.noise_tex.srv.clone(), self.noise_tex.sampler.clone()),
|
||||||
// map: (map.srv.clone(), map.sampler.clone()),
|
// map: (map.srv.clone(), map.sampler.clone()),
|
||||||
@ -2089,8 +2089,9 @@ fn create_pipelines(
|
|||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
&include_ctx,
|
&include_ctx,
|
||||||
gfx::state::CullFace::Front,
|
gfx::state::CullFace::Back,
|
||||||
Some(gfx::state::Offset(2, /* 10 */ 0)),
|
None,
|
||||||
|
// Some(gfx::state::Offset(2, /* 10 */ 0)),
|
||||||
) {
|
) {
|
||||||
Ok(pipe) => Some(pipe),
|
Ok(pipe) => Some(pipe),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -438,8 +438,8 @@ impl FigureMgr {
|
|||||||
// Are shadows enabled at all?
|
// Are shadows enabled at all?
|
||||||
let can_shadow_sun = renderer.render_mode().shadow.is_map() && is_daylight;
|
let can_shadow_sun = renderer.render_mode().shadow.is_map() && is_daylight;
|
||||||
let Dependents {
|
let Dependents {
|
||||||
proj_mat,
|
proj_mat: _,
|
||||||
view_mat,
|
view_mat: _,
|
||||||
cam_pos,
|
cam_pos,
|
||||||
} = camera.dependents();
|
} = camera.dependents();
|
||||||
let cam_pos = math::Vec3::from(cam_pos);
|
let cam_pos = math::Vec3::from(cam_pos);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use core::{iter, mem};
|
use core::{iter, mem};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use num::traits::Float;
|
use num::traits::Float;
|
||||||
// pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*,
|
pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*, vec::repr_simd::*};
|
||||||
// vec::repr_simd::*};
|
// pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*,
|
||||||
pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*, vec::repr_c::*};
|
// vec::repr_c::*};
|
||||||
|
|
||||||
pub fn aabb_to_points<T: Float>(bounds: Aabb<T>) -> [Vec3<T>; 8] {
|
pub fn aabb_to_points<T: Float>(bounds: Aabb<T>) -> [Vec3<T>; 8] {
|
||||||
[
|
[
|
||||||
|
@ -569,7 +569,7 @@ impl Scene {
|
|||||||
|
|
||||||
// Maintain the terrain.
|
// Maintain the terrain.
|
||||||
let (
|
let (
|
||||||
/* _scene_bounds, visible_bounds, _psc_bounds */ visible_bounds,
|
/* _scene_bounds, visible_bounds, _psc_bounds */ _visible_bounds,
|
||||||
visible_light_volume,
|
visible_light_volume,
|
||||||
visible_psr_bounds,
|
visible_psr_bounds,
|
||||||
) = self.terrain.maintain(
|
) = self.terrain.maintain(
|
||||||
@ -775,8 +775,8 @@ impl Scene {
|
|||||||
.scaled_3d(Vec3::new(proj_mat[(0, 0)], proj_mat[(1, 1)], 1.0));
|
.scaled_3d(Vec3::new(proj_mat[(0, 0)], proj_mat[(1, 1)], 1.0));
|
||||||
let focus_off = focus_pos.map(|e| e.trunc()); */
|
let focus_off = focus_pos.map(|e| e.trunc()); */
|
||||||
let z_n = 1.0; //f64::from(camera::NEAR_PLANE);
|
let z_n = 1.0; //f64::from(camera::NEAR_PLANE);
|
||||||
let z_f = f64::from(camera::FAR_PLANE);
|
let _z_f = f64::from(camera::FAR_PLANE);
|
||||||
let scalar_fov = /*f64::from(fov / 2.0)*/compute_scalar_fov(z_n, f64::from(fov), f64::from(aspect_ratio));
|
let _scalar_fov = /*f64::from(fov / 2.0)*/compute_scalar_fov(z_n, f64::from(fov), f64::from(aspect_ratio));
|
||||||
shadow_mats.extend(directed_shadow_mats.iter().enumerate().map(move |(idx, &light_view_mat)| {
|
shadow_mats.extend(directed_shadow_mats.iter().enumerate().map(move |(idx, &light_view_mat)| {
|
||||||
if idx >= NUM_DIRECTED_LIGHTS {
|
if idx >= NUM_DIRECTED_LIGHTS {
|
||||||
return ShadowLocals::new(Mat4::identity(), Mat4::identity());
|
return ShadowLocals::new(Mat4::identity(), Mat4::identity());
|
||||||
@ -911,7 +911,8 @@ impl Scene {
|
|||||||
let cos_gamma = new_dir.map(f64::from).dot(directed_light_dir.map(f64::from));
|
let cos_gamma = new_dir.map(f64::from).dot(directed_light_dir.map(f64::from));
|
||||||
let sin_gamma = (1.0 - cos_gamma * cos_gamma).sqrt();
|
let sin_gamma = (1.0 - cos_gamma * cos_gamma).sqrt();
|
||||||
let gamma = sin_gamma.asin()/*cos_gamma.acos()*/;
|
let gamma = sin_gamma.asin()/*cos_gamma.acos()*/;
|
||||||
let bounds1 = math::fit_psr(view_mat, visible_light_volume.iter().copied(), math::Vec4::homogenized);
|
let view_mat = math::Mat4::from_col_array(view_mat.into_col_array());
|
||||||
|
let bounds1 = math::fit_psr(view_mat.map_cols(math::Vec4::from), visible_light_volume.iter().copied(), math::Vec4::homogenized);
|
||||||
let n_e = f64::from(-bounds1.max.z);
|
let n_e = f64::from(-bounds1.max.z);
|
||||||
// let f_e = f64::from(-bounds1.min.z);
|
// let f_e = f64::from(-bounds1.min.z);
|
||||||
// let fov = 2.0 * aspect_ratio * (fov / 2.0).tan();
|
// let fov = 2.0 * aspect_ratio * (fov / 2.0).tan();
|
||||||
@ -988,7 +989,7 @@ impl Scene {
|
|||||||
0.0, 0.0, 0.0, 1.0,
|
0.0, 0.0, 0.0, 1.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
let w_p_arr = solve_p0.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
// let _w_p_arr = solve_p0.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
||||||
// println!("mat4 solve_p0 = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
// println!("mat4 solve_p0 = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
||||||
|
|
||||||
let p0_world = solve_p0.inverted() * math::Vec4::unit_w();
|
let p0_world = solve_p0.inverted() * math::Vec4::unit_w();
|
||||||
@ -1286,7 +1287,7 @@ impl Scene {
|
|||||||
0.0, 0.0, 1.0, 0.0,
|
0.0, 0.0, 1.0, 0.0,
|
||||||
0.0, 1.0, 0.0, 0.0,
|
0.0, 1.0, 0.0, 0.0,
|
||||||
); */
|
); */
|
||||||
let _w_p_arr = w_p.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
// let _w_p_arr = w_p.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
||||||
// println!("mat4 w_p = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
// println!("mat4 w_p = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
||||||
// let w_p: Mat4<f32> = Mat4::identity();
|
// let w_p: Mat4<f32> = Mat4::identity();
|
||||||
// let zmin = p1.z.min(p4.z);
|
// let zmin = p1.z.min(p4.z);
|
||||||
@ -1312,7 +1313,7 @@ impl Scene {
|
|||||||
far: zmax,//directed_far,
|
far: zmax,//directed_far,
|
||||||
}); */
|
}); */
|
||||||
let shadow_all_mat: math::Mat4<f32> = /*(w_v * l_r).inverted() * */w_p * shadow_view_mat/*w_v * light_all_mat*/;
|
let shadow_all_mat: math::Mat4<f32> = /*(w_v * l_r).inverted() * */w_p * shadow_view_mat/*w_v * light_all_mat*/;
|
||||||
let _w_p_arr = shadow_all_mat.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
// let _w_p_arr = shadow_all_mat.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
||||||
// println!("mat4 shadow_all_mat = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
// println!("mat4 shadow_all_mat = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
||||||
let math::Aabb::<f32> { min: math::Vec3 { x: xmin, y: ymin, z: zmin }, max: math::Vec3 { x: xmax, y: ymax, z: zmax } } =
|
let math::Aabb::<f32> { min: math::Vec3 { x: xmin, y: ymin, z: zmin }, max: math::Vec3 { x: xmax, y: ymax, z: zmax } } =
|
||||||
math::fit_psr(/*light_all_mat*/shadow_all_mat/*shadow_view_mat*//* * inverse_visible*/, visible_light_volume.iter().copied(), /*|p| math::Vec3::from(p) / p.w*/math::Vec4::homogenized);
|
math::fit_psr(/*light_all_mat*/shadow_all_mat/*shadow_view_mat*//* * inverse_visible*/, visible_light_volume.iter().copied(), /*|p| math::Vec3::from(p) / p.w*/math::Vec4::homogenized);
|
||||||
@ -1349,11 +1350,11 @@ impl Scene {
|
|||||||
}/*.scaled_3d(Vec3::new(1.0, 1.0, -1.0))*//* * w_p * w_v*//* * l_r*/;//Mat4::identity();
|
}/*.scaled_3d(Vec3::new(1.0, 1.0, -1.0))*//* * w_p * w_v*//* * l_r*/;//Mat4::identity();
|
||||||
// println!("proj_mat: {:?}", directed_proj_mat);
|
// println!("proj_mat: {:?}", directed_proj_mat);
|
||||||
// println!("all_mat: {:?}", directed_proj_mat * view_mat);
|
// println!("all_mat: {:?}", directed_proj_mat * view_mat);
|
||||||
let _w_p_arr = directed_proj_mat.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
// let _w_p_arr = directed_proj_mat.cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
||||||
// println!("mat4 directed_proj_mat = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
// println!("mat4 directed_proj_mat = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
||||||
|
|
||||||
let shadow_all_mat: Mat4<f32> = Mat4::from_col_arrays(shadow_all_mat.into_col_arrays());
|
let shadow_all_mat: Mat4<f32> = Mat4::from_col_arrays(shadow_all_mat.into_col_arrays());
|
||||||
let _w_p_arr = (directed_proj_mat * shadow_all_mat).cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
// let _w_p_arr = (directed_proj_mat * shadow_all_mat).cols.iter().map(|e| (e.x, e.y, e.z, e.w)).collect::<Vec<_>>();
|
||||||
// println!("mat4 final_mat = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
// println!("mat4 final_mat = mat4(vec4{:?}, vec4{:?}, vec4{:?}, vec4{:?});", w_p_arr[0], w_p_arr[1], w_p_arr[2], w_p_arr[3]);
|
||||||
|
|
||||||
let directed_texture_proj_mat = texture_mat * directed_proj_mat;
|
let directed_texture_proj_mat = texture_mat * directed_proj_mat;
|
||||||
@ -1441,7 +1442,7 @@ impl Scene {
|
|||||||
self.terrain.render_shadows(
|
self.terrain.render_shadows(
|
||||||
renderer,
|
renderer,
|
||||||
&self.globals,
|
&self.globals,
|
||||||
&self.lights,
|
// &self.lights,
|
||||||
&self.shadow_mats,
|
&self.shadow_mats,
|
||||||
&self.light_data,
|
&self.light_data,
|
||||||
is_daylight,
|
is_daylight,
|
||||||
|
@ -2788,7 +2788,7 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
|
|
||||||
// Update chunk visibility
|
// Update chunk visibility
|
||||||
let chunk_sz = V::RECT_SIZE.x as f32;
|
let chunk_sz = V::RECT_SIZE.x as f32;
|
||||||
let scene_bounding_box: Aabb<f32> = Aabb {
|
let _scene_bounding_box: Aabb<f32> = Aabb {
|
||||||
min: focus_pos - 2.0, /*
|
min: focus_pos - 2.0, /*
|
||||||
* - /0.5f32 */
|
* - /0.5f32 */
|
||||||
max: focus_pos + 2.0, /* + 0.5f32 */
|
max: focus_pos + 2.0, /* + 0.5f32 */
|
||||||
@ -2862,7 +2862,7 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// PSCs: Potential shadow casters
|
// PSCs: Potential shadow casters
|
||||||
let psc_bounding_box: Aabb<f32> = visible_bounding_box;
|
let _psc_bounding_box: Aabb<f32> = visible_bounding_box;
|
||||||
/*Aabb {
|
/*Aabb {
|
||||||
min: focus_pos - 0.5f32,
|
min: focus_pos - 0.5f32,
|
||||||
max: focus_pos + 0.5f32,
|
max: focus_pos + 0.5f32,
|
||||||
@ -3083,7 +3083,7 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
&self,
|
&self,
|
||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
globals: &Consts<Globals>,
|
globals: &Consts<Globals>,
|
||||||
lights: &Consts<Light>,
|
// lights: &Consts<Light>,
|
||||||
shadow_mats: &Consts<ShadowLocals>,
|
shadow_mats: &Consts<ShadowLocals>,
|
||||||
light_data: &[Light],
|
light_data: &[Light],
|
||||||
is_daylight: bool,
|
is_daylight: bool,
|
||||||
@ -3124,7 +3124,7 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
globals,
|
globals,
|
||||||
&chunk.locals,
|
&chunk.locals,
|
||||||
shadow_mats,
|
shadow_mats,
|
||||||
lights,
|
/* lights, */
|
||||||
/* shadows,
|
/* shadows,
|
||||||
* &lod.map,
|
* &lod.map,
|
||||||
* &lod.horizon, */
|
* &lod.horizon, */
|
||||||
@ -3146,7 +3146,7 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
globals,
|
globals,
|
||||||
&chunk.locals,
|
&chunk.locals,
|
||||||
shadow_mats,
|
shadow_mats,
|
||||||
lights,
|
/* lights, */
|
||||||
/* shadows,
|
/* shadows,
|
||||||
* &lod.map,
|
* &lod.map,
|
||||||
* &lod.horizon, */
|
* &lod.horizon, */
|
||||||
|
@ -39,7 +39,7 @@ fn main() {
|
|||||||
// world_file: sim::FileOpts::Save,
|
// world_file: sim::FileOpts::Save,
|
||||||
..WorldOpts::default()
|
..WorldOpts::default()
|
||||||
});
|
});
|
||||||
log::info!("Sampling data...");
|
tracing::info!("Sampling data...");
|
||||||
let sampler = world.sim();
|
let sampler = world.sim();
|
||||||
|
|
||||||
let samples_data = {
|
let samples_data = {
|
||||||
|
Loading…
Reference in New Issue
Block a user