Shader: Attribute can now have expressions as values and struct fields can be conditionally supported

This commit is contained in:
Jérôme Leclercq
2021-07-07 11:41:58 +02:00
parent 749b40cb31
commit f9af35b489
36 changed files with 945 additions and 600 deletions

View File

@@ -7,6 +7,21 @@
namespace Nz::ShaderAst
{
template<typename T>
AttributeValue<T> AstCloner::CloneAttribute(const AttributeValue<T>& attribute)
{
if (!attribute.HasValue())
return {};
if (attribute.IsExpression())
return CloneExpression(attribute.GetExpression());
else
{
assert(attribute.IsResultingValue());
return attribute.GetResultingValue();
}
}
ExpressionPtr AstCloner::CloneExpression(const ExpressionPtr& expr)
{
if (!expr)