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:
@@ -32,13 +32,10 @@ namespace
|
||||
auto* lightDef = m_memory.Alloc<GfxLightDef>();
|
||||
lightDef->name = m_memory.Dup(assetName.c_str());
|
||||
|
||||
context.GetZoneAssetCreationState<LightDefAssetCreationState>().SetLightDefLookupStart(lightDef, context);
|
||||
|
||||
AssetRegistration<AssetLightDef> registration(assetName, lightDef);
|
||||
|
||||
std::string imageName;
|
||||
int8_t samplerState;
|
||||
int8_t lmapLookupStart;
|
||||
file.m_stream->read(reinterpret_cast<char*>(&samplerState), sizeof(int8_t));
|
||||
std::getline(*file.m_stream, imageName, '\0');
|
||||
|
||||
@@ -53,6 +50,8 @@ namespace
|
||||
lightDef->attenuation.samplerState = samplerState;
|
||||
lightDef->attenuation.image = imageDependency->Asset();
|
||||
|
||||
context.GetZoneAssetCreationState<LightDefAssetCreationState>().SetLightDefLookupStart(lightDef, context);
|
||||
|
||||
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,10 @@ namespace
|
||||
auto* lightDef = m_memory.Alloc<GfxLightDef>();
|
||||
lightDef->name = m_memory.Dup(assetName.c_str());
|
||||
|
||||
context.GetZoneAssetCreationState<LightDefAssetCreationState>().SetLightDefLookupStart(lightDef, context);
|
||||
|
||||
AssetRegistration<AssetLightDef> registration(assetName, lightDef);
|
||||
|
||||
std::string imageName;
|
||||
int8_t samplerState;
|
||||
int8_t lmapLookupStart;
|
||||
file.m_stream->read(reinterpret_cast<char*>(&samplerState), sizeof(int8_t));
|
||||
std::getline(*file.m_stream, imageName, '\0');
|
||||
|
||||
@@ -52,7 +49,8 @@ namespace
|
||||
|
||||
lightDef->attenuation.samplerState = samplerState;
|
||||
lightDef->attenuation.image = imageDependency->Asset();
|
||||
lightDef->lmapLookupStart = static_cast<int>(static_cast<uint8_t>(lmapLookupStart));
|
||||
|
||||
context.GetZoneAssetCreationState<LightDefAssetCreationState>().SetLightDefLookupStart(lightDef, context);
|
||||
|
||||
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ namespace
|
||||
auto* lightDef = m_memory.Alloc<GfxLightDef>();
|
||||
lightDef->name = m_memory.Dup(assetName.c_str());
|
||||
|
||||
context.GetZoneAssetCreationState<LightDefAssetCreationState>().SetLightDefLookupStart(lightDef, context);
|
||||
|
||||
AssetRegistration<AssetLightDef> registration(assetName, lightDef);
|
||||
|
||||
int8_t attenuationSamplerState;
|
||||
@@ -55,24 +53,22 @@ namespace
|
||||
|
||||
std::string cucolorisName;
|
||||
std::getline(*file.m_stream, cucolorisName, '\0');
|
||||
auto* cucolorisImageDependency = context.LoadDependency<AssetImage>(cucolorisName);
|
||||
if (!cucolorisImageDependency)
|
||||
{
|
||||
con::warn("Could not load GfxLightDef \"{}\" due to missing cucoloris image \"{}\"", assetName, cucolorisName);
|
||||
}
|
||||
else
|
||||
if (!cucolorisName.empty())
|
||||
{
|
||||
auto* cucolorisImageDependency = context.LoadDependency<AssetImage>(cucolorisName);
|
||||
if (!cucolorisImageDependency)
|
||||
{
|
||||
con::warn("Could not load GfxLightDef \"{}\" due to missing cucoloris image \"{}\"", assetName, cucolorisName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
registration.AddDependency(cucolorisImageDependency);
|
||||
lightDef->cucoloris.image = cucolorisImageDependency->Asset();
|
||||
}
|
||||
|
||||
int8_t lmapLookupStart;
|
||||
file.m_stream->read(reinterpret_cast<char*>(&lmapLookupStart), sizeof(int8_t));
|
||||
|
||||
lightDef->attenuation.samplerState = attenuationSamplerState;
|
||||
lightDef->attenuation.image = attenuationImageDependency->Asset();
|
||||
lightDef->cucoloris.samplerState = cucolorisSamplerState;
|
||||
lightDef->cucoloris.image = cucolorisImageDependency->Asset();
|
||||
lightDef->lmapLookupStart = static_cast<int>(static_cast<uint8_t>(lmapLookupStart));
|
||||
|
||||
context.GetZoneAssetCreationState<LightDefAssetCreationState>().SetLightDefLookupStart(lightDef, context);
|
||||
|
||||
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
|
||||
}
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user