Add option for using different models
This commit is contained in:
parent
4770c96d92
commit
25f97e5f90
|
@ -10,6 +10,7 @@ const char* argp_program_version =
|
|||
const struct argp_option options[] = {
|
||||
//name, key, arg, flags, doc, group
|
||||
{"haar-cascade", 0x00, 0, 0, "Use Haar Cascades for faster (but less accurate) face detection.", 0},
|
||||
{"model", 'm', "model", 0, "Name of the model file to use. (not including '.fma')", 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -21,7 +22,8 @@ struct argp argp = {
|
|||
};
|
||||
|
||||
struct optData optData = {
|
||||
false
|
||||
false,
|
||||
"test",
|
||||
};
|
||||
|
||||
error_t parseOptions(int key, char* arg, struct argp_state* state) {
|
||||
|
@ -30,6 +32,10 @@ error_t parseOptions(int key, char* arg, struct argp_state* state) {
|
|||
optData.useHaar = true;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
optData.model = std::string(arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
return ARGP_ERR_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#ifndef ARGS_HPP
|
||||
#define ARGS_HPP
|
||||
|
||||
#include <string>
|
||||
#include <argp.h>
|
||||
|
||||
error_t parseOptions(int key, char* arg, struct argp_state* state);
|
||||
|
||||
struct optData {
|
||||
bool useHaar; //use haar cascades (0x00)
|
||||
std::string model; //model to open (0x6d "m")
|
||||
};
|
||||
|
||||
extern const char* argp_program_version;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <paths.hpp>
|
||||
#include <config.hpp>
|
||||
#include <cv.hpp>
|
||||
#include <args.hpp>
|
||||
|
||||
GLuint shader; //standard shader program used for all elements
|
||||
GLuint transUniform; //location of the "transMatrix" transformation matrix uniform in the shader
|
||||
|
@ -82,7 +83,7 @@ void initGraphics () {
|
|||
|
||||
initShader();
|
||||
|
||||
model = new Model(resolvePath("models/test.fma").c_str());
|
||||
model = new Model(resolvePath(("models/"+optData.model+".fma").c_str()).c_str());
|
||||
|
||||
//enable blending for alpha textures
|
||||
glEnable(GL_BLEND);
|
||||
|
|
Loading…
Reference in a new issue