Shader/ShaderLang: Add support for Unary operators
This commit is contained in:
@@ -107,7 +107,7 @@ namespace Nz
|
||||
}, type);
|
||||
}
|
||||
|
||||
void LangWriter::Append(const ShaderAst::IdentifierType& identifierType)
|
||||
void LangWriter::Append(const ShaderAst::IdentifierType& /*identifierType*/)
|
||||
{
|
||||
throw std::runtime_error("unexpected identifier type");
|
||||
}
|
||||
@@ -730,6 +730,26 @@ namespace Nz
|
||||
Append(varName);
|
||||
}
|
||||
|
||||
void LangWriter::Visit(ShaderAst::UnaryExpression& node)
|
||||
{
|
||||
switch (node.op)
|
||||
{
|
||||
case ShaderAst::UnaryType::LogicalNot:
|
||||
Append("!");
|
||||
break;
|
||||
|
||||
case ShaderAst::UnaryType::Minus:
|
||||
Append("-");
|
||||
break;
|
||||
|
||||
case ShaderAst::UnaryType::Plus:
|
||||
Append("+");
|
||||
break;
|
||||
}
|
||||
|
||||
Append(node.expression);
|
||||
}
|
||||
|
||||
void LangWriter::AppendHeader()
|
||||
{
|
||||
// Nothing yet
|
||||
|
||||
Reference in New Issue
Block a user