ShaderNode: Handle vector component count at runtime

This commit is contained in:
Lynix
2020-05-31 18:39:28 +02:00
parent 2ecc624fe4
commit effd1b4552
28 changed files with 529 additions and 339 deletions

View File

@@ -169,19 +169,16 @@ namespace Nz
exprType(castTo),
expressions({ {first, second, third, fourth} })
{
unsigned int componentCount = 0;
unsigned int requiredComponents = GetComponentCount(exprType);
for (const auto& exprPtr : expressions)
{
if (!exprPtr)
break;
Validate();
}
componentCount += GetComponentCount(exprPtr->GetExpressionType());
}
inline Cast::Cast(ExpressionType castTo, ExpressionPtr* Expressions, std::size_t expressionCount) :
exprType(castTo)
{
for (std::size_t i = 0; i < expressionCount; ++i)
expressions[i] = Expressions[i];
//TODO: AstParseError
if (componentCount != requiredComponents)
throw std::runtime_error("Component count doesn't match required component count");
Validate();
}
inline Constant::Constant(bool value) :