2024-01-05 10:15:41 -06:00
|
|
|
#include "2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.h"
|
|
|
|
|
#include "2s2h/resource/type/scenecommand/SetLightingSettings.h"
|
|
|
|
|
#include "spdlog/spdlog.h"
|
|
|
|
|
|
2024-03-26 21:26:31 -04:00
|
|
|
namespace SOH {
|
2024-05-03 15:57:40 -04:00
|
|
|
std::shared_ptr<Ship::IResource>
|
|
|
|
|
SetLightingSettingsFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,
|
|
|
|
|
std::shared_ptr<Ship::BinaryReader> reader) {
|
2024-03-26 21:26:31 -04:00
|
|
|
auto setLightingSettings = std::make_shared<SetLightingSettings>(initData);
|
2024-01-05 10:15:41 -06:00
|
|
|
|
|
|
|
|
ReadCommandId(setLightingSettings, reader);
|
|
|
|
|
|
|
|
|
|
uint32_t count = reader->ReadInt32();
|
|
|
|
|
setLightingSettings->settings.reserve(count);
|
|
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < count; i++) {
|
|
|
|
|
EnvLightSettings lightSettings;
|
|
|
|
|
lightSettings.ambientColor[0] = reader->ReadInt8();
|
|
|
|
|
lightSettings.ambientColor[1] = reader->ReadInt8();
|
|
|
|
|
lightSettings.ambientColor[2] = reader->ReadInt8();
|
|
|
|
|
|
|
|
|
|
lightSettings.light1Dir[0] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light1Dir[1] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light1Dir[2] = reader->ReadInt8();
|
|
|
|
|
|
|
|
|
|
lightSettings.light1Color[0] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light1Color[1] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light1Color[2] = reader->ReadInt8();
|
|
|
|
|
|
|
|
|
|
lightSettings.light2Dir[0] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light2Dir[1] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light2Dir[2] = reader->ReadInt8();
|
|
|
|
|
|
|
|
|
|
lightSettings.light2Color[0] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light2Color[1] = reader->ReadInt8();
|
|
|
|
|
lightSettings.light2Color[2] = reader->ReadInt8();
|
|
|
|
|
|
|
|
|
|
lightSettings.fogColor[0] = reader->ReadInt8();
|
|
|
|
|
lightSettings.fogColor[1] = reader->ReadInt8();
|
|
|
|
|
lightSettings.fogColor[2] = reader->ReadInt8();
|
|
|
|
|
|
|
|
|
|
lightSettings.fogNear = reader->ReadInt16();
|
|
|
|
|
lightSettings.fogFar = reader->ReadUInt16();
|
|
|
|
|
setLightingSettings->settings.push_back(lightSettings);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-26 21:26:31 -04:00
|
|
|
return setLightingSettings;
|
|
|
|
|
}
|
|
|
|
|
} // namespace SOH
|