diff --git a/include/Nazara/Renderer/OpenGL.hpp b/include/Nazara/Renderer/OpenGL.hpp index 006335dfb..a5fa89c7d 100644 --- a/include/Nazara/Renderer/OpenGL.hpp +++ b/include/Nazara/Renderer/OpenGL.hpp @@ -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; diff --git a/include/Nazara/Renderer/ShaderProgram.hpp b/include/Nazara/Renderer/ShaderProgram.hpp index 89da03b0a..d959736e9 100644 --- a/include/Nazara/Renderer/ShaderProgram.hpp +++ b/include/Nazara/Renderer/ShaderProgram.hpp @@ -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); diff --git a/src/Nazara/Renderer/GLSLProgram.cpp b/src/Nazara/Renderer/GLSLProgram.cpp index 641bd4d82..07241aeb1 100644 --- a/src/Nazara/Renderer/GLSLProgram.cpp +++ b/src/Nazara/Renderer/GLSLProgram.cpp @@ -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(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform2dv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector2f* vectors, unsigned int count) +{ + if (glProgramUniform2fv) + glProgramUniform2fv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform2fv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector2i* vectors, unsigned int count) +{ + if (glProgramUniform2iv) + glProgramUniform2iv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform2iv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector3d* vectors, unsigned int count) +{ + if (glProgramUniform3dv) + glProgramUniform3dv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform3dv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector3f* vectors, unsigned int count) +{ + if (glProgramUniform3fv) + glProgramUniform3fv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform3fv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector3i* vectors, unsigned int count) +{ + if (glProgramUniform3iv) + glProgramUniform3iv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform3iv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector4d* vectors, unsigned int count) +{ + if (glProgramUniform4dv) + glProgramUniform4dv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform4dv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector4f* vectors, unsigned int count) +{ + if (glProgramUniform4fv) + glProgramUniform4fv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform4fv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + +bool NzGLSLProgram::SendVectorArray(int location, const NzVector4i* vectors, unsigned int count) +{ + if (glProgramUniform4iv) + glProgramUniform4iv(m_program, location, count, reinterpret_cast(vectors)); + else + { + NzOpenGL::BindProgram(m_program); + glUniform4iv(location, count, reinterpret_cast(vectors)); + } + + return true; +} + bool NzGLSLProgram::OnResourceCreated(const NzResource* resource, int index) { NazaraUnused(resource); diff --git a/src/Nazara/Renderer/GLSLProgram.hpp b/src/Nazara/Renderer/GLSLProgram.hpp index ed03bb57d..b35b5070d 100644 --- a/src/Nazara/Renderer/GLSLProgram.hpp +++ b/src/Nazara/Renderer/GLSLProgram.hpp @@ -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; diff --git a/src/Nazara/Renderer/OpenGL.cpp b/src/Nazara/Renderer/OpenGL.cpp index a96c98950..c22f6e155 100644 --- a/src/Nazara/Renderer/OpenGL.cpp +++ b/src/Nazara/Renderer/OpenGL.cpp @@ -864,9 +864,14 @@ bool NzOpenGL::Initialize() glTexSubImage3D = reinterpret_cast(LoadEntry("glTexSubImage3D")); glUniform1f = reinterpret_cast(LoadEntry("glUniform1f")); glUniform1i = reinterpret_cast(LoadEntry("glUniform1i")); + glUniform1fv = reinterpret_cast(LoadEntry("glUniform1fv")); + glUniform1iv = reinterpret_cast(LoadEntry("glUniform1iv")); glUniform2fv = reinterpret_cast(LoadEntry("glUniform2fv")); + glUniform2iv = reinterpret_cast(LoadEntry("glUniform2iv")); glUniform3fv = reinterpret_cast(LoadEntry("glUniform3fv")); + glUniform3iv = reinterpret_cast(LoadEntry("glUniform3iv")); glUniform4fv = reinterpret_cast(LoadEntry("glUniform4fv")); + glUniform4iv = reinterpret_cast(LoadEntry("glUniform4iv")); glUniformMatrix4fv = reinterpret_cast(LoadEntry("glUniformMatrix4fv")); glUnmapBuffer = reinterpret_cast(LoadEntry("glUnmapBuffer")); glUseProgram = reinterpret_cast(LoadEntry("glUseProgram")); @@ -1033,6 +1038,7 @@ bool NzOpenGL::Initialize() try { glUniform1d = reinterpret_cast(LoadEntry("glUniform1d")); + glUniform1dv = reinterpret_cast(LoadEntry("glUniform1dv")); glUniform2dv = reinterpret_cast(LoadEntry("glUniform2dv")); glUniform3dv = reinterpret_cast(LoadEntry("glUniform3dv")); glUniform4dv = reinterpret_cast(LoadEntry("glUniform4dv")); @@ -1148,15 +1154,21 @@ bool NzOpenGL::Initialize() { glProgramUniform1f = reinterpret_cast(LoadEntry("glProgramUniform1f")); glProgramUniform1i = reinterpret_cast(LoadEntry("glProgramUniform1i")); + glProgramUniform1fv = reinterpret_cast(LoadEntry("glProgramUniform1fv")); + glProgramUniform1iv = reinterpret_cast(LoadEntry("glProgramUniform1iv")); glProgramUniform2fv = reinterpret_cast(LoadEntry("glProgramUniform2fv")); + glProgramUniform2iv = reinterpret_cast(LoadEntry("glProgramUniform2iv")); glProgramUniform3fv = reinterpret_cast(LoadEntry("glProgramUniform3fv")); + glProgramUniform3iv = reinterpret_cast(LoadEntry("glProgramUniform3iv")); glProgramUniform4fv = reinterpret_cast(LoadEntry("glProgramUniform4fv")); + glProgramUniform4iv = reinterpret_cast(LoadEntry("glProgramUniform4iv")); glProgramUniformMatrix4fv = reinterpret_cast(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(LoadEntry("glProgramUniform1d")); + glProgramUniform1dv = reinterpret_cast(LoadEntry("glProgramUniform1dv")); glProgramUniform2dv = reinterpret_cast(LoadEntry("glProgramUniform2dv")); glProgramUniform3dv = reinterpret_cast(LoadEntry("glProgramUniform3dv")); glProgramUniform4dv = reinterpret_cast(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; diff --git a/src/Nazara/Renderer/ShaderProgram.cpp b/src/Nazara/Renderer/ShaderProgram.cpp index 0c1711146..c33fedfe5 100644 --- a/src/Nazara/Renderer/ShaderProgram.cpp +++ b/src/Nazara/Renderer/ShaderProgram.cpp @@ -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;