diff --git a/include/Nazara/Shader/ShaderAst.hpp b/include/Nazara/Shader/ShaderAst.hpp index 11b39d5e9..6f384c18f 100644 --- a/include/Nazara/Shader/ShaderAst.hpp +++ b/include/Nazara/Shader/ShaderAst.hpp @@ -34,10 +34,10 @@ namespace Nz ~ShaderAst() = default; void AddFunction(std::string name, ShaderNodes::StatementPtr statement, std::vector parameters = {}, ShaderNodes::BasicType returnType = ShaderNodes::BasicType::Void); - void AddInput(std::string name, ShaderExpressionType type, std::optional locationIndex); - void AddOutput(std::string name, ShaderExpressionType type, std::optional locationIndex); + void AddInput(std::string name, ShaderExpressionType type, std::optional locationIndex = {}); + void AddOutput(std::string name, ShaderExpressionType type, std::optional locationIndex = {}); void AddStruct(std::string name, std::vector members); - void AddUniform(std::string name, ShaderExpressionType type, std::optional bindingIndex, std::optional memoryLayout); + void AddUniform(std::string name, ShaderExpressionType type, std::optional bindingIndex = {}, std::optional memoryLayout = {}); inline const Function& GetFunction(std::size_t i) const; inline std::size_t GetFunctionCount() const; diff --git a/include/Nazara/Shader/ShaderNodes.hpp b/include/Nazara/Shader/ShaderNodes.hpp index 15898af3f..b3af5f1aa 100644 --- a/include/Nazara/Shader/ShaderNodes.hpp +++ b/include/Nazara/Shader/ShaderNodes.hpp @@ -241,6 +241,7 @@ namespace Nz std::size_t componentCount; ExpressionPtr expression; + static inline std::shared_ptr Build(ExpressionPtr expressionPtr, SwizzleComponent swizzleComponent); static inline std::shared_ptr Build(ExpressionPtr expressionPtr, std::initializer_list swizzleComponents); static inline std::shared_ptr Build(ExpressionPtr expressionPtr, const SwizzleComponent* components, std::size_t componentCount); }; diff --git a/include/Nazara/Shader/ShaderNodes.inl b/include/Nazara/Shader/ShaderNodes.inl index 77bc813f3..1e0817b62 100644 --- a/include/Nazara/Shader/ShaderNodes.inl +++ b/include/Nazara/Shader/ShaderNodes.inl @@ -284,6 +284,11 @@ namespace Nz::ShaderNodes { } + inline std::shared_ptr SwizzleOp::Build(ExpressionPtr expressionPtr, SwizzleComponent swizzleComponent) + { + return Build(std::move(expressionPtr), { swizzleComponent }); + } + inline std::shared_ptr SwizzleOp::Build(ExpressionPtr expressionPtr, std::initializer_list swizzleComponents) { auto node = std::make_shared();