예제 #1
0
파일: main.cpp 프로젝트: MacedoRAC/LAIG
int main(int argc, char* argv[]) {

	Graph * pgraph = new Graph();

	char* filename = "flagTest.xml";
	if (argc >1)
		filename = argv[1];
	CGFapplication app = CGFapplication();
	Scene * scene = new Scene();
	try {
		app.init(&argc, argv);
		ANFScene n = ANFScene(filename,pgraph);
		printf("\n\n\n ja leu o ANF \n\n\n");
		scene->graph=pgraph;
		app.setScene(scene);
		app.setInterface(new GUI(scene->graph));
		
		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}

	return 0;
}
예제 #2
0
int main (int argc, char* argv[])
{


    if(!Communicator::getInstance().socketConnect())
    {
        cout << "Nao foi possivel estabelecer ligacao. O programa vai encerrar" << endl;
        return 1;
    }
    CGFapplication app = CGFapplication();
    XMLScene* xml = new XMLScene();
    try {
        app.init(&argc, argv);

        app.setScene(xml);
        app.setInterface(new GameInterface());
        app.run();
    }
    catch(GLexception& ex) {
        cout << "Erro: " << ex.what();
        return -1;
    }
    catch(exception& ex) {
        cout << "Erro inesperado: " << ex.what();
        return -1;
    }
    Communicator::getInstance().quit();
    getchar();
    return 0;

}
예제 #3
0
파일: main.cpp 프로젝트: tantch/CGRA-Proj
int main(int argc, char* argv[]) {


	CGFapplication app = CGFapplication();



	try {
		app.init(&argc, argv);
		LightingScene* tp = new LightingScene();
		app.setScene(tp);
		app.setInterface(new TPinterface(tp));


		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}

	return 0;
}
예제 #4
0
int main(int argc, char* argv[]) {
	
	CGFapplication* app = new CGFapplication();

	char buf[255];
	cin.clear();

	try {
		app->init(&argc, argv);

		YASFParser* parser = new YASFParser("../../YASF/", "scene3.yaf");
		parser->getScene()->setApp(app);
		app->setScene(parser->getScene());

		app->setInterface(new Interface(parser));

		app->run();
				
	} catch (GLexception& ex) {
		cout << "Error: " << ex.what();
		return -1;
	} catch (exception& ex) {
		printf("%s\n", ex.what());

		printf("Press any key to continue...");
		gets_s(buf);
		exit(1);
	}

	return 0;
}
예제 #5
0
파일: main.cpp 프로젝트: ferrolho/feup-cgra
int main(int argc, char* argv[]) {
	/* initialize random seed: */
	srand(time(NULL));

	CGFapplication app = CGFapplication();

	try {
		app.init(&argc, argv);

		app.setScene(new TPscene());
		app.setInterface(new CGFinterface());

		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}

	return 0;
}
예제 #6
0
파일: main.cpp 프로젝트: Inframan/LAIG
int main(int argc, char* argv[]) {

	sceneGraph graph;
	sceneGraph * pgraph = new sceneGraph();
	pgraph = &graph;
	char* filename = "myScene.anf";
	if (argc >1)
		filename = argv[1];
	CGFapplication app = CGFapplication();
	LightingScene * scene = new LightingScene();
	try {
		app.init(&argc, argv);
		XMLScene n = XMLScene(filename,pgraph);
		scene->setGraph(graph);
		app.setScene(scene);
	//	app.setInterface(new CGFinterface());
		app.setInterface(new TPinterface(pgraph));
		
		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}

	return 0;
}
예제 #7
0
int main(int argc, char* argv[]) {
    
	CGFapplication app = CGFapplication();
    
	try {
		app.init(&argc, argv);
        
        cout << "\n--> Loading .yaf file <--\n\n";
        
        Parser::YafParser* f = new Parser::YafParser();
        switch(f->loadYaf()){
            case Parser::file_not_found:
                cout << "File not found or ill formed xml.";
                break;
        }
        //cin.get();
        
        Graph* sceneGraph = f->getGraph();
        map<string, Appearance*> appearancesMap = f->getAppearances();
        map<string, Texture*> texturesMap = f->getTextures();
        map<string, Lighting*> lightningMap = f->getLights();
        map<string,Camera*> camerasMap = f->getCameras();
        map<string,Animation*> animationsMap = f->getAnimations();
        string initial = f->getInitial();
        
        Scene* newScene = new Scene();
        newScene->setGraph(sceneGraph);
        newScene->setAppearances(appearancesMap);
        newScene->setTextures(texturesMap);
        newScene->setLights(lightningMap);
        newScene->setCameras(camerasMap);
        newScene->setAnimations(animationsMap);
        newScene->setBackground(f->background);
        newScene->setDrawmode(f->drawmode);
        newScene->setShading(f->shading);
        newScene->setCullface(f->cullface);
        newScene->setCullorder(f->cullorder);
        newScene->setDoublesided(f->doublesided);
        newScene->setLocal(f->local);
        newScene->setEnabled(f->enabled);
        newScene->setAmbient(f->ambient);
        newScene->setInitial(initial);
        
		app.setScene(newScene);
		app.setInterface(new Interface());
		
		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}
    
	return 0;
}
예제 #8
0
int main(int argc, char* argv[]) {

	CGFapplication app = CGFapplication();
	atexit (_exit);
	try {
		
		app.init(&argc, argv);
		glutReshapeWindow(710,550);
		if(argc > 1)
			app.setScene(Scene = new ANFScene(argv[1]));
		else
			app.setScene(Scene = new ANFScene("room1.anf"));

		app.setInterface(new TPinterface(Scene));

		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}
	return 0;

}
예제 #9
0
int main(int argc, char* argv[]) {

	if(!TwixtSocket::socketConnect()){
		return 1;
	}

	XMLScene xmlscene=XMLScene("Classic/classic.yaf");
	LightingScene *ls=new LightingScene(xmlscene.getLights(), xmlscene.getGlobals(), xmlscene.getCameras(), xmlscene.getRootID(), xmlscene.getScene(), xmlscene.getAppearances(), xmlscene.getAnimations());
	ls->addthemes(new LightingScene(xmlscene.getLights(), xmlscene.getGlobals(), xmlscene.getCameras(), xmlscene.getRootID(), xmlscene.getScene(), xmlscene.getAppearances(), xmlscene.getAnimations()));
	XMLScene xmlscene_1=XMLScene("Mario/mario.yaf");
	ls->addthemes(new LightingScene(xmlscene_1.getLights(), xmlscene_1.getGlobals(), xmlscene_1.getCameras(), xmlscene_1.getRootID(), xmlscene_1.getScene(), xmlscene_1.getAppearances(), xmlscene_1.getAnimations()));
	XMLScene xmlscene_2=XMLScene("DragonBall/dragonball.yaf");
	ls->addthemes(new LightingScene(xmlscene_2.getLights(), xmlscene_2.getGlobals(), xmlscene_2.getCameras(), xmlscene_2.getRootID(), xmlscene_2.getScene(), xmlscene_2.getAppearances(), xmlscene_2.getAnimations()));
	XMLScene xmlscene_3=XMLScene("AngryBirds/angrybirds.yaf");
	ls->addthemes(new LightingScene(xmlscene_3.getLights(), xmlscene_3.getGlobals(), xmlscene_3.getCameras(), xmlscene_3.getRootID(), xmlscene_3.getScene(), xmlscene_3.getAppearances(), xmlscene_3.getAnimations()));

	CGFapplication app = CGFapplication();

	try {
		app.init(&argc, argv);

		app.setScene(ls);
		app.setInterface(new TPinterface());

		app.run();
	}
	catch(GLexception& ex) {
		cout << "Erro: " << ex.what();
		return -1;
	}
	catch(exception& ex) {
		cout << "Erro inesperado: " << ex.what();
		return -1;
	}
	TwixtSocket::quit();
	getchar();
	return 0;
}
예제 #10
0
파일: main.cpp 프로젝트: Wrakor/LAIG
int main(int argc, char* argv[]) {
	CGFapplication app = CGFapplication();

	Parser *parser;
	try
	{
		app.init(&argc, argv);
		/*if(argc<2 || argc>2)
			throw "Usage: thisProgram scene.yaf";
		Parser *parser = new Parser(argv[1]);*/
		parser = new Parser("cenas/pentago/ambiente1.yaf");
		try {
			app.setScene(&parser->scene);
			app.setInterface(&parser->interface);
//			s = parser->scene.socket;
//			app.setInterface(&parser->start_interface);
			app.run();
			
		}
		catch(GLexception& ex) {
			throw "Error: " + *ex.what();
		}
		catch(exception& ex) {
			throw "Unexpected error: " + *ex.what();
		}
		
	}
	catch (const char* msg) { //parse exception
		if (msg != "exit")
			cout << "EXCEPTION: " << msg << endl;
	}

	delete(parser);

	return 0;
}
예제 #11
0
파일: main.cpp 프로젝트: RGeneral24/LAIG_TP
int main(int argc, char* argv[]) {

	CGFapplication app = CGFapplication();
	if(!PrologSocket::socketConnect())
	{
		return 1;
	}

	try {
		app.init(&argc, argv);
		app.setScene(new DemoScene("scene1.anf"));
		app.setInterface(new CGFinterface());
		app.setInterface(new SceneInterface());
		app.run();
	}
	catch(ErrorANF& ex){
		cout << ex.getError() << endl << "EXITING!!!" << endl;
		cin.get();
		PrologSocket::Quit();
		return -1;
	}
	catch(OutOfBoundsError& ex){
		cout << ex.getError() << endl << "EXITING!!!" << endl;
		cin.get();
		PrologSocket::Quit();
		return -1;
	}
	catch(GLexception& ex) {
		cout << "Error: " << ex.what();
		PrologSocket::Quit();
		return -1;
	}
	catch(exception& ex) {
		cout << "Unexpected error: " << ex.what();
		PrologSocket::Quit();
		return -1;
	}
	PrologSocket::Quit();
	return 0;
}