Added a lot of methods to send uniforms

including arrays and integers vectors


Former-commit-id: c365cccdbad7eab1a1212e78759d7fda857012f9
This commit is contained in:
Lynix 2013-09-16 01:01:59 +02:00
parent f0eac2bc0d
commit 15fa8378c9
6 changed files with 597 additions and 0 deletions

View File

@ -258,12 +258,18 @@ NAZARA_API extern PFNGLPROGRAMPARAMETERIPROC glProgramParameteri;
NAZARA_API extern PFNGLPROGRAMUNIFORM1DPROC glProgramUniform1d;
NAZARA_API extern PFNGLPROGRAMUNIFORM1FPROC glProgramUniform1f;
NAZARA_API extern PFNGLPROGRAMUNIFORM1IPROC glProgramUniform1i;
NAZARA_API extern PFNGLPROGRAMUNIFORM1DVPROC glProgramUniform1dv;
NAZARA_API extern PFNGLPROGRAMUNIFORM1FVPROC glProgramUniform1fv;
NAZARA_API extern PFNGLPROGRAMUNIFORM1IVPROC glProgramUniform1iv;
NAZARA_API extern PFNGLPROGRAMUNIFORM2DVPROC glProgramUniform2dv;
NAZARA_API extern PFNGLPROGRAMUNIFORM2FVPROC glProgramUniform2fv;
NAZARA_API extern PFNGLPROGRAMUNIFORM2IVPROC glProgramUniform2iv;
NAZARA_API extern PFNGLPROGRAMUNIFORM3DVPROC glProgramUniform3dv;
NAZARA_API extern PFNGLPROGRAMUNIFORM3FVPROC glProgramUniform3fv;
NAZARA_API extern PFNGLPROGRAMUNIFORM3IVPROC glProgramUniform3iv;
NAZARA_API extern PFNGLPROGRAMUNIFORM4DVPROC glProgramUniform4dv;
NAZARA_API extern PFNGLPROGRAMUNIFORM4FVPROC glProgramUniform4fv;
NAZARA_API extern PFNGLPROGRAMUNIFORM4IVPROC glProgramUniform4iv;
NAZARA_API extern PFNGLPROGRAMUNIFORMMATRIX4DVPROC glProgramUniformMatrix4dv;
NAZARA_API extern PFNGLPROGRAMUNIFORMMATRIX4FVPROC glProgramUniformMatrix4fv;
NAZARA_API extern PFNGLREADPIXELSPROC glReadPixels;
@ -290,12 +296,18 @@ NAZARA_API extern PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D;
NAZARA_API extern PFNGLUNIFORM1DPROC glUniform1d;
NAZARA_API extern PFNGLUNIFORM1FPROC glUniform1f;
NAZARA_API extern PFNGLUNIFORM1IPROC glUniform1i;
NAZARA_API extern PFNGLUNIFORM1DVPROC glUniform1dv;
NAZARA_API extern PFNGLUNIFORM1FVPROC glUniform1fv;
NAZARA_API extern PFNGLUNIFORM1IVPROC glUniform1iv;
NAZARA_API extern PFNGLUNIFORM2DVPROC glUniform2dv;
NAZARA_API extern PFNGLUNIFORM2FVPROC glUniform2fv;
NAZARA_API extern PFNGLUNIFORM2IVPROC glUniform2iv;
NAZARA_API extern PFNGLUNIFORM3DVPROC glUniform3dv;
NAZARA_API extern PFNGLUNIFORM3FVPROC glUniform3fv;
NAZARA_API extern PFNGLUNIFORM3IVPROC glUniform3iv;
NAZARA_API extern PFNGLUNIFORM4DVPROC glUniform4dv;
NAZARA_API extern PFNGLUNIFORM4FVPROC glUniform4fv;
NAZARA_API extern PFNGLUNIFORM4IVPROC glUniform4iv;
NAZARA_API extern PFNGLUNIFORMMATRIX4DVPROC glUniformMatrix4dv;
NAZARA_API extern PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
NAZARA_API extern PFNGLUNMAPBUFFERPROC glUnmapBuffer;

View File

