//----------------------------------------------------------
void ofTessellator::tessellateToPolylines( const ofPolyline& src,  ofPolyWindingMode polyWindingMode, vector<ofPolyline>& dstpoly, bool bIs2D){

	ofPolyline& polyline = const_cast<ofPolyline&>(src);
	tessAddContour( cacheTess, bIs2D?2:3, &polyline.getVertices()[0], sizeof(ofPoint), polyline.size());

	performTessellation( polyWindingMode, dstpoly, bIs2D );
}
//----------------------------------------------------------
void ofTessellator::tessellateToMesh( const ofPolyline& src,  ofPolyWindingMode polyWindingMode, ofMesh& dstmesh, bool bIs2D){

	ofPolyline& polyline = const_cast<ofPolyline&>(src);
	tessAddContour( cacheTess, bIs2D?2:3, &polyline.getVertices()[0], sizeof(glm::vec3), polyline.size());

	performTessellation( polyWindingMode, dstmesh, bIs2D );
}
vector<meshy> ofTessellator::tessellateToMesh( const vector<ofPolyline>& polylines, int polyWindingMode, bool bIs2D ) {
#else
static ofMesh ofTessellator::tessellateToMesh( const vector<ofPolyline>& polylines, int polyWindingMode, bool bIs2D ) {
#endif

	mutex.lock();
	
	clear();
#ifdef DRAW_WITH_MESHIES
	resultMeshies.clear();
#else
	resultMesh = ofMesh();
#endif

	performTessellation( polylines, polyWindingMode, true /* filled */, bIs2D );
	
	mutex.unlock();
	
#ifdef DRAW_WITH_MESHIES
	return resultMeshies;
#else
	return resultMesh;
#endif
		
}
//----------------------------------------------------------
void ofTessellator::tessellateToPolylines( const vector<ofPolyline>& src, ofPolyWindingMode polyWindingMode, vector<ofPolyline>& dstpoly, bool bIs2D ) {

	// pass vertex pointers to GLU tessellator
	for ( int i=0; i<(int)src.size(); ++i ) {
		ofPolyline& polyline = const_cast<ofPolyline&>(src[i]);

		tessAddContour( cacheTess, bIs2D?2:3, &polyline.getVertices()[0].x, sizeof(ofPoint), polyline.size());
	}

	performTessellation( polyWindingMode, dstpoly, bIs2D );
}
Exemple #5
0
//----------------------------------------------------------
vector<ofPolyline> ofTessellator::tessellateToOutline( const vector<ofPolyline>& polylines, int polyWindingMode, bool bIs2D ) {
    Poco::ScopedLock<ofMutex> lock(mutex);

    clear();
    resultOutline.clear();

    performTessellation( polylines, polyWindingMode, false /* filled */, bIs2D );


    return resultOutline;
}
Exemple #6
0
//----------------------------------------------------------
vector<ofPrimitive> ofTessellator::tessellateToMesh( const vector<ofPolyline>& polylines, int polyWindingMode, bool bIs2D ) {

    Poco::ScopedLock<ofMutex> lock(mutex);

    clear();
    resultMesh.clear();

    performTessellation( polylines, polyWindingMode, true /* filled */, bIs2D );


    return resultMesh;

}
//----------------------------------------------------------
ofPolyline ofTessellator::tessellateToOutline( const vector<ofPolyline>& polylines, int polyWindingMode, bool bIs2D ) {
	mutex.lock();
	
	clear();
	resultOutline.clear();
	
	performTessellation( polylines, polyWindingMode, false /* filled */, bIs2D );
	
	mutex.unlock();

	return resultOutline;
	
	
}