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) { vec3 wpos_at(vec2 uv) {
float buf_depth = texture(sampler2D(t_src_depth, s_src_depth), uv).x * 2.0 - 1.0; 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); 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; vec4 view_space = inv * clip_space;
view_space /= view_space.w; view_space /= view_space.w;
if (buf_depth == 1.0) { if (buf_depth == 1.0) {

View File

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

View File

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