Renderer/ShaderAst: Add Sample2D

This commit is contained in:
Lynix
2020-05-19 20:06:11 +02:00
parent c26f3b9b71
commit e23eb74802
7 changed files with 67 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
// This file is part of the "Nazara Engine - Renderer module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz
@@ -225,6 +226,17 @@ namespace Nz
std::copy(swizzleComponents.begin(), swizzleComponents.end(), components.begin());
}
inline Sample2D::Sample2D(ExpressionPtr samplerPtr, ExpressionPtr coordinatesPtr) :
sampler(std::move(samplerPtr)),
coordinates(std::move(coordinatesPtr))
{
if (sampler->GetExpressionType() != ExpressionType::Sampler2D)
throw std::runtime_error("Sampler must be a Sampler2D");
if (coordinates->GetExpressionType() != ExpressionType::Float2)
throw std::runtime_error("Coordinates must be a Float2");
}
}
}