fix crash when meshing certain models
This commit is contained in:
parent
2d6e682f31
commit
95f8fa1fb8
|
|
@ -24,9 +24,62 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MesherFanMaker::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template <class PrimType>
|
||||
MesherFanMaker<PrimType>::
|
||||
MesherFanMaker(const Vertex *vertex, Strip *tri, Mesher *mesher) {
|
||||
_vertex = vertex;
|
||||
const Edge *edge = tri->find_opposite_edge(vertex);
|
||||
if (edge != (const Edge *)NULL) {
|
||||
_edges.push_back(edge);
|
||||
}
|
||||
_strips.push_back(tri);
|
||||
_planar = tri->_planar;
|
||||
_mesher = mesher;
|
||||
_bucket = _mesher->_bucket;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MesherFanMaker::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template <class PrimType>
|
||||
MesherFanMaker<PrimType>::
|
||||
MesherFanMaker(const MesherFanMaker<PrimType> ©) :
|
||||
_vertex(copy._vertex),
|
||||
_edges(copy._edges),
|
||||
_strips(copy._strips),
|
||||
_planar(copy._planar),
|
||||
_bucket(copy._bucket),
|
||||
_mesher(copy._mesher)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MesherFanMaker::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template <class PrimType>
|
||||
void MesherFanMaker<PrimType>::
|
||||
operator = (const MesherFanMaker<PrimType> ©) {
|
||||
_vertex = copy._vertex;
|
||||
_edges = copy._edges;
|
||||
_strips = copy._strips;
|
||||
_planar = copy._planar;
|
||||
_bucket = copy._bucket;
|
||||
_mesher = copy._mesher;
|
||||
}
|
||||
|
||||
template <class PrimType>
|
||||
INLINE bool MesherFanMaker<PrimType>::
|
||||
operator < (const MesherFanMaker &other) const {
|
||||
nassertr(!_edges.empty() && !other._edges.empty(), false);
|
||||
return _edges.front() < other._edges.front();
|
||||
}
|
||||
|
||||
|
|
@ -68,20 +121,6 @@ is_coplanar_with(const MesherFanMaker &other) const {
|
|||
_bucket->_coplanar_threshold);
|
||||
}
|
||||
|
||||
template <class PrimType>
|
||||
MesherFanMaker<PrimType>::
|
||||
MesherFanMaker(const Vertex *vertex, Strip *tri, Mesher *mesher) {
|
||||
_vertex = vertex;
|
||||
const Edge *edge = tri->find_opposite_edge(vertex);
|
||||
if (edge != (const Edge *)NULL) {
|
||||
_edges.push_back(edge);
|
||||
}
|
||||
_strips.push_back(tri);
|
||||
_planar = tri->_planar;
|
||||
_mesher = mesher;
|
||||
_bucket = _mesher->_bucket;
|
||||
}
|
||||
|
||||
template <class PrimType>
|
||||
bool MesherFanMaker<PrimType>::
|
||||
join(MesherFanMaker &other) {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public:
|
|||
|
||||
MesherFanMaker() {}
|
||||
MesherFanMaker(const Vertex *vertex, Strip *tri, Mesher *mesher);
|
||||
MesherFanMaker(const MesherFanMaker<PrimType> ©);
|
||||
void operator = (const MesherFanMaker<PrimType> ©);
|
||||
|
||||
INLINE bool operator < (const MesherFanMaker &other) const;
|
||||
INLINE bool operator != (const MesherFanMaker &other) const;
|
||||
|
|
|
|||
|
|
@ -534,7 +534,10 @@ find_fans() {
|
|||
++si) {
|
||||
Strip *strip = *si;
|
||||
if (strip->_type == BPT_tri) {
|
||||
fans.push_back(FanMaker(&v, strip, this));
|
||||
FanMaker fan(&v, strip, this);
|
||||
if (!fan._edges.empty()) {
|
||||
fans.push_back(fan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue