// 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_VARIABLES_HPP #define NAZARA_SHADER_VARIABLES_HPP #include #include #include #include #include #include #include #include #include #include namespace Nz { class ShaderVarVisitor; namespace ShaderNodes { struct Variable; using VariablePtr = std::shared_ptr; struct NAZARA_SHADER_API Variable : std::enable_shared_from_this { virtual ~Variable(); virtual VariableType GetType() const = 0; virtual void Visit(ShaderVarVisitor& visitor) = 0; ShaderExpressionType type; }; struct BuiltinVariable; using BuiltinVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API BuiltinVariable : public Variable { BuiltinEntry entry; VariableType GetType() const override; void Visit(ShaderVarVisitor& visitor) override; static inline std::shared_ptr Build(BuiltinEntry entry, ShaderExpressionType varType); }; struct NamedVariable; using NamedVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API NamedVariable : public Variable { std::string name; }; struct InputVariable; using InputVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API InputVariable : public NamedVariable { VariableType GetType() const override; void Visit(ShaderVarVisitor& visitor) override; static inline std::shared_ptr Build(std::string varName, ShaderExpressionType varType); }; struct LocalVariable; using LocalVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API LocalVariable : public NamedVariable { VariableType GetType() const override; void Visit(ShaderVarVisitor& visitor) override; static inline std::shared_ptr Build(std::string varName, ShaderExpressionType varType); }; struct OutputVariable; using OutputVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API OutputVariable : public NamedVariable { VariableType GetType() const override; void Visit(ShaderVarVisitor& visitor) override; static inline std::shared_ptr Build(std::string varName, ShaderExpressionType varType); }; struct ParameterVariable; using ParameterVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API ParameterVariable : public NamedVariable { VariableType GetType() const override; void Visit(ShaderVarVisitor& visitor) override; static inline std::shared_ptr Build(std::string varName, ShaderExpressionType varType); }; struct UniformVariable; using UniformVariablePtr = std::shared_ptr; struct NAZARA_SHADER_API UniformVariable : public NamedVariable { VariableType GetType() const override; void Visit(ShaderVarVisitor& visitor) override; static inline std::shared_ptr Build(std::string varName, ShaderExpressionType varType); }; } } #include #endif