inline void buildMesh( const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3 ) { osg::Vec3* cb = &(_coordArray->front()); int p1=&v1-cb, p2=&v2-cb, p3=&v3-cb; PolyMesh::Face* face = new PolyMesh::Face( _coordArray, p1, p2, p3 ); _meshFaces->push_back( face ); EqualGroup g1=_coordSet.equal_range(&v1), g2=_coordSet.equal_range(&v2), g3=_coordSet.equal_range(&v3); buildEdge( g1, g2, face ); buildEdge( g2, g3, face ); buildEdge( g3, g1, face ); }
inline void incNormal( const vEngine::Vec3& vec, const vEngine::Vec3& normal, double weight ) { std::pair<CoordinateSet::iterator, CoordinateSet::iterator> p = _coordSet.equal_range( &vec ); for ( CoordinateSet::iterator itr=p.first; itr!=p.second; ++itr ) { int pos = *itr - _coordBase; double t = normal * _lastNormalRecorder[pos]; if ( _threshold<1.0f ) { if ( !equivalent(_lastNormalRecorder[pos], vEngine::Vec3(0.0f,0.0f,0.0f)) && t<_threshold && t>-_threshold ) continue; } vEngine::Vec3* nptr = _normalBase + pos; *nptr += normal * weight; _lastNormalRecorder[pos] = normal; } }