@ -66,17 +66,32 @@ class NAZARA_API NzShaderProgram : public NzResource, NzNonCopyable
bool SendBoolean(int location, bool value) const;
bool SendColor(int location, const NzColor& color) const;
bool SendDouble(int location, double value) const;
bool SendDoubleArray(int location, const double* values, unsigned int count) const;
bool SendFloat(int location, float value) const;
bool SendFloatArray(int location, const float* values, unsigned int count) const;
bool SendInteger(int location, int value) const;
bool SendIntegerArray(int location, const int* values, unsigned int count) const;
bool SendMatrix(int location, const NzMatrix4d& matrix) const;
bool SendMatrix(int location, const NzMatrix4f& matrix) const;
bool SendTexture(int location, const NzTexture* texture, nzUInt8* textureUnit = nullptr) const;
bool SendVector(int location, const NzVector2d& vector) const;
bool SendVector(int location, const NzVector2f& vector) const;
bool SendVector(int location, const NzVector2i& vector) const;
bool SendVector(int location, const NzVector3d& vector) const;
bool SendVector(int location, const NzVector3f& vector) const;
bool SendVector(int location, const NzVector3i& vector) const;
bool SendVector(int location, const NzVector4d& vector) const;
bool SendVector(int location, const NzVector4f& vector) const;
bool SendVector(int location, const NzVector4i& vector) const;
bool SendVectorArray(int location, const NzVector2d* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector2f* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector2i* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector3d* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector3f* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector3i* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector4d* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector4f* vectors, unsigned int count) const;
bool SendVectorArray(int location, const NzVector4i* vectors, unsigned int count) const;
void SetFlags(nzUInt32 flags);

View File

