Added updating of the bbox for generic mesh build

Added build for point clouds
Added Clear at the beginning of the Build(m)
This commit is contained in:
Paolo Cignoni 2013-06-24 06:49:51 +00:00
parent 94fe86b876
commit efe6379b4b
1 changed files with 44 additions and 33 deletions

View File

@ -558,6 +558,7 @@ void Torus(MeshType &m, float hRingRadius, float vRingRadius, int hRingDiv=24, i
} }
// this function build a mesh starting from a vector of generic coords (objects having a triple of float at their beginning) // this function build a mesh starting from a vector of generic coords (objects having a triple of float at their beginning)
// and a vector of faces (objects having a triple of ints at theri beginning). // and a vector of faces (objects having a triple of ints at theri beginning).
template <class MeshType,class V, class F > template <class MeshType,class V, class F >
@ -569,6 +570,7 @@ void Build( MeshType & in, const V & v, const F & f)
typedef typename MeshType::VertexIterator VertexIterator; typedef typename MeshType::VertexIterator VertexIterator;
typedef typename MeshType::FaceIterator FaceIterator; typedef typename MeshType::FaceIterator FaceIterator;
in.Clear();
Allocator<MeshType>::AddVertices(in,v.size()); Allocator<MeshType>::AddVertices(in,v.size());
Allocator<MeshType>::AddFaces(in,f.size()); Allocator<MeshType>::AddFaces(in,f.size());
@ -604,8 +606,17 @@ void Build( MeshType & in, const V & v, const F & f)
in.face[i].V(0) = &in.vert[ ff[0] ]; in.face[i].V(0) = &in.vert[ ff[0] ];
in.face[i].V(1) = &in.vert[ ff[0] ]; in.face[i].V(1) = &in.vert[ ff[0] ];
in.face[i].V(2) = &in.vert[ ff[0] ]; in.face[i].V(2) = &in.vert[ ff[0] ];
} }
tri::UpdateBounding<MeshType>::Box(in);
}
template <class MeshType,class V>
void Build( MeshType & in, const V & v)
{
std::vector<int[3]> dummyfaceVec;
Build(in,v,dummyfaceVec);
} }
// Build a regular grid mesh as a typical height field mesh // Build a regular grid mesh as a typical height field mesh