diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2024-09-24 23:46:45 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2024-10-12 10:32:41 -0700 |
| commit | 937bb2aa2e12b635ba328af8de7c9a5d5963d084 (patch) | |
| tree | f7e24ca237cdda8cde7e611ee52806fdea96292a /Source/Core/VideoCommon/VertexLoaderBase.cpp | |
| parent | 35ec2e97a8ea90730cb33eceec701f81597f98f7 (diff) | |
Cache normals in addition to binormals and tangents
Fixes LIT (https://bugs.dolphin-emu.org/issues/13635). The text does not include normals, but has lighting enabled. With the previous default of (0, 0, 0), lighting was always black (as dot(X, (0, 0, 0)) is always 0). It seems like the normal from the map in the background (0, 0, 1) is re-used.
LIT also has the vertex color enabled while vertex color is not specified, the same as SMS's debug cubes; the default MissingColorValue GameINI value of solid white seems to work correctly in this case.
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoaderBase.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index 3284a2ccdb..a3597b53e5 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -68,6 +68,7 @@ public: VertexLoaderManager::position_matrix_index_cache; const std::array<std::array<float, 4>, 3> old_position_cache = VertexLoaderManager::position_cache; + const std::array<float, 4> old_normal_cache = VertexLoaderManager::normal_cache; const std::array<float, 4> old_tangent_cache = VertexLoaderManager::tangent_cache; const std::array<float, 4> old_binormal_cache = VertexLoaderManager::binormal_cache; @@ -77,12 +78,14 @@ public: VertexLoaderManager::position_matrix_index_cache; const std::array<std::array<float, 4>, 3> a_position_cache = VertexLoaderManager::position_cache; + const std::array<float, 4> a_normal_cache = VertexLoaderManager::normal_cache; const std::array<float, 4> a_tangent_cache = VertexLoaderManager::tangent_cache; const std::array<float, 4> a_binormal_cache = VertexLoaderManager::binormal_cache; // Reset state before running b VertexLoaderManager::position_matrix_index_cache = old_position_matrix_index_cache; VertexLoaderManager::position_cache = old_position_cache; + VertexLoaderManager::normal_cache = old_normal_cache; VertexLoaderManager::tangent_cache = old_tangent_cache; VertexLoaderManager::binormal_cache = old_binormal_cache; @@ -92,6 +95,7 @@ public: VertexLoaderManager::position_matrix_index_cache; const std::array<std::array<float, 4>, 3> b_position_cache = VertexLoaderManager::position_cache; + const std::array<float, 4> b_normal_cache = VertexLoaderManager::normal_cache; const std::array<float, 4> b_tangent_cache = VertexLoaderManager::tangent_cache; const std::array<float, 4> b_binormal_cache = VertexLoaderManager::binormal_cache; @@ -141,6 +145,12 @@ public: // The last element is allowed to be garbage for SIMD overwrites ASSERT_MSG(VIDEO, + std::equal(a_normal_cache.begin(), a_normal_cache.begin() + 3, + b_normal_cache.begin(), b_normal_cache.begin() + 3, bit_equal), + "Expected matching normal caches after loading (a: {}; b: {})", + fmt::join(a_normal_cache, ", "), fmt::join(b_normal_cache, ", ")); + + ASSERT_MSG(VIDEO, std::equal(a_tangent_cache.begin(), a_tangent_cache.begin() + 3, b_tangent_cache.begin(), b_tangent_cache.begin() + 3, bit_equal), "Expected matching tangent caches after loading (a: {}; b: {})", |
