mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-25 02:51:43 +00:00
feat: add iw3 gfxlight dumper and loader
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "LightDefDumperIW3.h"
|
||||
|
||||
#include "LightDef/LightDefCommon.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
namespace light_def
|
||||
{
|
||||
void DumperIW3::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/IW3/IW3.h"
|
||||
|
||||
namespace light_def
|
||||
{
|
||||
class DumperIW3 final : public AbstractAssetDumper<IW3::AssetLightDef>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::AssetLightDef::Type>& asset) override;
|
||||
};
|
||||
} // namespace light_def
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Game/IW3/Techset/TechsetDumperIW3.h"
|
||||
#include "Game/IW3/XModel/XModelDumperIW3.h"
|
||||
#include "Image/ImageDumperIW3.h"
|
||||
#include "LightDef/LightDefDumperIW3.h"
|
||||
#include "Localize/LocalizeDumperIW3.h"
|
||||
#include "Maps/MapEntsDumperIW3.h"
|
||||
#include "PhysPreset/PhysPresetInfoStringDumperIW3.h"
|
||||
@@ -37,7 +38,7 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
// REGISTER_DUMPER(AssetDumperGameWorldMp)
|
||||
RegisterAssetDumper(std::make_unique<map_ents::DumperIW3>());
|
||||
// REGISTER_DUMPER(AssetDumperGfxWorld)
|
||||
// REGISTER_DUMPER(AssetDumperGfxLightDef)
|
||||
RegisterAssetDumper(std::make_unique<light_def::DumperIW3>());
|
||||
// REGISTER_DUMPER(AssetDumperFont_s)
|
||||
// REGISTER_DUMPER(AssetDumperMenuList)
|
||||
// REGISTER_DUMPER(AssetDumpermenuDef_t)
|
||||
|
||||
Reference in New Issue
Block a user