From f18fac48eda114706ad880272e6d1894d4be36bd Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Fri, 27 Mar 2015 11:03:21 +0800 Subject: [PATCH 1/2] [ci skip]fix warning for doxygen --- cocos/renderer/CCGLProgram.h | 13 +++--- cocos/renderer/CCGLProgramState.h | 70 +++++++++++++++++------------ cocos/renderer/CCPrimitiveCommand.h | 2 +- cocos/renderer/CCQuadCommand.h | 2 +- 4 files changed, 50 insertions(+), 37 deletions(-) diff --git a/cocos/renderer/CCGLProgram.h b/cocos/renderer/CCGLProgram.h index 6aa423fd9c..4ec87b422d 100644 --- a/cocos/renderer/CCGLProgram.h +++ b/cocos/renderer/CCGLProgram.h @@ -417,15 +417,16 @@ public: /** calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program. */ void setUniformLocationWithMatrix4fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices); - /** @{ - will update the builtin uniforms if they are different than the previous call for this same shader program. - @param modelView modelView matrix applied to the built in uniform of the shader. - */ + /** + Update the builtin uniforms if they are different than the previous call for this same shader program. + */ void setUniformsForBuiltins(); + /** + Update the builtin uniforms if they are different than the previous call for this same shader program. + @param modelView modelView matrix applied to the built in uniform of the shader. + */ void setUniformsForBuiltins(const Mat4 &modelView); - /**@]*/ - /** returns the vertexShader error log */ std::string getVertexShaderLog() const; diff --git a/cocos/renderer/CCGLProgramState.h b/cocos/renderer/CCGLProgramState.h index 8ca46cfd7c..74c471f455 100644 --- a/cocos/renderer/CCGLProgramState.h +++ b/cocos/renderer/CCGLProgramState.h @@ -50,28 +50,23 @@ class CC_DLL UniformValue friend class GLProgram; friend class GLProgramState; public: - /**@{ - Construtor. If contruct the UniformValue with no param, the Uniform and Glprogram will be nullptr. + /** + Construtor. The Uniform and Glprogram will be nullptr. + */ + UniformValue(); + /** + Construtor with uniform and glprogram. @param uniform Uniform to apply the value. @param glprogram Specify the owner GLProgram of this uniform and uniform value. */ - UniformValue(); UniformValue(Uniform *uniform, GLProgram* glprogram); - /** - @} - */ + /**Destructor.*/ ~UniformValue(); /**@{ Set data to Uniform value. Generally, there are many type of data could be supported, - including float, int, Vec2/3/4, Mat4 and texture. Besides of this, there are also custom call - back functions for sending data when you want to send struct or array data. - If we want to send texture to uniform, there are two value to send, first one is texture handle ID, - the second one the texture unit. + including float, int, Vec2/3/4, Mat4. @param value Value to be sent, support float, int, Vec2/3/4, Mat4. - @param textureID The texture handle. - @param textureUnit The binding texture unit to be used in shader. - @param callback Callback function to send data to OpenGL pipeline. */ void setFloat(float value); void setInt(int value); @@ -79,12 +74,22 @@ public: void setVec3(const Vec3& value); void setVec4(const Vec4& value); void setMat4(const Mat4& value); - void setCallback(const std::function &callback); - void setTexture(GLuint textureId, GLuint textureUnit); /** @} */ + /** + Set call back to uniform value, which could be used for array and struct. + @param callback Callback function to send data to OpenGL pipeline. + */ + void setCallback(const std::function &callback); + /** + Set texture to uniform value. + @param textureID The texture handle. + @param textureUnit The binding texture unit to be used in shader. + */ + void setTexture(GLuint textureId, GLuint textureUnit); + /**Apply the uniform value to openGL pipeline.*/ void apply(); @@ -132,16 +137,19 @@ class CC_DLL VertexAttribValue public: /** - @{ - Constuctor and Destructor. - @paran vertexAttrib VertexAttrib from shader. + Constructor. + @param vertexAttrib VertexAttrib from shader. */ VertexAttribValue(VertexAttrib *vertexAttrib); + /** + Constructor. + */ VertexAttribValue(); + /** + Destructor. + */ ~VertexAttribValue(); - /**@}*/ - /** Set the data pointer, which is similar as glVertexAttribPointer. @param size The number of type in the vertex attribute. @@ -200,21 +208,25 @@ public: /** gets-or-creates an instance of GLProgramState for a given GLProgramName */ static GLProgramState* getOrCreateWithGLProgramName(const std::string &glProgramName ); - /** @{ + /** Apply GLProgram, attributes and uniforms. - `apply` function will apply all the states, include GLProgram, attributes and uniforms. - `applyGLProgram` function will apply GLProgram and built in uniform. - `applyAttributes` will apply the vertex attributes. - `applyUniforms` will apply user defined uniforms. - - @param The applied modelView matrix to shader. - @param applyAttribFlags Call GL::enableVertexAttribs(_vertexAttribsFlags) or not. + @param modelView The applied modelView matrix to shader. */ void apply(const Mat4& modelView); + /** + Apply GLProgram, and built in uniforms. + @param modelView The applied modelView matrix to shader. + */ void applyGLProgram(const Mat4& modelView); + /** + Apply attributes. + @param applyAttribFlags Call GL::enableVertexAttribs(_vertexAttribsFlags) or not. + */ void applyAttributes(bool applyAttribFlags = true); + /** + Apply user defined uniforms. + */ void applyUniforms(); - /**@}*/ /**@{ Setter and Getter of the owner GLProgram binded in this program state. diff --git a/cocos/renderer/CCPrimitiveCommand.h b/cocos/renderer/CCPrimitiveCommand.h index 834c72a0c8..9fba38e1fd 100644 --- a/cocos/renderer/CCPrimitiveCommand.h +++ b/cocos/renderer/CCPrimitiveCommand.h @@ -39,7 +39,7 @@ class CC_DLL PrimitiveCommand : public RenderCommand { public: /**@{ - @Constructor and Destructor. + Constructor and Destructor. */ PrimitiveCommand(); ~PrimitiveCommand(); diff --git a/cocos/renderer/CCQuadCommand.h b/cocos/renderer/CCQuadCommand.h index 5c17d50bc2..0f90e6488a 100644 --- a/cocos/renderer/CCQuadCommand.h +++ b/cocos/renderer/CCQuadCommand.h @@ -46,7 +46,7 @@ public: /** Initializes the command. @param globalOrder GlobalZOrder of the command. @param textureID The openGL handle of the used texture. - @param glProgramState The specified glProgram and its uniform. + @param shader The specified glProgram and its uniform. @param blendType Blend function for the command. @param quads Rendered quads for the command. @param quadCount The number of quads when rendering. From cbcdef11c3ef10dc1831d499bbe1adb207b1952b Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Fri, 27 Mar 2015 11:05:01 +0800 Subject: [PATCH 2/2] [ci skip]fix warning for doxygen --- cocos/renderer/CCGLProgramState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/renderer/CCGLProgramState.h b/cocos/renderer/CCGLProgramState.h index 74c471f455..3a4ba8a4ff 100644 --- a/cocos/renderer/CCGLProgramState.h +++ b/cocos/renderer/CCGLProgramState.h @@ -85,7 +85,7 @@ public: void setCallback(const std::function &callback); /** Set texture to uniform value. - @param textureID The texture handle. + @param textureId The texture handle. @param textureUnit The binding texture unit to be used in shader. */ void setTexture(GLuint textureId, GLuint textureUnit);