Shader: Add AstReflect
This commit is contained in:
25
src/Nazara/Shader/Ast/AstReflect.cpp
Normal file
25
src/Nazara/Shader/Ast/AstReflect.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user