OpenGLRenderer: Implement TextureSampler (and texture units)
This commit is contained in:
@@ -10,6 +10,64 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
GLenum ToOpenGL(SamplerFilter filter)
|
||||
{
|
||||
switch (filter)
|
||||
{
|
||||
case SamplerFilter::SamplerFilter_Linear: return GL_LINEAR;
|
||||
case SamplerFilter::SamplerFilter_Nearest: return GL_NEAREST;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerFilter 0x" + String::Number(UnderlyingCast(filter), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
GLenum ToOpenGL(SamplerFilter minFilter, SamplerMipmapMode mipmapFilter)
|
||||
{
|
||||
switch (minFilter)
|
||||
{
|
||||
case SamplerFilter::SamplerFilter_Linear:
|
||||
{
|
||||
switch (mipmapFilter)
|
||||
{
|
||||
case SamplerMipmapMode_Linear: return GL_LINEAR_MIPMAP_LINEAR;
|
||||
case SamplerMipmapMode_Nearest: return GL_LINEAR_MIPMAP_NEAREST;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerFilter 0x" + String::Number(UnderlyingCast(mipmapFilter), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
case SamplerFilter::SamplerFilter_Nearest:
|
||||
{
|
||||
switch (mipmapFilter)
|
||||
{
|
||||
case SamplerMipmapMode_Linear: return GL_NEAREST_MIPMAP_LINEAR;
|
||||
case SamplerMipmapMode_Nearest: return GL_NEAREST_MIPMAP_NEAREST;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerFilter 0x" + String::Number(UnderlyingCast(mipmapFilter), 16));
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerFilter 0x" + String::Number(UnderlyingCast(minFilter), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
GLenum ToOpenGL(SamplerWrap wrapMode)
|
||||
{
|
||||
switch (wrapMode)
|
||||
{
|
||||
case SamplerWrap::SamplerWrap_Clamp: return GL_CLAMP_TO_EDGE;
|
||||
case SamplerWrap::SamplerWrap_MirroredRepeat: return GL_MIRRORED_REPEAT;
|
||||
case SamplerWrap::SamplerWrap_Repeat: return GL_REPEAT;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerWrap 0x" + String::Number(UnderlyingCast(wrapMode), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
GLenum ToOpenGL(ShaderStageType stageType)
|
||||
{
|
||||
switch (stageType)
|
||||
|
||||
Reference in New Issue
Block a user