mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Dump IW4 vertex and pixel shader binary data
This commit is contained in:
parent
5f44d95770
commit
935e6ac060
@ -1,5 +1,7 @@
|
|||||||
#include "AssetDumperPixelShader.h"
|
#include "AssetDumperPixelShader.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using namespace IW4;
|
using namespace IW4;
|
||||||
|
|
||||||
bool AssetDumperPixelShader::ShouldDump(XAssetInfo<MaterialPixelShader>* asset)
|
bool AssetDumperPixelShader::ShouldDump(XAssetInfo<MaterialPixelShader>* asset)
|
||||||
@ -9,4 +11,15 @@ bool AssetDumperPixelShader::ShouldDump(XAssetInfo<MaterialPixelShader>* asset)
|
|||||||
|
|
||||||
void AssetDumperPixelShader::DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialPixelShader>* asset)
|
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);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "AssetDumperVertexShader.h"
|
#include "AssetDumperVertexShader.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using namespace IW4;
|
using namespace IW4;
|
||||||
|
|
||||||
bool AssetDumperVertexShader::ShouldDump(XAssetInfo<MaterialVertexShader>* asset)
|
bool AssetDumperVertexShader::ShouldDump(XAssetInfo<MaterialVertexShader>* asset)
|
||||||
@ -9,4 +11,15 @@ bool AssetDumperVertexShader::ShouldDump(XAssetInfo<MaterialVertexShader>* asset
|
|||||||
|
|
||||||
void AssetDumperVertexShader::DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialVertexShader>* asset)
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user