mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-12 03:31:49 +00:00
refactor: move iw3,iw4,iw5,t5 dumpers into seperate folders
This commit is contained in:
26
src/ObjWriting/Game/IW4/Shader/AssetDumperPixelShader.cpp
Normal file
26
src/ObjWriting/Game/IW4/Shader/AssetDumperPixelShader.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "AssetDumperPixelShader.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
bool AssetDumperPixelShader::ShouldDump(XAssetInfo<MaterialPixelShader>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetDumperPixelShader::DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialPixelShader>* asset)
|
||||
{
|
||||
const auto* pixelShader = asset->Asset();
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << "shader_bin/ps_" << pixelShader->name << ".cso";
|
||||
|
||||
const auto shaderFile = context.OpenAssetFile(ss.str());
|
||||
|
||||
if (!shaderFile)
|
||||
return;
|
||||
|
||||
shaderFile->write(reinterpret_cast<const char*>(pixelShader->prog.loadDef.program),
|
||||
static_cast<std::streamsize>(pixelShader->prog.loadDef.programSize) * 4u);
|
||||
}
|
||||
14
src/ObjWriting/Game/IW4/Shader/AssetDumperPixelShader.h
Normal file
14
src/ObjWriting/Game/IW4/Shader/AssetDumperPixelShader.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperPixelShader final : public AbstractAssetDumper<MaterialPixelShader>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<MaterialPixelShader>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialPixelShader>* asset) override;
|
||||
};
|
||||
} // namespace IW4
|
||||
26
src/ObjWriting/Game/IW4/Shader/AssetDumperVertexShader.cpp
Normal file
26
src/ObjWriting/Game/IW4/Shader/AssetDumperVertexShader.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "AssetDumperVertexShader.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
bool AssetDumperVertexShader::ShouldDump(XAssetInfo<MaterialVertexShader>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetDumperVertexShader::DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialVertexShader>* asset)
|
||||
{
|
||||
const auto* vertexShader = asset->Asset();
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << "shader_bin/vs_" << vertexShader->name << ".cso";
|
||||
|
||||
const auto shaderFile = context.OpenAssetFile(ss.str());
|
||||
|
||||
if (!shaderFile)
|
||||
return;
|
||||
|
||||
shaderFile->write(reinterpret_cast<const char*>(vertexShader->prog.loadDef.program),
|
||||
static_cast<std::streamsize>(vertexShader->prog.loadDef.programSize) * 4u);
|
||||
}
|
||||
14
src/ObjWriting/Game/IW4/Shader/AssetDumperVertexShader.h
Normal file
14
src/ObjWriting/Game/IW4/Shader/AssetDumperVertexShader.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperVertexShader final : public AbstractAssetDumper<MaterialVertexShader>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<MaterialVertexShader>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialVertexShader>* asset) override;
|
||||
};
|
||||
} // namespace IW4
|
||||
Reference in New Issue
Block a user