@ -325,6 +325,19 @@ bool NzGLSLProgram::SendDouble(int location, double value)
return true;
}
bool NzGLSLProgram::SendDoubleArray(int location, const double* values, unsigned int count)
{
if (glProgramUniform1dv)
glProgramUniform1dv(m_program, location, count, values);
else
{
NzOpenGL::BindProgram(m_program);
glUniform1dv(location, count, values);
}
return true;
}
bool NzGLSLProgram::SendFloat(int location, float value)
{
if (glProgramUniform1f)
@ -338,6 +351,19 @@ bool NzGLSLProgram::SendFloat(int location, float value)
return true;
}
bool NzGLSLProgram::SendFloatArray(int location, const float* values, unsigned int count)
{
if (glProgramUniform1fv)
glProgramUniform1fv(m_program, location, count, values);
else
{
NzOpenGL::BindProgram(m_program);
glUniform1fv(location, count, values);
}
return true;
}
bool NzGLSLProgram::SendInteger(int location, int value)
{
if (glProgramUniform1i)
@ -351,6 +377,19 @@ bool NzGLSLProgram::SendInteger(int location, int value)
return true;
}
bool NzGLSLProgram::SendIntegerArray(int location, const int* values, unsigned int count)
{
if (glProgramUniform1iv)
glProgramUniform1iv(m_program, location, count, values);
else
{
NzOpenGL::BindProgram(m_program);
glUniform1iv(location, count, values);
}
return true;
}
bool NzGLSLProgram::SendMatrix(int location, const NzMatrix4d& matrix)
{
if (glProgramUniformMatrix4dv)
@ -468,6 +507,19 @@ bool NzGLSLProgram::SendVector(int location, const NzVector2f& vector)
return true;
}
bool NzGLSLProgram::SendVector(int location, const NzVector2i& vector)
{
if (glProgramUniform2fv)
glProgramUniform2iv(m_program, location, 1, vector);
else
{
NzOpenGL::BindProgram(m_program);
glUniform2iv(location, 1, vector);
}
return true;
}
bool NzGLSLProgram::SendVector(int location, const NzVector3d& vector)
{
if (glProgramUniform3dv)
@ -494,6 +546,19 @@ bool NzGLSLProgram::SendVector(int location, const NzVector3f& vector)
return true;
}
bool NzGLSLProgram::SendVector(int location, const NzVector3i& vector)
{
if (glProgramUniform3iv)
glProgramUniform3iv(m_program, location, 1, vector);
else
{
NzOpenGL::BindProgram(m_program);
glUniform3iv(location, 1, vector);
}
return true;
}
bool NzGLSLProgram::SendVector(int location, const NzVector4d& vector)
{
if (glProgramUniform4dv)
@ -520,6 +585,136 @@ bool NzGLSLProgram::SendVector(int location, const NzVector4f& vector)
return true;
}
bool NzGLSLProgram::SendVector(int location, const NzVector4i& vector)
{
if (glProgramUniform4iv)
glProgramUniform4iv(m_program, location, 1, vector);
else
{
NzOpenGL::BindProgram(m_program);
glUniform4iv(location, 1, vector);
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector2d* vectors, unsigned int count)
{
if (glProgramUniform2dv)
glProgramUniform2dv(m_program, location, count, reinterpret_cast<const double*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform2dv(location, count, reinterpret_cast<const double*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector2f* vectors, unsigned int count)
{
if (glProgramUniform2fv)
glProgramUniform2fv(m_program, location, count, reinterpret_cast<const float*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform2fv(location, count, reinterpret_cast<const float*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector2i* vectors, unsigned int count)
{
if (glProgramUniform2iv)
glProgramUniform2iv(m_program, location, count, reinterpret_cast<const int*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform2iv(location, count, reinterpret_cast<const int*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector3d* vectors, unsigned int count)
{
if (glProgramUniform3dv)
glProgramUniform3dv(m_program, location, count, reinterpret_cast<const double*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform3dv(location, count, reinterpret_cast<const double*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector3f* vectors, unsigned int count)
{
if (glProgramUniform3fv)
glProgramUniform3fv(m_program, location, count, reinterpret_cast<const float*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform3fv(location, count, reinterpret_cast<const float*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector3i* vectors, unsigned int count)
{
if (glProgramUniform3iv)
glProgramUniform3iv(m_program, location, count, reinterpret_cast<const int*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform3iv(location, count, reinterpret_cast<const int*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector4d* vectors, unsigned int count)
{
if (glProgramUniform4dv)
glProgramUniform4dv(m_program, location, count, reinterpret_cast<const double*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform4dv(location, count, reinterpret_cast<const double*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector4f* vectors, unsigned int count)
{
if (glProgramUniform4fv)
glProgramUniform4fv(m_program, location, count, reinterpret_cast<const float*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform4fv(location, count, reinterpret_cast<const float*>(vectors));
}
return true;
}
bool NzGLSLProgram::SendVectorArray(int location, const NzVector4i* vectors, unsigned int count)
{
if (glProgramUniform4iv)
glProgramUniform4iv(m_program, location, count, reinterpret_cast<const int*>(vectors));
else
{
NzOpenGL::BindProgram(m_program);
glUniform4iv(location, count, reinterpret_cast<const int*>(vectors));
}
return true;
}
bool NzGLSLProgram::OnResourceCreated(const NzResource* resource, int index)
{
NazaraUnused(resource);

View File

@ -47,17 +47,32 @@ class NzGLSLProgram : public NzAbstractShaderProgram, NzResourceListener
bool SendBoolean(int location, bool value);
bool SendColor(int location, const NzColor& color);
bool SendDouble(int location, double value);
bool SendDoubleArray(int location, const double* values, unsigned int count);
bool SendFloat(int location, float value);
bool SendFloatArray(int location, const float* values, unsigned int count);
bool SendInteger(int location, int value);
bool SendIntegerArray(int location, const int* values, unsigned int count);
bool SendMatrix(int location, const NzMatrix4d& matrix);
bool SendMatrix(int location, const NzMatrix4f& matrix);
bool SendTexture(int location, const NzTexture* texture, nzUInt8* textureUnit = nullptr);
bool SendVector(int location, const NzVector2d& vector);
bool SendVector(int location, const NzVector2f& vector);
bool SendVector(int location, const NzVector2i& vector);
bool SendVector(int location, const NzVector3d& vector);
bool SendVector(int location, const NzVector3f& vector);
bool SendVector(int location, const NzVector3i& vector);
bool SendVector(int location, const NzVector4d& vector);
bool SendVector(int location, const NzVector4f& vector);
bool SendVector(int location, const NzVector4i& vector);
bool SendVectorArray(int location, const NzVector2d* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector2f* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector2i* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector3d* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector3f* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector3i* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector4d* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector4f* vectors, unsigned int count);
bool SendVectorArray(int location, const NzVector4i* vectors, unsigned int count);
private:
bool OnResourceCreated(const NzResource* resource, int index) override;

View File

@ -864,9 +864,14 @@ bool NzOpenGL::Initialize()
glTexSubImage3D = reinterpret_cast<PFNGLTEXSUBIMAGE3DPROC>(LoadEntry("glTexSubImage3D"));
glUniform1f = reinterpret_cast<PFNGLUNIFORM1FPROC>(LoadEntry("glUniform1f"));
glUniform1i = reinterpret_cast<PFNGLUNIFORM1IPROC>(LoadEntry("glUniform1i"));
glUniform1fv = reinterpret_cast<PFNGLUNIFORM1FVPROC>(LoadEntry("glUniform1fv"));
glUniform1iv = reinterpret_cast<PFNGLUNIFORM1IVPROC>(LoadEntry("glUniform1iv"));
glUniform2fv = reinterpret_cast<PFNGLUNIFORM2FVPROC>(LoadEntry("glUniform2fv"));
glUniform2iv = reinterpret_cast<PFNGLUNIFORM2IVPROC>(LoadEntry("glUniform2iv"));
glUniform3fv = reinterpret_cast<PFNGLUNIFORM3FVPROC>(LoadEntry("glUniform3fv"));
glUniform3iv = reinterpret_cast<PFNGLUNIFORM3IVPROC>(LoadEntry("glUniform3iv"));
glUniform4fv = reinterpret_cast<PFNGLUNIFORM4FVPROC>(LoadEntry("glUniform4fv"));
glUniform4iv = reinterpret_cast<PFNGLUNIFORM4IVPROC>(LoadEntry("glUniform4iv"));
glUniformMatrix4fv = reinterpret_cast<PFNGLUNIFORMMATRIX4FVPROC>(LoadEntry("glUniformMatrix4fv"));
glUnmapBuffer = reinterpret_cast<PFNGLUNMAPBUFFERPROC>(LoadEntry("glUnmapBuffer"));
glUseProgram = reinterpret_cast<PFNGLUSEPROGRAMPROC>(LoadEntry("glUseProgram"));
@ -1033,6 +1038,7 @@ bool NzOpenGL::Initialize()
try
{
glUniform1d = reinterpret_cast<PFNGLUNIFORM1DPROC>(LoadEntry("glUniform1d"));
glUniform1dv = reinterpret_cast<PFNGLUNIFORM1DVPROC>(LoadEntry("glUniform1dv"));
glUniform2dv = reinterpret_cast<PFNGLUNIFORM2DVPROC>(LoadEntry("glUniform2dv"));
glUniform3dv = reinterpret_cast<PFNGLUNIFORM3DVPROC>(LoadEntry("glUniform3dv"));
glUniform4dv = reinterpret_cast<PFNGLUNIFORM4DVPROC>(LoadEntry("glUniform4dv"));
@ -1148,15 +1154,21 @@ bool NzOpenGL::Initialize()
{
glProgramUniform1f = reinterpret_cast<PFNGLPROGRAMUNIFORM1FPROC>(LoadEntry("glProgramUniform1f"));
glProgramUniform1i = reinterpret_cast<PFNGLPROGRAMUNIFORM1IPROC>(LoadEntry("glProgramUniform1i"));
glProgramUniform1fv = reinterpret_cast<PFNGLPROGRAMUNIFORM1FVPROC>(LoadEntry("glProgramUniform1fv"));
glProgramUniform1iv = reinterpret_cast<PFNGLPROGRAMUNIFORM1IVPROC>(LoadEntry("glProgramUniform1iv"));
glProgramUniform2fv = reinterpret_cast<PFNGLPROGRAMUNIFORM2FVPROC>(LoadEntry("glProgramUniform2fv"));
glProgramUniform2iv = reinterpret_cast<PFNGLPROGRAMUNIFORM2IVPROC>(LoadEntry("glProgramUniform2iv"));
glProgramUniform3fv = reinterpret_cast<PFNGLPROGRAMUNIFORM3FVPROC>(LoadEntry("glProgramUniform3fv"));
glProgramUniform3iv = reinterpret_cast<PFNGLPROGRAMUNIFORM3IVPROC>(LoadEntry("glProgramUniform3iv"));
glProgramUniform4fv = reinterpret_cast<PFNGLPROGRAMUNIFORM4FVPROC>(LoadEntry("glProgramUniform4fv"));
glProgramUniform4iv = reinterpret_cast<PFNGLPROGRAMUNIFORM4IVPROC>(LoadEntry("glProgramUniform4iv"));
glProgramUniformMatrix4fv = reinterpret_cast<PFNGLPROGRAMUNIFORMMATRIX4FVPROC>(LoadEntry("glProgramUniformMatrix4fv"));
// Si ARB_gpu_shader_fp64 est supporté, alors cette extension donne également accès aux fonctions utilisant des double
if (s_openGLextensions[nzOpenGLExtension_FP64])
{
glProgramUniform1d = reinterpret_cast<PFNGLPROGRAMUNIFORM1DPROC>(LoadEntry("glProgramUniform1d"));
glProgramUniform1dv = reinterpret_cast<PFNGLPROGRAMUNIFORM2DVPROC>(LoadEntry("glProgramUniform1dv"));
glProgramUniform2dv = reinterpret_cast<PFNGLPROGRAMUNIFORM2DVPROC>(LoadEntry("glProgramUniform2dv"));
glProgramUniform3dv = reinterpret_cast<PFNGLPROGRAMUNIFORM3DVPROC>(LoadEntry("glProgramUniform3dv"));
glProgramUniform4dv = reinterpret_cast<PFNGLPROGRAMUNIFORM4DVPROC>(LoadEntry("glProgramUniform4dv"));
@ -2116,12 +2128,18 @@ PFNGLPROGRAMPARAMETERIPROC glProgramParameteri = nullptr;
PFNGLPROGRAMUNIFORM1DPROC glProgramUniform1d = nullptr;
PFNGLPROGRAMUNIFORM1FPROC glProgramUniform1f = nullptr;
PFNGLPROGRAMUNIFORM1IPROC glProgramUniform1i = nullptr;
PFNGLPROGRAMUNIFORM1DVPROC glProgramUniform1dv = nullptr;
PFNGLPROGRAMUNIFORM1FVPROC glProgramUniform1fv = nullptr;
PFNGLPROGRAMUNIFORM1IVPROC glProgramUniform1iv = nullptr;
PFNGLPROGRAMUNIFORM2DVPROC glProgramUniform2dv = nullptr;
PFNGLPROGRAMUNIFORM2FVPROC glProgramUniform2fv = nullptr;
PFNGLPROGRAMUNIFORM2IVPROC glProgramUniform2iv = nullptr;
PFNGLPROGRAMUNIFORM3DVPROC glProgramUniform3dv = nullptr;
PFNGLPROGRAMUNIFORM3FVPROC glProgramUniform3fv = nullptr;
PFNGLPROGRAMUNIFORM3IVPROC glProgramUniform3iv = nullptr;
PFNGLPROGRAMUNIFORM4DVPROC glProgramUniform4dv = nullptr;
PFNGLPROGRAMUNIFORM4FVPROC glProgramUniform4fv = nullptr;
PFNGLPROGRAMUNIFORM4IVPROC glProgramUniform4iv = nullptr;
PFNGLPROGRAMUNIFORMMATRIX4DVPROC glProgramUniformMatrix4dv = nullptr;
PFNGLPROGRAMUNIFORMMATRIX4FVPROC glProgramUniformMatrix4fv = nullptr;
PFNGLREADPIXELSPROC glReadPixels = nullptr;
@ -2148,12 +2166,18 @@ PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D = nullptr;
PFNGLUNIFORM1DPROC glUniform1d = nullptr;
PFNGLUNIFORM1FPROC glUniform1f = nullptr;
PFNGLUNIFORM1IPROC glUniform1i = nullptr;
PFNGLUNIFORM1DVPROC glUniform1dv = nullptr;
PFNGLUNIFORM1FVPROC glUniform1fv = nullptr;
PFNGLUNIFORM1IVPROC glUniform1iv = nullptr;
PFNGLUNIFORM2DVPROC glUniform2dv = nullptr;
PFNGLUNIFORM2FVPROC glUniform2fv = nullptr;
PFNGLUNIFORM2IVPROC glUniform2iv = nullptr;
PFNGLUNIFORM3DVPROC glUniform3dv = nullptr;
PFNGLUNIFORM3FVPROC glUniform3fv = nullptr;
PFNGLUNIFORM3IVPROC glUniform3iv = nullptr;
PFNGLUNIFORM4DVPROC glUniform4dv = nullptr;
PFNGLUNIFORM4FVPROC glUniform4fv = nullptr;
PFNGLUNIFORM4IVPROC glUniform4iv = nullptr;
PFNGLUNIFORMMATRIX4DVPROC glUniformMatrix4dv = nullptr;
PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv = nullptr;
PFNGLUNMAPBUFFERPROC glUnmapBuffer = nullptr;

View File

@ -468,6 +468,34 @@ bool NzShaderProgram::SendDouble(int location, double value) const
return m_impl->SendDouble(location, value);
}
bool NzShaderProgram::SendDoubleArray(int location, const double* values, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!values && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendDoubleArray(location, values, count);
}
bool NzShaderProgram::SendFloat(int location, float value) const
{
#if NAZARA_RENDERER_SAFE
@ -484,6 +512,28 @@ bool NzShaderProgram::SendFloat(int location, float value) const
return m_impl->SendFloat(location, value);
}
bool NzShaderProgram::SendFloatArray(int location, const float* values, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!values && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendFloatArray(location, values, count);
}
bool NzShaderProgram::SendInteger(int location, int value) const
{
#if NAZARA_RENDERER_SAFE
@ -500,6 +550,28 @@ bool NzShaderProgram::SendInteger(int location, int value) const
return m_impl->SendInteger(location, value);
}
bool NzShaderProgram::SendIntegerArray(int location, const int* values, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!values && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendIntegerArray(location, values, count);
}
bool NzShaderProgram::SendMatrix(int location, const NzMatrix4d& matrix) const
{
#if NAZARA_RENDERER_SAFE
@ -592,6 +664,22 @@ bool NzShaderProgram::SendVector(int location, const NzVector2f& vector) const
return m_impl->SendVector(location, vector);
}
bool NzShaderProgram::SendVector(int location, const NzVector2i& vector) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVector(location, vector);
}
bool NzShaderProgram::SendVector(int location, const NzVector3d& vector) const
{
#if NAZARA_RENDERER_SAFE
@ -630,6 +718,22 @@ bool NzShaderProgram::SendVector(int location, const NzVector3f& vector) const
return m_impl->SendVector(location, vector);
}
bool NzShaderProgram::SendVector(int location, const NzVector3i& vector) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVector(location, vector);
}
bool NzShaderProgram::SendVector(int location, const NzVector4d& vector) const
{
#if NAZARA_RENDERER_SAFE
@ -668,6 +772,238 @@ bool NzShaderProgram::SendVector(int location, const NzVector4f& vector) const
return m_impl->SendVector(location, vector);
}
bool NzShaderProgram::SendVector(int location, const NzVector4i& vector) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVector(location, vector);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector2d* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector2f* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector2i* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector3d* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector3f* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector3i* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector4d* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector4f* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
bool NzShaderProgram::SendVectorArray(int location, const NzVector4i* vectors, unsigned int count) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Program not created");
return false;
}
if (!vectors && count > 0)
{
NazaraError("Invalid array");
return false;
}
#endif
if (location == -1)
return false;
return m_impl->SendVectorArray(location, vectors, count);
}
void NzShaderProgram::SetFlags(nzUInt32 flags)
{
m_flags = flags;