main.cpp 1.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*! \package brdf2brdf
 *  \ingroup commands
 *  \brief
 *  This command exports a \ref function object to software specific file.
 *  \details
 *  <h3>Parameters</h3>
 *  <ul>
 *		<li><b>\-\-input <i>filename</i></b> ALTA function file to be loaded.
 *		</li>
 *  </ul>
 */
Laurent Belcour's avatar
Laurent Belcour committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <core/args.h>
#include <core/function.h>
#include <core/plugins_manager.h>

#include <iostream>
#include <vector>
#include <iostream>
#include <fstream>
#include <limits>
#include <cstdlib>

int main(int argc, char** argv)
{
	arguments args(argc, argv) ;
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
	
	if(args.is_defined("help")) {
		std::cout << "Usage: brdf2brdf [options] --input data.file --output data.file" << std::endl ;
		std::cout << "Re-export a function object to another output format."<< std::endl ;
		std::cout << std::endl;
		std::cout << "Mandatory arguments:" << std::endl;
		std::cout << "  --input    [filename]" << std::endl;
		std::cout << "  --output   [filename]" << std::endl;
		std::cout << std::endl;
		std::cout << "Optional arguments:" << std::endl;
		std::cout << "  --export   [type]      Name of the export format used to save the outputed" << std::endl ;
		std::cout << "                         function file. Available types are: alta, matlab," << std::endl ;
		std::cout << "                         explorer or shader." << std::endl ;
		return 0 ;
	}
Laurent Belcour's avatar
Laurent Belcour committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

	if(! args.is_defined("input")) {
		std::cerr << "<<ERROR>> the input filename is not defined" << std::endl ;
		return 1 ;
	}
	if(! args.is_defined("output")) {
		std::cerr << "<<ERROR>> the output filename is not defined" << std::endl ;
		return 1 ;
	}

    // Load the function
    function* f = plugins_manager::get_function(args["input"]);

    // Save it
    f->save(args["output"], args) ;

	return 0 ;
}