Skip to content

Commit

Permalink
#5571: Add unit test checking a specific sinTable lookup I happened t…
Browse files Browse the repository at this point in the history
…o debug
  • Loading branch information
codereader committed Mar 23, 2021
1 parent c996c54 commit d068f28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Materials.cpp
Expand Up @@ -110,6 +110,18 @@ TEST_F(MaterialsTest, IdentifyAmbientLight)
EXPECT_FALSE(nonLight->isAmbientLight());
}

TEST_F(MaterialsTest, MaterialSinTableLookup)
{
auto material = GlobalMaterialManager().getMaterial("textures/parsertest/expressions/sinTableLookup");

auto& stage = material->getAllLayers().front();

// Set time to 5008 seconds, this is the value I happened to run into when debugging this in the engine
stage->evaluateExpressions(5008);

EXPECT_FLOAT_EQ(stage->getAlphaTest(), -0.00502608204f);
}

TEST_F(MaterialsTest, MaterialParserPolygonOffset)
{
auto& materialManager = GlobalMaterialManager();
Expand Down
8 changes: 8 additions & 0 deletions test/resources/tdm/materials/parsertest.mtr
Expand Up @@ -490,3 +490,11 @@ textures/parsertest/lights/lightfalloff3
}
}

textures/parsertest/expressions/sinTableLookup
{
{
blend diffusemap
map _white
alphaTest sinTable[0.5008]
}
}

0 comments on commit d068f28

Please sign in to comment.