Commit ba94ec26 authored by Martin Mirbauer's avatar Martin Mirbauer
Browse files

absolute number of output faces (rather than fraction)

parent 8437d848
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@ RUN apt-get update

RUN apt-get install -y --no-install-recommends git make g++ ca-certificates

RUN git clone --recursive -j8 https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification FQMS
#RUN git clone https://cgg.mff.cuni.cz/gitlab/i3d/fast-quadric-mesh-simplification FQMS

ADD . /FQMS
WORKDIR /FQMS/src.cmd
RUN g++ Main.cpp -O3 -o simplify

+4 −10
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@

void showHelp(const char * argv[]) {
    const char *cstr = (argv[0]);
    printf("Usage: %s <input> <output> <ratio> <agressiveness)\n", cstr);
    printf("Usage: %s <input> <output> <target_count> <agressiveness)\n", cstr);
    printf(" Input: name of existing OBJ format mesh\n");
    printf(" Output: name for decimated OBJ format mesh\n");
    printf(" Ratio: (default = 0.5) for example 0.2 will decimate 80%% of triangles\n");
    printf(" Target count: (default = 1024, or the input triangle count, whichever is less) desired number of triangles\n");
    printf(" Agressiveness: (default = 7.0) faster or better decimation\n");
    printf("Examples :\n");
#if defined(_WIN64) || defined(_WIN32)
@@ -43,15 +43,9 @@ int main(int argc, const char * argv[]) {
	Simplify::load_obj(argv[1]);
	if ((Simplify::triangles.size() < 3) || (Simplify::vertices.size() < 3))
		return EXIT_FAILURE;
	int target_count =  Simplify::triangles.size() >> 1;
	int target_count = min(Simplify::triangles.size(), 1024);
    if (argc > 3) {
    	float reduceFraction = atof(argv[3]);
    	if (reduceFraction > 1.0) reduceFraction = 1.0; //lossless only
    	if (reduceFraction <= 0.0) {
    		printf("Ratio must be BETWEEN zero and one.\n");
    		return EXIT_FAILURE;
    	}
    	target_count = round((float)Simplify::triangles.size() * atof(argv[3]));
    	target_count = atoi(argv[3]);
    }
    if (target_count < 4) {
		printf("Object will not survive such extreme decimation\n");