#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int gProgress = -1;
bool onProgress( float v )
{
int progress = (int)( 10.f * v );
if ( progress != gProgress )
{
gProgress = progress;
printf( "%d%%...\n", progress * 10 );
}
return true;
}
int main(
int argc,
char* argv[] )
{
int rc = EXIT_FAILURE;
if ( argc != 5 )
{
fprintf( stderr, "Usage: %s { unite | intersect } INPUT1 INPUT2 OUTPUT", argv[0] );
goto out;
}
if ( strcmp( argv[1], "unite" ) == 0 )
else if ( strcmp( argv[1], "intersect" ) == 0 )
else
{
fprintf( stderr, "Incorrect operation: %s", argv[1] );
goto out;
}
const char* input1 = argv[2];
const char* input2 = argv[3];
const char* output = argv[4];
if ( errorString )
{
fprintf( stderr,
"Failed to load mesh 1: %s",
mrStringData( errorString ) );
goto out;
}
if ( errorString )
{
fprintf( stderr,
"Failed to load mesh 2: %s",
mrStringData( errorString ) );
goto out_mesh1;
}
{
goto out_mesh2;
}
if ( errorString )
{
fprintf( stderr,
"Failed to save result: %s",
mrStringData( errorString ) );
goto out_result;
}
rc = EXIT_SUCCESS;
out_result:
out_mesh2:
out_mesh1:
out:
return rc;
}
MRBooleanOperation
Available CSG operations.
Definition MRMeshC/MRBooleanOperation.h:10
@ MRBooleanOperationUnion
Union surface of two meshes (outside parts)
Definition MRMeshC/MRBooleanOperation.h:20
@ MRBooleanOperationIntersection
Intersection surface of two meshes (inside parts)
Definition MRMeshC/MRBooleanOperation.h:22
MRMESHC_API MRBooleanParameters mrBooleanParametersNew(void)
initializes a default instance
MRMESHC_API MRBooleanResult mrBoolean(const MRMesh *meshA, const MRMesh *meshB, MRBooleanOperation operation, const MRBooleanParameters *params)
struct MRMesh MRMesh
Definition MRMeshC/MRMeshFwd.h:43
typedefMR_EXTERN_C_BEGIN struct MRString MRString
Definition MRMeshC/MRMeshFwd.h:32
MRMESHC_API void mrMeshFree(MRMesh *mesh)
deallocates a Mesh object
MRMESHC_API void mrStringFree(MRString *str)
deallocates the string object
MR_EXTERN_C_BEGIN MRMESHC_API const char * mrStringData(const MRString *str)
gets read-only access to the string data
MRMESHC_API MRMesh * mrMeshLoadFromAnySupportedFormat(const char *file, MRString **errorStr)
MRMESHC_API void mrMeshSaveToAnySupportedFormat(const MRMesh *mesh, const char *file, MRString **errorStr)
optional parameters for mrBoolean
Definition MRMeshC/MRMeshBoolean.h:11
MRProgressCallback cb
Progress callback.
Definition MRMeshC/MRMeshBoolean.h:23
This structure store result mesh of mrBoolean or some error info.
Definition MRMeshC/MRMeshBoolean.h:31
MRString * errorString
Holds error message, empty if boolean succeed.
Definition MRMeshC/MRMeshBoolean.h:37
MRMesh * mesh
Result mesh of boolean operation, if error occurred it would be empty.
Definition MRMeshC/MRMeshBoolean.h:33