Fix the orientation of the rendering

Reenable the rendering of the player
This commit is contained in:
Capucho 2020-12-06 16:22:35 +00:00 committed by Avi Weinstock
parent 03f5e65867
commit 3bdd25ec4c
3 changed files with 11 additions and 12 deletions

View File

@ -53,7 +53,7 @@ float depth_at(vec2 uv) {
vec3 wpos_at(vec2 uv) {
float buf_depth = texture(sampler2D(t_src_depth, s_src_depth), uv).x * 2.0 - 1.0;
mat4 inv = view_mat_inv * proj_mat_inv;//inverse(all_mat);
vec4 clip_space = vec4(uv * 2.0 - 1.0, buf_depth, 1.0);
vec4 clip_space = vec4((uv * 2.0 - 1.0) * vec2(1, -1), buf_depth, 1.0);
vec4 view_space = inv * clip_space;
view_space /= view_space.w;
if (buf_depth == 1.0) {

View File

@ -7,8 +7,8 @@ pub use load::load_mesh; // TODO: Don't make this public.
use crate::{
ecs::comp::Interpolated,
render::{
pipelines, ColLightInfo, Consts, FigureBoneData, FigureLocals, FigureModel, GlobalModel,
LodData, Mesh, RenderError, Renderer, SubModel, TerrainVertex, Texture,
pipelines, ColLightInfo, FigureBoneData, FigureLocals, FigureModel, FirstPassDrawer,
GlobalModel, LodData, Mesh, RenderError, Renderer, SubModel, TerrainVertex,
},
scene::{
camera::{Camera, CameraMode, Dependents},
@ -63,7 +63,7 @@ pub type CameraData<'a> = (&'a Camera, f32);
pub type FigureModelRef<'a> = (
&'a pipelines::figure::BoundLocals,
SubModel<'a, TerrainVertex>,
&'a Texture, /* <ColLightFmt> */
&'a pipelines::figure::ColLights, /* <ColLightFmt> */
);
/// An entry holding enough information to draw or destroy a figure in a
@ -4668,9 +4668,9 @@ impl FigureMgr {
}
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn render_player(
&self,
renderer: &mut Renderer,
pub fn render_player<'a>(
&'a self,
drawer: &mut FirstPassDrawer<'a>,
state: &State,
player_entity: EcsEntity,
tick: u64,
@ -4709,8 +4709,7 @@ impl FigureMgr {
figure_lod_render_distance,
|state| state.visible(),
) {
//renderer.render_player(model, &col_lights, global, locals,
// bone_consts, lod);
drawer.draw_figure(model, bound, col_lights);
/*renderer.render_player_shadow(
model,
&col_lights,

View File

@ -1017,15 +1017,15 @@ impl Scene {
}*/
let lod = self.lod.get_data();
/*self.figure_mgr.render_player(
renderer,
self.figure_mgr.render_player(
drawer,
state,
player_entity,
tick,
global,
lod,
camera_data,
);*/
);
// Render terrain and figures.
/*self.terrain.render(renderer, global, lod, focus_pos);