Commit 1354ce58 authored by Jan Möbius's avatar Jan Möbius

Documentation, Doxygen and cppcheck warning fixes

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17576 383ad7c9-94d9-4d36-a494-682f7c89f535
parent dc7038c0
...@@ -183,20 +183,30 @@ public: ...@@ -183,20 +183,30 @@ public:
void setVertices(int _num, const void* _data, int _stride = 0, bool _internalCopy = false); void setVertices(int _num, const void* _data, int _stride = 0, bool _internalCopy = false);
/** set input normals /** set input normals
*
* @param _num Number of normals
* @param _data Pointer to normals data
* @param _stride Difference in bytes between two normals positions in _data. Default value 0 indicates a tight float3 position array without any other data or memory alignment.
* @param _internalCopy Memory optimization flag: select true if the provided data address is only temporarily valid. Otherwise an internal copy must be made.
*/ */
void setNormals(int _num, const void* _data, int _stride = 0, bool _internalCopy = false); void setNormals(int _num, const void* _data, int _stride = 0, bool _internalCopy = false);
/** set input texture coords /** set input texture coords
*
* @param _num Number of texture coords
* @param _data Pointer to texture coord data
* @param _stride Difference in bytes between two texture coordinate positions in _data. Default value 0 indicates a tight float3 position array without any other data or memory alignment.
* @param _internalCopy Memory optimization flag: select true if the provided data address is only temporarily valid. Otherwise an internal copy must be made.
*/ */
void setTexCoords(int _num, const void* _data, int _stride = 0, bool _internalCopy = false); void setTexCoords(int _num, const void* _data, int _stride = 0, bool _internalCopy = false);
/** Set custom input attribute. /** Set custom input attribute.
* *
* Alternatively allocates an internal buffer only, such that data can be provided via setAttrib(). * Alternatively allocates an internal buffer only, such that data can be provided via setAttrib().
* @param _attrIdx Attribute id from VertexDeclaration * @param _attrIdx Attribute id from VertexDeclaration
* @param _num Number of attributes * @param _num Number of attributes
* @param _data Input data buffer, may be null to only * @param _data Input data buffer, may be null to only
* @param _stride Offset difference in bytes to the next attribute in _data. Default value 0 indicates no data alignment/memory packing. * @param _stride Offset difference in bytes to the next attribute in _data. Default value 0 indicates no data alignment/memory packing.
* @param _internalCopy Create an internal buffer and make a copy _data * @param _internalCopy Create an internal buffer and make a copy _data
*/ */
void setAttribVec(int _attrIdx, int _num, const void* _data, int _stride = 0, bool _internalCopy = false); void setAttribVec(int _attrIdx, int _num, const void* _data, int _stride = 0, bool _internalCopy = false);
...@@ -234,7 +244,7 @@ public: ...@@ -234,7 +244,7 @@ public:
* @{ */ * @{ */
//=========================================================================== //===========================================================================
/** Set number of faces and indices if known by user /** \brief Set number of faces and indices if known by user
* *
* User may give a rough estimate of face/index count. * User may give a rough estimate of face/index count.
* A more accurate estimation improves efficiency: too low numbers result in performance hit, too high numbers in memory consumption * A more accurate estimation improves efficiency: too low numbers result in performance hit, too high numbers in memory consumption
...@@ -244,7 +254,7 @@ public: ...@@ -244,7 +254,7 @@ public:
void setNumFaces(const int _numFaces, const int _numIndices); void setNumFaces(const int _numFaces, const int _numIndices);
/** Set index buffer for a triangle mesh. /** \brief Set index buffer for a triangle mesh.
* *
* This should only be used if the input vertex buffer is interleaved already. * This should only be used if the input vertex buffer is interleaved already.
* @param _numTris Number of triangles. * @param _numTris Number of triangles.
...@@ -253,7 +263,7 @@ public: ...@@ -253,7 +263,7 @@ public:
*/ */
void setIndexBufferInterleaved(int _numTris, int _indexSize, const void* _indices); void setIndexBufferInterleaved(int _numTris, int _indexSize, const void* _indices);
/** Set vertex ids per triangle. /** \brief Set vertex ids per triangle.
* *
* @param _i Face ID * @param _i Face ID
* @param _v0 1st vertex id * @param _v0 1st vertex id
...@@ -262,7 +272,7 @@ public: ...@@ -262,7 +272,7 @@ public:
*/ */
void setFaceVerts(int _i, int _v0, int _v1, int _v2); void setFaceVerts(int _i, int _v0, int _v1, int _v2);
/** Set vertex ids per face. /** \brief Set vertex ids per face.
* *
* @param _i Face id * @param _i Face id
* @param _faceSize Size of face, ie. number of vertices of face * @param _faceSize Size of face, ie. number of vertices of face
...@@ -270,7 +280,7 @@ public: ...@@ -270,7 +280,7 @@ public:
*/ */
void setFaceVerts(int _i, int _faceSize, int* _v); void setFaceVerts(int _i, int _faceSize, int* _v);
/** Set normal ids per triangle. /** \brief Set normal ids per triangle.
* *
* @param _i Face ID * @param _i Face ID
* @param _v0 1st normal id * @param _v0 1st normal id
...@@ -279,7 +289,7 @@ public: ...@@ -279,7 +289,7 @@ public:
*/ */
void setFaceNormals(int _i, int _v0, int _v1, int _v2); void setFaceNormals(int _i, int _v0, int _v1, int _v2);
/** Set normal ids per face. /** \brief Set normal ids per face.
* *
* @param _i Face id * @param _i Face id
* @param _faceSize Size of face, ie. number of vertices of face * @param _faceSize Size of face, ie. number of vertices of face
...@@ -287,7 +297,7 @@ public: ...@@ -287,7 +297,7 @@ public:
*/ */
void setFaceNormals(int _i, int _faceSize, int* _v); void setFaceNormals(int _i, int _faceSize, int* _v);
/** Set texcoord ids per triangle. /** \brief Set texcoord ids per triangle.
* *
* @param _i Face ID * @param _i Face ID
* @param _v0 1st texcoord id * @param _v0 1st texcoord id
...@@ -296,7 +306,7 @@ public: ...@@ -296,7 +306,7 @@ public:
*/ */
void setFaceTexCoords(int _i, int _v0, int _v1, int _v2); void setFaceTexCoords(int _i, int _v0, int _v1, int _v2);
/** Set texcoord ids per face. /** \brief Set texcoord ids per face.
* *
* @param _i Face id * @param _i Face id
* @param _faceSize Size of face, ie. number of vertices of face * @param _faceSize Size of face, ie. number of vertices of face
...@@ -305,7 +315,7 @@ public: ...@@ -305,7 +315,7 @@ public:
void setFaceTexCoords(int _i, int _faceSize, int* _v); void setFaceTexCoords(int _i, int _faceSize, int* _v);
/** Set attribute ids per triangle. /** \brief Set attribute ids per triangle.
* *
* @param _i Face id * @param _i Face id
* @param _v0 1st element id * @param _v0 1st element id
...@@ -315,12 +325,12 @@ public: ...@@ -315,12 +325,12 @@ public:
*/ */
void setFaceAttrib(int _i, int _v0, int _v1, int _v2, int _attrID); void setFaceAttrib(int _i, int _v0, int _v1, int _v2, int _attrID);
/** Set attribute ids per face. /** \brief Set attribute ids per face.
* *
* @param _i Face id * @param _i Face id
* @param _faceSize Size of face, ie. number of vertices of face * @param _faceSize Size of face, ie. number of vertices of face
* @param _v Element ids * @param _v Element ids
* @param _attrID Which attribute: index of VertexDeclaration element array * @param _attrID Which attribute: index of VertexDeclaration element array
*/ */
void setFaceAttrib(int _i, int _faceSize, int* _v, int _attrID); void setFaceAttrib(int _i, int _faceSize, int* _v, int _attrID);
...@@ -333,11 +343,11 @@ public: ...@@ -333,11 +343,11 @@ public:
//=========================================================================== //===========================================================================
/** Specify face groups. /** \brief Specify face groups.
* *
* Faces with the same group ID will be chunked together in the sorting process. * Faces with the same group ID will be chunked together in the sorting process.
* This feature may be used for material/texture subsets. * This feature may be used for material/texture subsets.
* @param _i Face ID * @param _i Face ID
* @param _groupID Custom group ID * @param _groupID Custom group ID
*/ */
void setFaceGroup(int _i, int _groupID); void setFaceGroup(int _i, int _groupID);
...@@ -353,13 +363,38 @@ public: ...@@ -353,13 +363,38 @@ public:
unsigned int startFace; // index into sorted list of faces unsigned int startFace; // index into sorted list of faces
}; };
/// get subset ID of a group /** \brief get subset ID of a group
*
* @param _groupID Id of the group
* @return Subset Id
*/
int findGroupSubset(int _groupID); int findGroupSubset(int _groupID);
/** \brief Get Face Group of the given face
*
* @param _faceID Id of the face
* @return Group Id
*/
int getFaceGroup(int _faceID) const; int getFaceGroup(int _faceID) const;
/** \brief Get Group Id of the triangle
*
* @param _triID Id of the triangle
* @return Group of the triangle
*/
int getTriGroup(int _triID) const; int getTriGroup(int _triID) const;
/** \brief Get the number of subsets
*
* @return Number of subsets
*/
int getNumSubsets() const {return (int)subsets_.size();} int getNumSubsets() const {return (int)subsets_.size();}
/** \brief get a specific subset
*
* @param _i Id of the subset
* @return The subset
*/
const Subset* getSubset(int _i) const; const Subset* getSubset(int _i) const;
...@@ -371,7 +406,7 @@ public: ...@@ -371,7 +406,7 @@ public:
//=========================================================================== //===========================================================================
/* \brief Build vertex + index buffer. /** \brief Build vertex + index buffer.
* *
* @param _optimizeVCache Reorder faces for optimized vcache usage. Low performance hit on build() execution time * @param _optimizeVCache Reorder faces for optimized vcache usage. Low performance hit on build() execution time
* @param _needPerFaceAttribute User wants to set per-face attributes in draw vertex buffer. The first referenced vertex of each face can be used to store per-face data. High performance hit on execution time * @param _needPerFaceAttribute User wants to set per-face attributes in draw vertex buffer. The first referenced vertex of each face can be used to store per-face data. High performance hit on execution time
...@@ -379,7 +414,7 @@ public: ...@@ -379,7 +414,7 @@ public:
void build(bool _optimizeVCache = true, bool _needPerFaceAttribute = false); void build(bool _optimizeVCache = true, bool _needPerFaceAttribute = false);
/* \brief Get vertex buffer ready for rendering. /** \brief Get vertex buffer ready for rendering.
* *
* Query final vertex buffer data. * Query final vertex buffer data.
* Support vertex buffer batch uploads. * Support vertex buffer batch uploads.
...@@ -389,7 +424,7 @@ public: ...@@ -389,7 +424,7 @@ public:
*/ */
void getVertexBuffer(void* _dst, const int _offset = 0, const int _range = -1); void getVertexBuffer(void* _dst, const int _offset = 0, const int _range = -1);
/* Get index buffer ready for rendering. /** Get index buffer ready for rendering.
*/ */
int* getIndexBuffer() const {return indices_;} int* getIndexBuffer() const {return indices_;}
...@@ -401,8 +436,11 @@ public: ...@@ -401,8 +436,11 @@ public:
*/ */
int getNumFaces() const; int getNumFaces() const;
/** Get size of input face /** \brief Get size of input face
*/ *
* @param _i Index
* @return Size
*/
inline int getFaceSize(const int _i) const inline int getFaceSize(const int _i) const
{ {
return faceSize_[_i]; return faceSize_[_i];
......
...@@ -352,7 +352,7 @@ public: ...@@ -352,7 +352,7 @@ public:
/** \brief set values for int uniforms /** \brief set values for int uniforms
* *
* @param _uniformName Name of uniform in shader * @param _name Name of uniform in shader
* @param _value value of the type * @param _value value of the type
* *
*/ */
...@@ -360,7 +360,7 @@ public: ...@@ -360,7 +360,7 @@ public:
/** \brief set values for float uniforms /** \brief set values for float uniforms
* *
* @param _uniformName Name of uniform in shader * @param _name Name of uniform in shader
* @param _value value of the type * @param _value value of the type
* *
*/ */
...@@ -368,7 +368,7 @@ public: ...@@ -368,7 +368,7 @@ public:
/** \brief set values for Vec2f uniforms /** \brief set values for Vec2f uniforms
* *
* @param _uniformName Name of uniform in shader * @param _name Name of uniform in shader
* @param _value value of the type * @param _value value of the type
* *
*/ */
...@@ -376,7 +376,7 @@ public: ...@@ -376,7 +376,7 @@ public:
/** \brief set values for Vec3f uniforms /** \brief set values for Vec3f uniforms
* *
* @param _uniformName Name of uniform in shader * @param _name Name of uniform in shader
* @param _value value of the type * @param _value value of the type
* *
*/ */
...@@ -384,7 +384,7 @@ public: ...@@ -384,7 +384,7 @@ public:
/** \brief set values for Vec4f uniforms /** \brief set values for Vec4f uniforms
* *
* @param _uniformName Name of uniform in shader * @param _name Name of uniform in shader
* @param _value value of the type * @param _value value of the type
* *
*/ */
......
...@@ -161,12 +161,22 @@ namespace GLSL { ...@@ -161,12 +161,22 @@ namespace GLSL {
checkGLError2(id.c_str()); checkGLError2(id.c_str());
switch (size){ switch (size){
case 1: glUniform1fv(location, 1, val.data()); break; case 1:
case 2: glUniform2fv(location, 1, val.data()); break; glUniform1fv(location, 1, val.data());
case 3: glUniform3fv(location, 1, val.data()); break; break;
case 4: glUniform4fv(location, 1, val.data()); break; case 2:
glUniform2fv(location, 1, val.data());
break;
case 3:
glUniform3fv(location, 1, val.data());
break;
case 4:
glUniform4fv(location, 1, val.data());
break;
default: std::cerr << "UniformPool::UniformVecf : invalid size " << size << std::endl; default:
std::cerr << "UniformPool::UniformVecf : invalid size " << size << std::endl;
break;
} }
checkGLError2(id.c_str()); checkGLError2(id.c_str());
...@@ -182,12 +192,22 @@ namespace GLSL { ...@@ -182,12 +192,22 @@ namespace GLSL {
checkGLError2(id.c_str()); checkGLError2(id.c_str());
switch (size){ switch (size){
case 1: glUniform1iv(location, 1, (GLint*)val.data()); break; case 1:
case 2: glUniform2iv(location, 1, (GLint*)val.data()); break; glUniform1iv(location, 1, (GLint*)val.data());
case 3: glUniform3iv(location, 1, (GLint*)val.data()); break; break;
case 4: glUniform4iv(location, 1, (GLint*)val.data()); break; case 2:
glUniform2iv(location, 1, (GLint*)val.data());
default: std::cerr << "UniformPool::UniformVeci : invalid size " << size << std::endl; break;
case 3:
glUniform3iv(location, 1, (GLint*)val.data());
break;
case 4:
glUniform4iv(location, 1, (GLint*)val.data());
break;
default:
std::cerr << "UniformPool::UniformVeci : invalid size " << size << std::endl;
break;
} }
checkGLError2(id.c_str()); checkGLError2(id.c_str());
...@@ -365,11 +385,11 @@ namespace GLSL { ...@@ -365,11 +385,11 @@ namespace GLSL {
/** \brief Add or update an array type uniform in pool /** \brief Add or update an array type uniform in pool
* *
* @param _name Uniform name * @param _name Uniform name
* @param _value array data * @param _values array data
* @param _count array size (in dwords) * @param _count array size (in dwords)
* @param _integer integer/float array * @param _integer integer/float array
*/ */
void UniformPool::addBuf( const char *_name, void *_values, int _count, bool _integer ) { void UniformPool::addBuf( const char* _name, void* _values, int _count, bool _integer ) {
// look for existing uniform in pool // look for existing uniform in pool
UniformListIt it = findEntry(_name); UniformListIt it = findEntry(_name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment