mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-25 02:51:43 +00:00
feat: add iw5 gfxlight dumper and loader
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "LightDefDumperIW5.h"
|
||||
|
||||
#include "LightDef/LightDefCommon.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
namespace light_def
|
||||
{
|
||||
void DumperIW5::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 || lightDef->cucoloris.image == nullptr
|
||||
|| lightDef->cucoloris.image->name == nullptr)
|
||||
return;
|
||||
|
||||
auto& stream = *assetFile;
|
||||
|
||||
const auto* attenuationImageName = lightDef->attenuation.image->name;
|
||||
if (attenuationImageName[0] == ',')
|
||||
attenuationImageName = &attenuationImageName[1];
|
||||
|
||||
const auto* cucolorisImageName = lightDef->cucoloris.image->name;
|
||||
if (cucolorisImageName[0] == ',')
|
||||
cucolorisImageName = &cucolorisImageName[1];
|
||||
|
||||
stream << lightDef->attenuation.samplerState << attenuationImageName << '\0' << lightDef->cucoloris.samplerState << cucolorisImageName
|
||||
<< static_cast<char>(lightDef->lmapLookupStart);
|
||||
}
|
||||
} // namespace light_def
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
|
||||
namespace light_def
|
||||
{
|
||||
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetLightDef>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetLightDef::Type>& asset) override;
|
||||
};
|
||||
} // namespace light_def
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Game/IW5/XModel/XModelDumperIW5.h"
|
||||
#include "Image/ImageDumperIW5.h"
|
||||
#include "Leaderboard/LeaderboardJsonDumperIW5.h"
|
||||
#include "LightDef/LightDefDumperIW5.h"
|
||||
#include "Localize/LocalizeDumperIW5.h"
|
||||
#include "Maps/AddonMapEntsDumperIW5.h"
|
||||
#include "Menu/MenuDumperIW5.h"
|
||||
@@ -51,7 +52,7 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
// REGISTER_DUMPER(AssetDumperMapEnts)
|
||||
// REGISTER_DUMPER(AssetDumperFxWorld)
|
||||
// REGISTER_DUMPER(AssetDumperGfxWorld)
|
||||
// REGISTER_DUMPER(AssetDumperGfxLightDef)
|
||||
RegisterAssetDumper(std::make_unique<light_def::DumperIW5>());
|
||||
// REGISTER_DUMPER(AssetDumperFont_s)
|
||||
RegisterAssetDumper(std::make_unique<menu::MenuListDumperIW5>());
|
||||
RegisterAssetDumper(std::make_unique<menu::MenuDumperIW5>());
|
||||
|
||||
Reference in New Issue
Block a user