Shader: Add AstReflect

This commit is contained in:
Jérôme Leclercq
2021-04-17 18:11:16 +02:00
parent 500ccda85a
commit 2238bbfa0c
6 changed files with 118 additions and 14 deletions

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/Ast/AstReflect.hpp>
#include <stdexcept>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderAst
{
void AstReflect::Reflect(const StatementPtr& statement, const Callbacks& callbacks)
{
assert(statement);
m_callbacks = &callbacks;
statement->Visit(*this);
}
void AstReflect::Visit(DeclareOptionStatement& node)
{
assert(m_callbacks);
if (m_callbacks->onOptionDeclaration)
m_callbacks->onOptionDeclaration(node.optName, node.optType);
}
}