Skip to content

Commit a84b815

Browse files
committed
When updating tangent space, support packed/octa normals
- only for certain formats where i have seem them used - whether they are used is dependent on the mod specifying a snapshot profile that it used - LLM helped me decode these formats, not exactly sure what the difference is, but there is a difference
1 parent ed59271 commit a84b815

File tree

3 files changed

+238
-30
lines changed

3 files changed

+238
-30
lines changed

Native/mod_load/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ winapi = { version = "0.3", features = ["libloaderapi", "d3d9", "objidlbase",
1111
"processthreadsapi", "memoryapi", "winerror", "winuser", "winreg",
1212
"dinput"] }
1313

14+
[features]
15+
default = []
16+
tangent_debug = ["glam"]
17+
1418
[dependencies]
1519
fnv = "1.0.6"
1620
shared_dx = { path = "../shared_dx" }
1721
util = { path = "../util" }
1822
global_state = { path = "../global_state" }
1923
types = { path = "../types" }
2024
d3dx = { path = "../d3dx" }
21-
device_state = { path = "../device_state" }
25+
device_state = { path = "../device_state" }
26+
glam = { version = "*", optional = true }

Native/mod_load/src/mod_load.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ pub unsafe fn load_d3d_data11(device: *mut ID3D11Device, callbacks: interop::Man
350350
}
351351

352352
let mod_ts_update = (*mdat).update_tangent_space;
353-
let _ = mod_vector::update_normals(vb_data.as_mut_ptr(), &nmd.name, mod_ts_update, vert_count, &vlayout)
353+
let profile = nmd.mod_data.mod_snap_profile; // copy this out, since nmd mutably borrowed, can't pass it as readonly
354+
let _ = mod_vector::update_normals(vb_data.as_mut_ptr(), &nmd.name, profile, mod_ts_update, vert_count, &vlayout)
354355
.map_err(|e| {
355356
write_log_file(&format!("Warning: failed to update normals: {:?}", e));
356357
});

0 commit comments

Comments
 (0)