Renderer/ShaderAst: Add serialization

This commit is contained in:
Lynix
2020-06-17 20:09:21 +02:00
parent 0ff10bf1e2
commit 736ca1c409
7 changed files with 285 additions and 118 deletions

View File

@@ -103,9 +103,6 @@ void MainWindow::OnCompileToGLSL()
{
Nz::ShaderNodes::StatementPtr shaderAst = m_shaderGraph.ToAst();
Nz::File file("shader.shader", Nz::OpenMode_WriteOnly);
file.Write(Nz::ShaderNodes::Serialize(shaderAst));
//TODO: Put in another function
auto GetExpressionFromInOut = [&] (InOutType type)
{
@@ -145,6 +142,9 @@ void MainWindow::OnCompileToGLSL()
shader.AddFunction("main", shaderAst);
Nz::File file("shader.shader", Nz::OpenMode_WriteOnly);
file.Write(Nz::SerializeShader(shader));
Nz::GlslWriter writer;
Nz::String glsl = writer.Generate(shader);