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,46 @@
// 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
#pragma once
#ifndef NAZARA_SHADER_AST_REFLECT_HPP
#define NAZARA_SHADER_AST_REFLECT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/Ast/AstRecursiveVisitor.hpp>
#include <vector>
namespace Nz::ShaderAst
{
class NAZARA_SHADER_API AstReflect : public AstRecursiveVisitor
{
public:
struct Callbacks;
AstReflect() = default;
AstReflect(const AstReflect&) = delete;
AstReflect(AstReflect&&) = delete;
~AstReflect() = default;
void Reflect(const StatementPtr& statement, const Callbacks& callbacks);
AstReflect& operator=(const AstReflect&) = delete;
AstReflect& operator=(AstReflect&&) = delete;
struct Callbacks
{
std::function<void(const std::string& optionName, const ExpressionType& optionType)> onOptionDeclaration;
};
private:
void Visit(DeclareOptionStatement& node) override;
const Callbacks* m_callbacks;
};
}
#include <Nazara/Shader/Ast/AstReflect.inl>
#endif

View File

@@ -0,0 +1,12 @@
// 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 <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderAst
{
}
#include <Nazara/Shader/DebugOff.hpp>