Browse Source

Added another constructor to MeshTools::AbstractIndexTool.

Not forcing to use MeshBuilder, passing just index array and vertex
count.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
31fd5bfb32
  1. 11
      src/MeshTools/AbstractTool.h
  2. 17
      src/MeshTools/Tipsify.h

11
src/MeshTools/AbstractTool.h

@ -40,7 +40,7 @@ template<class Vertex> class AbstractTool {
public:
/**
* @brief Constructor
* @param builder %Mesh builder to operate on
* @param builder %Mesh builder to operate on
*/
inline AbstractTool(MeshBuilder<Vertex>& builder): builder(builder), vertices(builder._vertices), indices(builder._indices) {}
@ -60,10 +60,17 @@ class AbstractIndexTool {
public:
/**
* @brief Constructor
* @param builder %Mesh builder to operate on
* @param builder %Mesh builder to operate on
*/
template<class Vertex> inline AbstractIndexTool(MeshBuilder<Vertex>& builder): indices(builder._indices), vertexCount(builder.vertexCount()) {}
/**
* @brief Constructor
* @param indices Indices array to operate on
* @param vertexCount Vertex count
*/
inline AbstractIndexTool(std::vector<unsigned int>& indices, unsigned int vertexCount): indices(indices), vertexCount(vertexCount) {}
protected:
std::vector<unsigned int>& indices; /**< @brief Builder indices */
const unsigned int vertexCount; /**< @brief Count of builder vertices */

17
src/MeshTools/Tipsify.h

@ -30,9 +30,12 @@ See tipsify() for full documentation.
*/
class Tipsify: public AbstractIndexTool {
public:
/** @copydoc AbstractIndexTool::AbstractIndexTool() */
/** @copydoc AbstractIndexTool::AbstractIndexTool(MeshBuilder<Vertex>&) */
template<class Vertex> inline Tipsify(MeshBuilder<Vertex>& builder): AbstractIndexTool(builder) {}
/** @copydoc AbstractIndexTool::AbstractIndexTool(std::vector<unsigned int>&, unsigned int) */
inline Tipsify(std::vector<unsigned int>& indices, unsigned int vertexCount): AbstractIndexTool(indices, vertexCount) {}
/**
* @brief Functor
*
@ -77,6 +80,18 @@ template<class Vertex> inline void tipsify(MeshBuilder<Vertex>& builder, size_t
Tipsify(builder).run(cacheSize);
}
/**
@brief %Tipsify the mesh
@param indices Indices array to operate on
@param vertexCount Vertex count
@param cacheSize Post-transform vertex cache size
See tipsify(MeshBuilder<Vertex>&, size_t) for more information.
*/
inline void tipsify(std::vector<unsigned int>& indices, unsigned int vertexCount, size_t cacheSize) {
Tipsify(indices, vertexCount).run(cacheSize);
}
}}
#endif

Loading…
Cancel
Save