mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-28 23:57:52 -05:00
Dump IW4 vertex and pixel shader binary data
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include "AssetDumperVertexShader.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
bool AssetDumperVertexShader::ShouldDump(XAssetInfo<MaterialVertexShader>* asset)
|
||||
@ -9,4 +11,15 @@ bool AssetDumperVertexShader::ShouldDump(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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user