2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-17 07:21:43 +00:00

Fix LMAP parsing and don't resolve till after ptr is ready.

This commit is contained in:
njohnson
2026-05-11 14:55:04 -04:00
committed by Jan Laupetin
parent 4208bab758
commit 336c9d8d86
10 changed files with 79 additions and 48 deletions
@@ -35,20 +35,19 @@ namespace
std::string attenuationName;
int8_t samplerState;
int8_t lmapLookupStart;
file.m_stream->read(reinterpret_cast<char*>(&samplerState), sizeof(int8_t));
std::getline(*file.m_stream, attenuationName, '\0');
auto* imageDependency = context.LoadDependency<AssetImage>(imageName);
if (!imageDependency)
auto* attenuationImageDependency = context.LoadDependency<AssetImage>(attenuationName);
if (!attenuationImageDependency)
{
con::error("Could not load GfxLightDef \"{}\" due to missing image \"{}\"", assetName, imageName);
con::error("Could not load GfxLightDef \"{}\" due to missing attenuation image \"{}\"", assetName, attenuationName);
return AssetCreationResult::Failure();
}
registration.AddDependency(imageDependency);
registration.AddDependency(attenuationImageDependency);
lightDef->attenuation.samplerState = samplerState;
lightDef->attenuation.image = imageDependency->Asset();
lightDef->attenuation.image = attenuationImageDependency->Asset();
lightDef->lmapLookupStart = 0;
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));