diff --git a/src/context3d.cpp b/src/context3d.cpp index 329cf595adc135bbb2f324015dbaa3d5dee6535d..6b4a9e692b9c878bb57c3026727fa93bae725777 100644 --- a/src/context3d.cpp +++ b/src/context3d.cpp @@ -4037,3 +4037,112 @@ void CanvasContext::stencilOpSeparate(glEnums face, glEnums fail, glEnums zfail, << ")"; glStencilOpSeparate(GLenum(face), GLenum(fail), GLenum(zfail), GLenum(zpass)); } + + +/*! + * \qmlmethod void Context3D::vertexAttrib1fva(int indx, list<variant> values) + * Sets the array of float values given in \a values to the generic vertex attribute index + * specified by \a indx. + */ +/*! + * \internal + */ +void CanvasContext::vertexAttrib1fva(uint indx, QVariantList values) +{ + if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ + << "(indx" << indx + << ", values:" << values + << ")"; + if (!m_currentProgram) + return; + + int size = values.count(); + float *arrayData = new float[size]; + + ArrayUtils::fillFloatArrayFromVariantList(values, arrayData); + + glVertexAttrib1fv(indx, arrayData); + + delete arrayData; +} + +/*! + * \qmlmethod void Context3D::vertexAttrib2fva(int indx, list<variant> values) + * Sets the array of float values given in \a values to the generic vertex attribute index + * specified by \a indx. + */ +/*! + * \internal + */ +void CanvasContext::vertexAttrib2fva(uint indx, QVariantList values) +{ + if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ + << "(indx" << indx + << ", values:" << values + << ")"; + if (!m_currentProgram) + return; + + int size = values.count(); + float *arrayData = new float[size]; + + ArrayUtils::fillFloatArrayFromVariantList(values, arrayData); + + glVertexAttrib2fv(indx, arrayData); + + delete arrayData; +} + +/*! + * \qmlmethod void Context3D::vertexAttrib3fva(int indx, list<variant> values) + * Sets the array of float values given in \a values to the generic vertex attribute index + * specified by \a indx. + */ +/*! + * \internal + */ +void CanvasContext::vertexAttrib3fva(uint indx, QVariantList values) +{ + if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ + << "(indx" << indx + << ", values:" << values + << ")"; + if (!m_currentProgram) + return; + + int size = values.count(); + float *arrayData = new float[size]; + + ArrayUtils::fillFloatArrayFromVariantList(values, arrayData); + + glVertexAttrib3fv(indx, arrayData); + + delete arrayData; +} + +/*! + * \qmlmethod void Context3D::vertexAttrib4fva(int indx, list<variant> values) + * Sets the array of float values given in \a values to the generic vertex attribute index + * specified by \a indx. + */ +/*! + * \internal + */ +void CanvasContext::vertexAttrib4fva(uint indx, QVariantList values) +{ + if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ + << "(indx" << indx + << ", values:" << values + << ")"; + if (!m_currentProgram) + return; + + int size = values.count(); + float *arrayData = new float[size]; + + ArrayUtils::fillFloatArrayFromVariantList(values, arrayData); + + glVertexAttrib4fv(indx, arrayData); + + delete arrayData; +} diff --git a/src/context3d_p.h b/src/context3d_p.h index d4bbd58a105f30c0fd940f8e5cc9ea2c7c07d243..facaff7b72e9e1b084cee2d24aab7bce1ef30c2a 100644 --- a/src/context3d_p.h +++ b/src/context3d_p.h @@ -1162,6 +1162,11 @@ public: Q_INVOKABLE void stencilOp(glEnums fail, glEnums zfail, glEnums zpass); Q_INVOKABLE void stencilOpSeparate(glEnums face, glEnums fail, glEnums zfail, glEnums zpass); + Q_INVOKABLE void vertexAttrib1fva(uint indx, QVariantList values); + Q_INVOKABLE void vertexAttrib2fva(uint indx, QVariantList values); + Q_INVOKABLE void vertexAttrib3fva(uint indx, QVariantList values); + Q_INVOKABLE void vertexAttrib4fva(uint indx, QVariantList values); + QString glEnumToString(glEnums value) const; float devicePixelRatio(); @@ -1181,11 +1186,6 @@ public: any getUniform(WebGLProgram program, WebGLUniformLocation? location); any getVertexAttrib(GLuint index, GLenum pname); GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname); - - void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values); - void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values); - void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values); - void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values); */ void setLogAllCalls(bool logCalls);