Skip to content

Commit

Permalink
Assets: Parse Light data and set the clear color accordingly for midn…
Browse files Browse the repository at this point in the history
…ight
  • Loading branch information
MeFisto94 committed Jan 28, 2025
1 parent 94d0412 commit 8e424a5
Show file tree
Hide file tree
Showing 7 changed files with 416 additions and 17 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ Things that still need to be implemented (loosely sorted by priority):

- MPQ: Load order of interface MPQs
- Third Person Camera Controller (and sending `MOVE_FACING` packets / reworking the movement tracker)
- Instanced Rendering of M2s (UnitMaterial is currently created in-place, even if the same texture has already been
used.) It remains to be seen if that is enough for rend3 to auto instance, though.
- Debug Shader Reloading
- Lights Improvement (especially the SkyLight: Implement a game time that ticks, support ambient color)
- Configuration
- Cross Platform support (i.e. investigate MBP 2011 failure)
- massive Map Manager rework
- Portals, Water, and other less important render objects
- Anisotropic Filtering, basically setting SamplerDesc#anisotropy_clamp > 1, POT, < 16 (based on the device limits)
- hecs:
- Add more components and unpack update messages further
- Implement spline walking (NPCs have predefined splines)
- Rendering thereof
- Debug Shader Reloading
- Configuration
- Cross Platform support (i.e. investigate MBP 2011 failure)
- Physics:
- Interpolation of Player Position (otherwise stuttery feel)
- Verify that the colliders are scaled in the right coordinate system (e.g. scaling along z does the right, expected
Expand All @@ -48,14 +54,11 @@ Things that still need to be implemented (loosely sorted by priority):
- Reading of DBC files, especially in preparation for:
- Game Logic. Casting spells and showing stats (mana, health) mainly.
- Somehow handle locales. We get MPQs from one locale mostly and that locale is the only one filled in DBC strings
- massive Map Manager rework
- Portals, Water, and other less important render objects
- Audio System, potentially leveraging HRTF and precise reflection and absorption (e.g. SteamAudio)
- UI/Addon System: This will most likely be using mlua and if possible port
the entirety of "`FrameXML`", so that the original UI code can be run, but for that
a lot of API surface and especially the related event handling and layout management
needs to be handled from scratch.
- Advanced game "logic" (e.g. chat, friend list, guilds, trading, auction house)
- Advanced rendering techniques: AO, TAA, VXGI?
- Anisotropic Filtering, basically setting SamplerDesc#anisotropy_clamp > 1, POT, < 16 (based on the device limits)
- https://docs.rs/arc-swap/latest/arc_swap/
24 changes: 19 additions & 5 deletions src/game/game_state.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use crate::game::application::GameApplication;
use crate::game::map_light_settings_provider::MapLightSettingsProvider;
use crate::game::map_manager::MapManager;
use crate::io::common::loader::RawAssetLoader;
use crate::io::mpq::loader::MPQLoader;
use crate::networking::utils::net_vector3d_to_glam;
use crate::physics::physics_state::PhysicsState;
use glam::Vec3A;
use itertools::Itertools;
use log::{debug, error};
use std::io::Cursor;
use std::ops::Deref;
Expand All @@ -17,6 +19,7 @@ use wow_world_messages::wrath::{Map, Vector3d};
pub struct GameState {
pub app: Weak<GameApplication>,
pub map_manager: Arc<RwLock<MapManager>>,
pub map_light_settings_provider: MapLightSettingsProvider,
// TODO: this is apparently in ADT space, this _has_ to be changed to blender space?
pub player_location: RwLock<Vec3A>,
pub player_orientation: RwLock<f32>,
Expand All @@ -28,6 +31,7 @@ impl GameState {
pub fn new(app: Weak<GameApplication>, mpq_loader: Arc<MPQLoader>) -> Self {
Self {
map_manager: Arc::new(RwLock::new(MapManager::new(mpq_loader.clone()))),
map_light_settings_provider: MapLightSettingsProvider::build(mpq_loader.clone()),
player_location: RwLock::new(Vec3A::new(0.0, 0.0, 0.0)),
player_orientation: RwLock::new(0.0),
physics_state: Arc::new(PhysicsState::new(app.clone())),
Expand Down Expand Up @@ -97,10 +101,20 @@ impl GameState {
.write()
.expect("Player Orientation write lock") = orientation;

self.map_manager.write().unwrap().preload_map(
map_row.directory.clone(),
net_vector3d_to_glam(position),
orientation,
);
let lights = self
.map_light_settings_provider
.get_settings_for_map(map_row.id.id);

{
let mut mm = self.map_manager.write().expect("Map Manager write lock");

mm.update_lights(lights);

mm.preload_map(
map_row.directory.clone(),
net_vector3d_to_glam(position),
orientation,
);
}
}
}
Loading

0 comments on commit 8e424a5

Please sign in to comment.