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.
This commit is contained in:
Pokechu22
2024-09-24 23:46:45 -07:00
parent 35ec2e97a8
commit 937bb2aa2e
15 changed files with 140 additions and 83 deletions

View File

@ -702,6 +702,7 @@ TEST_P(VertexLoaderNormalTest, NormalAll)
input_with_expected_type(i / 32.f);
// Pre-fill these values to detect if they're modified
VertexLoaderManager::normal_cache = {-42.f, -43.f, -44.f, -45.f};
VertexLoaderManager::binormal_cache = {42.f, 43.f, 44.f, 45.f};
VertexLoaderManager::tangent_cache = {46.f, 47.f, 48.f, 49.f};
@ -738,6 +739,9 @@ TEST_P(VertexLoaderNormalTest, NormalAll)
ExpectOut(10 / 32.f);
ExpectOut(11 / 32.f);
ExpectOut(12 / 32.f);
EXPECT_EQ(VertexLoaderManager::normal_cache[0], 10 / 32.f);
EXPECT_EQ(VertexLoaderManager::normal_cache[1], 11 / 32.f);
EXPECT_EQ(VertexLoaderManager::normal_cache[2], 12 / 32.f);
if (elements == NormalComponentCount::NTB)
{
// Tangent
@ -759,6 +763,14 @@ TEST_P(VertexLoaderNormalTest, NormalAll)
}
}
if (addr == VertexComponentFormat::NotPresent)
{
// Expect these to not be written
EXPECT_EQ(VertexLoaderManager::normal_cache[0], -42.f);
EXPECT_EQ(VertexLoaderManager::normal_cache[1], -43.f);
EXPECT_EQ(VertexLoaderManager::normal_cache[2], -44.f);
EXPECT_EQ(VertexLoaderManager::normal_cache[3], -45.f);
}
if (addr == VertexComponentFormat::NotPresent || elements == NormalComponentCount::N)
{
// Expect these to not be written