mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-02-10 17:43:03 +00:00
refactor: introduce subasset loading
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -51,12 +51,11 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolIW3*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::IW3);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "SimpleZoneIW3");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 1);
|
||||
REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 1);
|
||||
REQUIRE(zone->m_pools.GetAsset<IW3::AssetRawFile>("SimpleZone.txt"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Game/IW4/GameAssetPoolIW4.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -51,12 +51,11 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolIW4*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::IW4);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "SimpleZoneIW4");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 1);
|
||||
REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 1);
|
||||
REQUIRE(zone->m_pools.GetAsset<IW4::AssetRawFile>("SimpleZone.txt"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Game/IW5/GameAssetPoolIW5.h"
|
||||
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -51,12 +52,11 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolIW5*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::IW5);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "SimpleZoneIW5");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 1);
|
||||
REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 1);
|
||||
REQUIRE(zone->m_pools.GetAsset<IW5::AssetRawFile>("SimpleZone.txt"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Game/T5/GameAssetPoolT5.h"
|
||||
#include "Game/T5/T5.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -51,12 +51,11 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolT5*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::T5);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "SimpleZoneT5");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 1);
|
||||
REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 1);
|
||||
REQUIRE(zone->m_pools.GetAsset<T5::AssetRawFile>("SimpleZone.txt"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -9,7 +9,7 @@ In this case:
|
||||
(actual asset, not a reference) techniqueset `trivial_floatz_2992w610`
|
||||
*/
|
||||
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -100,15 +100,14 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolT6*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::T6);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "CombinedZoneT6");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 2);
|
||||
REQUIRE(pools->m_technique_set->GetAsset("trivial_floatz_2992w610"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 2);
|
||||
REQUIRE(zone->m_pools.GetAsset<T6::AssetTechniqueSet>("trivial_floatz_2992w610"));
|
||||
|
||||
const auto* material = pools->m_material->GetAsset("test");
|
||||
const auto* material = zone->m_pools.GetAsset<T6::AssetMaterial>("test");
|
||||
REQUIRE(material);
|
||||
REQUIRE(material->Asset()->techniqueSet);
|
||||
REQUIRE(material->Asset()->techniqueSet->name == "trivial_floatz_2992w610"s);
|
||||
|
||||
@@ -9,7 +9,7 @@ In this case:
|
||||
(actual asset, not a reference) techniqueset `trivial_floatz_2992w610`
|
||||
*/
|
||||
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -103,16 +103,15 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolT6*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::T6);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "TestZone");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 3);
|
||||
REQUIRE(pools->m_material->GetAsset("Suzanne2"));
|
||||
REQUIRE(pools->m_technique_set->GetAsset(",trivial_floatz_2992w610"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 3);
|
||||
REQUIRE(zone->m_pools.GetAsset<T6::AssetMaterial>("Suzanne2"));
|
||||
REQUIRE(zone->m_pools.GetAsset<T6::AssetTechniqueSet>(",trivial_floatz_2992w610"));
|
||||
|
||||
const auto* xmodel = pools->m_xmodel->GetAsset("Suzanne2");
|
||||
const auto* xmodel = zone->m_pools.GetAsset<T6::AssetXModel>("Suzanne2");
|
||||
REQUIRE(xmodel);
|
||||
REQUIRE(xmodel->Asset()->boneNames);
|
||||
REQUIRE(xmodel->Asset()->numRootBones == 1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Linker.h"
|
||||
#include "OatTestPaths.h"
|
||||
#include "SystemTestsPaths.h"
|
||||
@@ -51,12 +51,11 @@ namespace
|
||||
REQUIRE(maybeZone);
|
||||
|
||||
auto zone = std::move(*maybeZone);
|
||||
auto pools = dynamic_cast<GameAssetPoolT6*>(zone->m_pools.get());
|
||||
|
||||
REQUIRE(zone->m_game_id == GameId::T6);
|
||||
REQUIRE(zone->m_platform == GamePlatform::PC);
|
||||
REQUIRE(zone->m_name == "SimpleZoneT6");
|
||||
REQUIRE(pools->GetTotalAssetCount() == 1);
|
||||
REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt"));
|
||||
REQUIRE(zone->m_pools.GetTotalAssetCount() == 1);
|
||||
REQUIRE(zone->m_pools.GetAsset<T6::AssetRawFile>("SimpleZone.txt"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user