Example #1
0
int  Data_Load(){
    char **strbox=new char* [4];
    for(int i=0;i<box_variey_num;i++)
	strbox[i]=new char [32];

    strcpy(strbox[0],"Data/Model/box.mqo");
    strcpy(strbox[1],"Data/Model/bluebox.mqo");
    strcpy(strbox[2],"Data/Model/redbox.mqo");
    strcpy(strbox[3],"Data/Model/purplebox.mqo");

    for(int i=0;i<box_variey_num;i++){
	Box[i]=mqoCreateModel(strbox[i],0.05);
	if(Box[i]==NULL){
	    printf("box=%s is not found\n",strbox[i]);
	    return -1;
	}
    }
    WallModel=mqoCreateModel(wall_name,0.5);
    if(WallModel==NULL){
	puts("WallModel is not found");
	return -1;
    }

    font =new FTGLPolygonFont(FONT);
    if(font->Error())exit(1);
    if(!font->FaceSize(FONT_SIZE))exit(1);
    if(!font->CharMap(ft_encoding_unicode))exit(1);


    for(int i=0;i<box_variey_num;i++)
	delete [] strbox[i];
    delete [] strbox;

    return 0;
}
//=======================================================
// 初期化関数
//=======================================================
void Init(void)
{
	ARParam wparam;		// カメラパラメータ

	// ビデオデバイスの設定
	if( arVideoOpen( vconf_name ) < 0 ){
		printf("ビデオデバイスのエラー\n");
		exit(0);
	}

	// ウィンドウサイズの取得
	if( arVideoInqSize( &xsize, &ysize ) < 0 ) exit(0);
	printf("Image size (x,y) = (%d,$d)\n", xsize, ysize);

	// カメラパラメータの設定
	if( arParamLoad( cparam_name, 1, &wparam ) < 0 ){
		printf("カメラパラメータの読み込みに失敗しました\n");
		exit(0);
	}

	// カメラパラメータのサイズ調整
	arParamChangeSize( &wparam, xsize, ysize, &cparam );
	// カメラパラメータの初期化
	arInitCparam( &cparam );
	printf("*** Camera Parameter ***\n");
	arParamDisp( &cparam );

	// パターンファイルのロード
	for( int i=0; i<MARK_NUM; i++ ){
		if( (marker[i].patt_id = arLoadPatt(marker[i].patt_name)) < 0){
			printf("パターンファイルの読み込みに失敗しました\n");
			printf("%s\n", marker[i].patt_name);
			exit(0);
		}
	}

	// gsubライブラリの初期化
	argInit( &cparam, 1.0, 0, 0, 0, 0 );

	mqoInit(); //メタセコイアの初期化

	// モデルの読み込み

	for(int i=0;i<8;i++){
		if ( (model[i] = mqoCreateModel( mqo_name[i], 1.0 )) == NULL ) {
				printf("モデルの読み込みに失敗しました\n");
			//	return -1;
		}
	}
	if ( (rmodel = mqoCreateModel( mqo_rnm, 1.0 )) == NULL ) {
		printf("モデルの読み込みに失敗しました\n");
		//	return -1;
	}


	// ウィンドウタイトルの設定
	glutSetWindowTitle("PaperPiano");
}
Example #3
0
void Init(){
	glClearColor(0.3, 0.3, 0.3, 1.0);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	mqoInit();
	model = mqoCreateModel("mikumikoto.mqo", 2.0);
}
Example #4
0
// main関数
int main(int argc, char *argv[])
{
	capture = cvCreateCameraCapture( -1 );
	frameImage = cvQueryFrame( capture ); // カメラ画像の取得

	Mat frame(frameImage);

	// 初期設定 
	pDetector = new Detector( frame.cols, frame.rows, 500.0);
	pDrum = new Drum();



	// 初期化
	glutInit(&argc,argv);										// OpenGL初期化
	glutInitWindowPosition(100, 50);							// ウィンドウの表示位置
	glutInitWindowSize(640, 480);								// ウィンドウのサイズ
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);	// ディスプレイ設定
	glutCreateWindow("MQO Loader for OpenGL");					// ウィンドウの生成

	// モデルを表示させる準備
	mqoInit();											// GLMetaseqの初期化
	// モデルのロード
	drumL2Model.mqo = mqoCreateModel("drum.mqo",1.0);
	drumL1Model.mqo = mqoCreateModel("drum.mqo",1.0);
	drumR1Model.mqo = mqoCreateModel("drum.mqo",1.0);
	drumR2Model.mqo = mqoCreateModel("drum.mqo",1.0);
	drumActModel.mqo = mqoCreateModel("drumAct.mqo",1.0);
	cymbalLModel.mqo = mqoCreateModel("cymbal.mqo",1.0);
	cymbalRModel.mqo = mqoCreateModel("cymbal.mqo",1.0);	
	cymbalActModel.mqo = mqoCreateModel("cymbalAct.mqo",1.0);	

	// 終了処理関数の設定
	atexit(Quit);

	// コールバック関数の設定
	glutDisplayFunc(Draw);			// 描画処理関数の設定
	glutIdleFunc(Draw);				// アイドル時の処理関数の設定
	glutReshapeFunc(Reshape);		// ウィンドウ変形時の処理を行う関数の設定
	glutKeyboardFunc(Keyboard);		// キー入力時の処理関数の設定

	// イベント待ちの無限ループに入る
	glutMainLoop();

    // OpenCV後片付け
    cvReleaseCapture( &capture );

	return 0;
}
Example #5
0
void MqoObject::initModel()
{
	mqoModel=mqoCreateModel(mqoFileName, scale);
}