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

@@ -7,8 +7,9 @@
namespace Nz::ShaderNodes
{
inline Node::Node(NodeType type) :
m_type(type)
inline Node::Node(NodeType type, bool isStatement) :
m_type(type),
m_isStatement(isStatement)
{
}
@@ -17,6 +18,11 @@ namespace Nz::ShaderNodes
return m_type;
}
inline bool Node::IsStatement() const
{
return m_isStatement;
}
inline unsigned int Node::GetComponentCount(ExpressionType type)
{
switch (type)
@@ -55,6 +61,19 @@ namespace Nz::ShaderNodes
}
}
inline Expression::Expression(NodeType type) :
Node(type, false)
{
}
inline Statement::Statement(NodeType type) :
Node(type, true)
{
}
inline ExpressionStatement::ExpressionStatement() :
Statement(NodeType::ExpressionStatement)
{