fix viewpoint meshing

This commit is contained in:
IsseW 2022-08-12 11:51:21 +02:00
parent 9b7a67c80e
commit f77cce68d5
3 changed files with 27 additions and 27 deletions

View File

@ -5706,7 +5706,7 @@ impl FigureMgr {
} }
} }
pub fn render_player<'a>( pub fn render_viewpoint<'a>(
&'a self, &'a self,
drawer: &mut FigureDrawer<'_, 'a>, drawer: &mut FigureDrawer<'_, 'a>,
state: &State, state: &State,
@ -5774,7 +5774,7 @@ impl FigureMgr {
entity: EcsEntity, entity: EcsEntity,
body: &Body, body: &Body,
inventory: Option<&Inventory>, inventory: Option<&Inventory>,
is_player: bool, is_viewpoint: bool,
pos: Vec3<f32>, pos: Vec3<f32>,
figure_lod_render_distance: f32, figure_lod_render_distance: f32,
mut_count: usize, mut_count: usize,
@ -5783,14 +5783,14 @@ impl FigureMgr {
) -> Option<FigureModelRef> { ) -> Option<FigureModelRef> {
let body = *body; let body = *body;
let player_camera_mode = if is_player { let viewpoint_camera_mode = if is_viewpoint {
camera.get_mode() camera.get_mode()
} else { } else {
CameraMode::default() CameraMode::default()
}; };
let focus_pos = camera.get_focus_pos(); let focus_pos = camera.get_focus_pos();
let cam_pos = camera.dependents().cam_pos + focus_pos.map(|e| e.trunc()); let cam_pos = camera.dependents().cam_pos + focus_pos.map(|e| e.trunc());
let character_state = if is_player { character_state } else { None }; let character_state = if is_viewpoint { character_state } else { None };
let FigureMgr { let FigureMgr {
col_lights: ref col_lights_, col_lights: ref col_lights_,
@ -5847,7 +5847,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5864,7 +5864,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5881,7 +5881,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5898,7 +5898,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5915,7 +5915,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5932,7 +5932,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5949,7 +5949,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5966,7 +5966,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -5983,7 +5983,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6000,7 +6000,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6017,7 +6017,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6034,7 +6034,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6051,7 +6051,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6068,7 +6068,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6085,7 +6085,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6102,7 +6102,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
item_key, item_key,
), ),
@ -6121,7 +6121,7 @@ impl FigureMgr {
body, body,
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),
@ -6139,7 +6139,7 @@ impl FigureMgr {
VolumeKey { entity, mut_count }, VolumeKey { entity, mut_count },
inventory, inventory,
tick, tick,
player_camera_mode, viewpoint_camera_mode,
character_state, character_state,
None, None,
), ),

View File

@ -1192,7 +1192,7 @@ impl Scene {
&'a self, &'a self,
drawer: &mut Drawer<'a>, drawer: &mut Drawer<'a>,
state: &State, state: &State,
player_entity: EcsEntity, viewpoint_entity: EcsEntity,
tick: u64, tick: u64,
scene_data: &SceneData, scene_data: &SceneData,
) { ) {
@ -1251,10 +1251,10 @@ impl Scene {
prof_span!(guard, "main pass"); prof_span!(guard, "main pass");
if let Some(mut first_pass) = drawer.first_pass() { if let Some(mut first_pass) = drawer.first_pass() {
self.figure_mgr.render_player( self.figure_mgr.render_viewpoint(
&mut first_pass.draw_figures(), &mut first_pass.draw_figures(),
state, state,
player_entity, viewpoint_entity,
tick, tick,
camera_data, camera_data,
); );
@ -1264,7 +1264,7 @@ impl Scene {
self.figure_mgr.render( self.figure_mgr.render(
&mut first_pass.draw_figures(), &mut first_pass.draw_figures(),
state, state,
player_entity, viewpoint_entity,
tick, tick,
camera_data, camera_data,
); );

View File

@ -1794,7 +1794,7 @@ impl PlayState for SessionState {
self.scene.render( self.scene.render(
drawer, drawer,
client.state(), client.state(),
client.entity(), viewpoint_entity,
client.get_tick(), client.get_tick(),
&scene_data, &scene_data,
); );