2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-01 14:37:25 +00:00

refactor: streamline obj compiling asset loading

This commit is contained in:
Jan Laupetin
2025-08-05 18:51:56 +02:00
parent 95a6a028ab
commit 33c09dfe61
31 changed files with 505 additions and 495 deletions

View File

@@ -26,13 +26,13 @@ namespace
m_creators(m_zone),
m_ignored_assets(),
m_context(m_zone, &m_creators, &m_ignored_assets),
m_kvp_creator(m_zone_states.GetZoneAssetCreationState<KeyValuePairsCreator>())
m_kvp_creator(m_zone_states.GetZoneAssetCreationState<::key_value_pairs::Creator>())
{
}
std::unique_ptr<IAssetCreator> CreateSut()
{
return CreateKeyValuePairsCompiler(m_memory, m_zone, m_zone_definition, m_zone_states);
return T6::key_value_pairs::CreateCompiler(m_memory, m_zone, m_zone_definition, m_zone_states);
}
TestMemoryManager m_memory;
@@ -43,7 +43,7 @@ namespace
IgnoredAssetLookup m_ignored_assets;
AssetCreationContext m_context;
KeyValuePairsCreator& m_kvp_creator;
::key_value_pairs::Creator& m_kvp_creator;
};
} // namespace
@@ -81,7 +81,7 @@ namespace test::game::t6::keyvaluepairs
TestContext testContext;
const auto sut = testContext.CreateSut();
testContext.m_kvp_creator.AddKeyValuePair(CommonKeyValuePair("ipak_read", "test_ipak"));
testContext.m_kvp_creator.AddKeyValuePair(::key_value_pairs::CommonKeyValuePair("ipak_read", "test_ipak"));
sut->FinalizeZone(testContext.m_context);
@@ -107,7 +107,7 @@ namespace test::game::t6::keyvaluepairs
TestContext testContext;
const auto sut = testContext.CreateSut();
testContext.m_kvp_creator.AddKeyValuePair(CommonKeyValuePair(0xDDEEFFAA, "hello_there"));
testContext.m_kvp_creator.AddKeyValuePair(::key_value_pairs::CommonKeyValuePair(0xDDEEFFAA, "hello_there"));
sut->FinalizeZone(testContext.m_context);

View File

@@ -26,9 +26,9 @@ namespace
{
}
IPakCreator& CreateSut()
image::IPakCreator& CreateSut()
{
return m_zone_states.GetZoneAssetCreationState<IPakCreator>();
return m_zone_states.GetZoneAssetCreationState<image::IPakCreator>();
}
Zone m_zone;

View File

@@ -28,13 +28,13 @@ namespace
m_ignored_assets(),
m_out_dir(),
m_context(m_zone, &m_creators, &m_ignored_assets),
m_ipak_creator(m_zone_states.GetZoneAssetCreationState<IPakCreator>())
m_ipak_creator(m_zone_states.GetZoneAssetCreationState<image::IPakCreator>())
{
}
std::unique_ptr<IAssetPostProcessor> CreateSut()
{
return std::make_unique<ImageIPakPostProcessor<AssetImage>>(m_zone_definition_context, m_search_path, m_zone_states, m_out_dir);
return std::make_unique<image::IPakPostProcessor<AssetImage>>(m_zone_definition_context, m_search_path, m_zone_states, m_out_dir);
}
Zone m_zone;
@@ -47,7 +47,7 @@ namespace
MockOutputPath m_out_dir;
AssetCreationContext m_context;
IPakCreator& m_ipak_creator;
image::IPakCreator& m_ipak_creator;
};
} // namespace

View File

@@ -33,7 +33,7 @@ namespace
std::unique_ptr<IAssetPostProcessor> CreateSut()
{
return std::make_unique<ImageIwdPostProcessor<AssetImage>>(m_zone_definition_context, m_search_path, m_zone_states, m_out_dir);
return std::make_unique<image::IwdPostProcessor<AssetImage>>(m_zone_definition_context, m_search_path, m_zone_states, m_out_dir);
}
Zone m_zone;

View File

@@ -13,7 +13,7 @@ namespace test::keyvaluepairs
{
TEST_CASE("KeyValuePairsCreator: ZoneDefinition with no properties produces no KeyValuePairs", "[keyvaluepairs]")
{
KeyValuePairsCreator sut;
key_value_pairs::Creator sut;
ZoneDefinition zoneDefinition;
sut.Finalize(zoneDefinition);
@@ -25,7 +25,7 @@ namespace test::keyvaluepairs
TEST_CASE("KeyValuePairsCreator: ZoneDefinition with unrelated properties produce no KeyValuePairs", "[keyvaluepairs]")
{
KeyValuePairsCreator sut;
key_value_pairs::Creator sut;
ZoneDefinition zoneDefinition;
zoneDefinition.m_properties.AddProperty("linker.test", "yes");
@@ -38,7 +38,7 @@ namespace test::keyvaluepairs
TEST_CASE("KeyValuePairsCreator: ZoneDefinition with level properties produce KeyValuePairs", "[keyvaluepairs]")
{
KeyValuePairsCreator sut;
key_value_pairs::Creator sut;
ZoneDefinition zoneDefinition;
zoneDefinition.m_properties.AddProperty("linker.test", "yes");
@@ -56,7 +56,7 @@ namespace test::keyvaluepairs
TEST_CASE("KeyValuePairsCreator: ZoneDefinition can have level properties with hash", "[keyvaluepairs]")
{
KeyValuePairsCreator sut;
key_value_pairs::Creator sut;
ZoneDefinition zoneDefinition;
zoneDefinition.m_properties.AddProperty("level.@D34DB33F", "yes");
@@ -77,7 +77,7 @@ namespace test::keyvaluepairs
TEST_CASE("KeyValuePairsCreator: ZoneDefinition can have level properties with name and/or hash", "[keyvaluepairs]")
{
KeyValuePairsCreator sut;
key_value_pairs::Creator sut;
ZoneDefinition zoneDefinition;
zoneDefinition.m_properties.AddProperty("level.ipak_read", "asdf");