2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-25 02:51:43 +00:00

feat: add t5 gfxlight dumper and loader

This commit is contained in:
njohnson
2026-05-02 14:26:17 +02:00
committed by Jan Laupetin
parent 3c15f8ad7e
commit 5b6a725f78
7 changed files with 133 additions and 3 deletions
@@ -0,0 +1,25 @@
#include "LightDefDumperT5.h"
#include "LightDef/LightDefCommon.h"
using namespace T5;
namespace light_def
{
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetLightDef::Type>& asset)
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
if (!assetFile || lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
return;
auto& stream = *assetFile;
const auto* imageName = lightDef->attenuation.image->name;
if (imageName[0] == ',')
imageName = &imageName[1];
stream << lightDef->attenuation.samplerState << imageName << static_cast<char>(lightDef->lmapLookupStart);
}
} // namespace light_def
@@ -0,0 +1,13 @@
#pragma once
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T5/T5.h"
namespace light_def
{
class DumperT5 final : public AbstractAssetDumper<T5::AssetLightDef>
{
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::AssetLightDef::Type>& asset) override;
};
} // namespace light_def
+2 -1
View File
@@ -4,6 +4,7 @@
#include "Game/T5/Techset/TechsetDumperT5.h"
#include "Game/T5/XModel/XModelDumperT5.h"
#include "Image/ImageDumperT5.h"
#include "LightDef/LightDefDumperT5.h"
#include "Localize/LocalizeDumperT5.h"
#include "PhysPreset/PhysPresetInfoStringDumperT5.h"
#include "RawFile/RawFileDumperT5.h"
@@ -35,7 +36,7 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
// REGISTER_DUMPER(AssetDumperGameWorldMp, m_game_world_mp)
// REGISTER_DUMPER(AssetDumperMapEnts, m_map_ents)
// REGISTER_DUMPER(AssetDumperGfxWorld, m_gfx_world)
// REGISTER_DUMPER(AssetDumperGfxLightDef, m_gfx_light_def)
RegisterAssetDumper(std::make_unique<light_def::DumperT5>());
// REGISTER_DUMPER(AssetDumperFont, m_font)
// REGISTER_DUMPER(AssetDumperMenuList, m_menu_list)
// REGISTER_DUMPER(AssetDumperMenuDef, m_menu_def)