From ada3583df2b29724bb04a8bb955a6a223704d5d4 Mon Sep 17 00:00:00 2001 From: Hirek Date: Tue, 13 Jan 2026 09:51:46 +0100 Subject: [PATCH] Change e3d position of diffuseMultiplier --- Model3d.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Model3d.cpp b/Model3d.cpp index 6aec7d89..5d71caf3 100644 --- a/Model3d.cpp +++ b/Model3d.cpp @@ -1720,7 +1720,6 @@ void TSubModel::serialize(std::ostream &s, std::vector &models, std sn_utils::s_vec4(s, f4Ambient); sn_utils::s_vec4(s, f4Diffuse); - sn_utils::ls_float32(s, diffuseMultiplier); sn_utils::s_vec4(s, f4Specular); sn_utils::s_vec4(s, f4Emision); @@ -1741,6 +1740,10 @@ void TSubModel::serialize(std::ostream &s, std::vector &models, std sn_utils::ls_int32(s, m_geometry.index_count); sn_utils::ls_int32(s, m_geometry.index_offset); + // external data + sn_utils::ls_float32(s, diffuseMultiplier); + + // fill empty space size_t fill = end - s.tellp(); for (size_t i = 0; i < fill; i++) s.put(0); @@ -1890,10 +1893,6 @@ void TSubModel::deserialize(std::istream &s) f4Ambient = sn_utils::d_vec4(s); f4Diffuse = sn_utils::d_vec4(s); - diffuseMultiplier = sn_utils::ld_float32(s); - // only multiply diffuse on experimental renderer - if (!Global.NvRenderer) - f4Diffuse /= diffuseMultiplier; f4Specular = sn_utils::d_vec4(s); f4Emision = sn_utils::d_vec4(s); @@ -1912,6 +1911,13 @@ void TSubModel::deserialize(std::istream &s) // HACK: the values will be 0 also when reading legacy chunk m_geometry.index_count = sn_utils::ld_int32(s); m_geometry.index_offset = sn_utils::ld_int32(s); + + // extra data block + diffuseMultiplier = sn_utils::ld_float32(s); + // only multiply diffuse on experimental renderer + if (!Global.NvRenderer) + f4Diffuse /= diffuseMultiplier; + // necessary rotations were already done during t3d->e3d conversion m_rotation_init_done = true; }