mirror of
https://github.com/CloudCompare/PoissonRecon.git
synced 2026-08-29 16:40:28 +08:00
Added check if write succeeded.
This commit is contained in:
@@ -154,7 +154,8 @@ void _Execute( const FEMTree< Dim , Real >* tree , FILE* fp )
|
||||
if( Verbose.set ) printf( "Vertices / Polygons: %d / %d\n" , (int)( mesh.outOfCorePointCount()+mesh.inCorePoints.size() ) , (int)mesh.polygonCount() );
|
||||
|
||||
std::vector< std::string > comments;
|
||||
PlyWritePolygons< Vertex , Real , Dim >( OutMesh.value , &mesh , ASCII.set ? PLY_ASCII : PLY_BINARY_NATIVE , comments , XForm< Real , Dim+1 >::Identity() );
|
||||
if( !PlyWritePolygons< Vertex , Real , Dim >( OutMesh.value , &mesh , ASCII.set ? PLY_ASCII : PLY_BINARY_NATIVE , comments , XForm< Real , Dim+1 >::Identity() ) )
|
||||
fprintf( stderr , "[ERROR] Could not write mesh to: %s\n" , OutMesh.value ) , exit( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ DAMAGE.
|
||||
#include "CmdLineParser.h"
|
||||
#include "PPolynomial.h"
|
||||
#include "FEMTree.h"
|
||||
#include "Ply.h"
|
||||
|
||||
MessageWriter messageWriter;
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ struct RGBPixel
|
||||
void WriteImage( char* fileName , RGBPixel* pixels , int w , int h )
|
||||
{
|
||||
unsigned int _w = w , _h = h , _c = 3;
|
||||
ImageWriter::Write( fileName , (const unsigned char*)pixels , _w , _h , _c );
|
||||
if( !ImageWriter::Write( fileName , (const unsigned char*)pixels , _w , _h , _c ) )
|
||||
fprintf( stderr , "[ERROR] Could not write image to: %s\n" , fileName ) , exit( 0 );
|
||||
}
|
||||
|
||||
struct Profiler
|
||||
|
||||
@@ -339,7 +339,8 @@ void ExtractMesh( UIntPack< FEMSigs ... > , std::tuple< SampleData ... > , FEMTr
|
||||
else profiler.dumpOutput2( comments , "# Got triangles:" );
|
||||
|
||||
std::vector< std::string > noComments;
|
||||
PlyWritePolygons< Vertex , Real , Dim >( Out.value , &mesh , ASCII.set ? PLY_ASCII : PLY_BINARY_NATIVE , NoComments.set ? noComments : comments , iXForm );
|
||||
if( !PlyWritePolygons< Vertex , Real , Dim >( Out.value , &mesh , ASCII.set ? PLY_ASCII : PLY_BINARY_NATIVE , NoComments.set ? noComments : comments , iXForm ) )
|
||||
fprintf( stderr , "[ERROR] Could not write mesh to: %s\n" , Out.value ) , exit( 0 );
|
||||
}
|
||||
|
||||
template< class Real , typename ... SampleData , unsigned int ... FEMSigs >
|
||||
|
||||
+2
-1
@@ -359,7 +359,8 @@ void ExtractMesh( UIntPack< FEMSigs ... > , std::tuple< SampleData ... > , FEMTr
|
||||
else profiler.dumpOutput2( comments , "# Got triangles:" );
|
||||
|
||||
std::vector< std::string > noComments;
|
||||
PlyWritePolygons< Vertex , Real , Dim >( Out.value , &mesh , ASCII.set ? PLY_ASCII : PLY_BINARY_NATIVE , NoComments.set ? noComments : comments , iXForm );
|
||||
if( !PlyWritePolygons< Vertex , Real , Dim >( Out.value , &mesh , ASCII.set ? PLY_ASCII : PLY_BINARY_NATIVE , NoComments.set ? noComments : comments , iXForm ) )
|
||||
fprintf( stderr , "[ERROR] Could not write mesh to: %s\n" , Out.value ) , exit( 0 );
|
||||
}
|
||||
|
||||
template< class Real , typename ... SampleData , unsigned int ... FEMSigs >
|
||||
|
||||
@@ -365,7 +365,9 @@ int Execute( void )
|
||||
char comment[1024];
|
||||
sprintf( comment , "#Trimmed In: %9.1f (s)" , Time()-t );
|
||||
comments.push_back( comment );
|
||||
if( Out.set ) PlyWritePolygons< Vertex >( Out.value , vertices , gtPolygons , Vertex::PlyWriteProperties() , Vertex::PlyWriteNum , ft , comments );
|
||||
if( Out.set )
|
||||
if( !PlyWritePolygons< Vertex >( Out.value , vertices , gtPolygons , Vertex::PlyWriteProperties() , Vertex::PlyWriteNum , ft , comments ) )
|
||||
fprintf( stderr , "[ERROR] Could not write mesh to: %s\n" , Out.value ) , exit( 0 );
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user