コード例 #1
0
ファイル: affichage.cpp プロジェクト: g-truc/shooter
// Affichage d'insformations utiles pendant le jeu pour une partie à un seul joueur : Nom, score, FPS, numéro du niveau.
void CAffichage::HUDJeu (unsigned int uiNiveau, unsigned int uiJoueur1, const char* szJoueur1)
{
	Fps ();

	m_Font.SetCouleur(glm::vec3(0.0f, 1.0f, 0.0f));
	m_Font.Print (FONT_POSITION_CENTRE_HAUT, "Niveau %d", uiNiveau + 1);
	m_Font.SetCouleur(glm::vec3(0.5f, 0.5f, 1.0f));
	m_Font.Print (0, FENETRE_HAUTEUR - 16, "%s", szJoueur1);
	m_Font.Print (0, FENETRE_HAUTEUR - 32, "%d", uiJoueur1);
}
コード例 #2
0
ファイル: window.cpp プロジェクト: plainoldcj/raytracing
void Window::Render(void) {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	_renderer.Render();
	_renderer.RenderOverlay();

	glBindTexture(GL_TEXTURE_2D, 0);
	SYS::Relocate(10, Height() - 20);
	SYS::Print("Fps: %d", Fps());
}
コード例 #3
0
ファイル: affichage.cpp プロジェクト: g-truc/shooter
// Affichage de la victoire d'une partie pour un joueur
void CAffichage::HUDVictoire (unsigned int uiJoueur1, const char* szJoueur1)
{
	Fps ();

	m_Font.SetCouleur(glm::vec3(1.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 + 32, "VICTOIRE !");
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 - 0, "Vous avez vaincu les forces de l'ignoble Zglu");
	m_Font.SetCouleur(glm::vec3(0.0f, 1.0f, 0.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 - 48, "%s : %d points", szJoueur1, uiJoueur1);
	m_Font.SetCouleur(glm::vec3(1.0f, 1.0f, 1.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 - 96, "Appuyer sur 'echap' pour retourner au menu");	
}
コード例 #4
0
ファイル: affichage.cpp プロジェクト: g-truc/shooter
// Affichage de l'échec d'une partie pour un joueur
void CAffichage::HUDDefaite (unsigned int uiJoueur1, const char* szJoueur1)
{
	Fps ();

	m_Font.SetCouleur(glm::vec3(1.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 + 32, "DEFAITE ...");
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 - 0, "Les forces de l'ignoble Zglu vous ont vaincu");
	m_Font.SetCouleur(glm::vec3(0.0f, 1.0f, 0.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 - 48, "%s : %d points", szJoueur1, uiJoueur1);
	m_Font.SetCouleur(glm::vec3(1.0f, 1.0f, 1.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2 - 96, "Appuyer sur 'echap' pour retourner au menu");	
}
コード例 #5
0
ファイル: crop.cpp プロジェクト: ethz-asl/iclcv
void init(){
  grabber.init(pa("-i"));

  bool c_arg = pa("-c");

  gui << Draw().handle("draw").label("input image")
      << Image().handle("cropped").label("cropped")
      << ( VBox().maxSize(c_arg ? 0 : 12,99).minSize(c_arg ? 0 : 12,1)
           << Button("save as ..").handle("saveAs")
           << Button("overwrite input").handle("overwrite")
           << Combo("0,90,180,270").handle("rot").label("rotation")
           << CheckBox("rectangular",!pa("-r")).handle("rect")
           << Button("Batch crop...").handle("batch")
           << ( HBox().label("rectification size")
                << Spinner(1,4096,640).handle("s1")
                << Label(":")
                << Spinner(1,4096,480).handle("s2")
                )
           << (HBox() 
               << Fps().handle("fps")
               << CamCfg()
               )
           )
      << Show();


  if(!c_arg){
    gui["batch"].registerCallback(batch_crop);
  }
  const ImgBase *image = grabber.grab();
  if(!c_arg){
    mouse_1 = new Mouse1(image->getSize());
    gui["draw"].install(mouse_1);
  }
  mouse_2 = new Mouse2(image->getSize());
  gui["draw"].install(mouse_2);
  
  DrawHandle draw = gui["draw"];
  draw->setImageInfoIndicatorEnabled(false);
  
  if(!c_arg){
    gui["rect"].registerCallback(rectangular_changed);
    rectangular_changed();
    if(*pa("-i",0) != "file" || FileList(*pa("-i",1)).size() != 1){
      gui["overwrite"].disable();
    }else{
      gui["overwrite"].registerCallback(overwrite);
    }
    gui["saveAs"].registerCallback(save_as);
  }

}
コード例 #6
0
ファイル: affichage.cpp プロジェクト: g-truc/shooter
// Affichage du HUD lors de la fin d'un niveau pour une partie à un joueur.
void CAffichage::HUDFinNiveau (unsigned int uiNiveau, unsigned int uiJoueur1, const char* szJoueur1)
{
	Fps ();

	m_Font.SetCouleur(glm::vec3(0.0f, 1.0f, 0.0f));
	m_Font.Print (FONT_POSITION_CENTRE_HAUT, "Niveau %d", uiNiveau + 1);
	m_Font.SetCouleur(glm::vec3(0.5f, 0.5f, 1.0f));
	m_Font.Print (0, FENETRE_HAUTEUR - 16, "%s", szJoueur1);
	m_Font.Print (0, FENETRE_HAUTEUR - 32, "%d", uiJoueur1);

	m_Font.SetCouleur(glm::vec3(0.0f, 1.0f, 0.0f));
	m_Font.Print (FONT_POSITION_CENTRE, FENETRE_HAUTEUR / 2, "Appuyez sur 'entree' pour passer au niveau %d", uiNiveau + 2);
}
コード例 #7
0
ファイル: viewer.cpp プロジェクト: ethz-asl/iclcv
void init(){
  gui << Image().handle("image").minSize(16,12);
  gui << ( HBox().maxSize(100,2)
           << Fps(10).handle("fps").maxSize(100,2).minSize(5,2)
           << CamCfg("")
           )
      << Show();

  grabber.init(pa("-i"));
  if(pa("-size")){
    grabber.useDesired<Size>(pa("-size"));
  }

}
コード例 #8
0
ファイル: local-thresh.cpp プロジェクト: ethz-asl/iclcv
void init(){
  int masksize = 10;
  int thresh = 2;
  float gamma = 0;
  if(pa("-config")){
    ConfigFile f(*pa("-config"));
    masksize = f["config.masksize"];
    thresh = f["config.threshold"];
    gamma = f["config.gammaslope"];
  }

  gui << Draw().minSize(16,12).handle("orig").label("original image")
      << Image().minSize(16,12).handle("prev").label("preview image")
      << ( VBox().label("controls")
           << Slider(2,200,masksize).label("mask size").out("masksize").minSize(15,2).handle("a")
           << FSlider(-30,40,thresh).label("threshold").out("threshold").minSize(15,2).handle("b")
           << FSlider(0,15,gamma).label("gamma slope").out("gamma").minSize(15,2).handle("c")
           << Button("next image").handle("next")
           << Button("stopped","running").out("loop").handle("d")
           << Button("no clip","clip to roi").out("clipToROI").handle("e")
           << Button("save params").handle("save")
           << Combo("region mean,tiledNN,tiledLIN").handle("algorithm").label("algorithm")
           << ( HBox()
                << Label("..ms").handle("time").label("apply time").minSize(2,3)
                << Fps(10).handle("fps").minSize(4,3).label("fps")
                )
           )
      << Show();
  
  grabber.init(pa("-i"));
  if(grabber.getType() != "file"){
    grabber.useDesired<Size>(pa("-s"));
    if(!pa("-color")){
      grabber.useDesired(formatGray);
    }else{
      grabber.useDesired(formatRGB);
    }
    grabber.useDesired(depth8u);
  }
  
  gui.registerCallback(step,"a,b,c,d,e,next,algorithm");
  gui["orig"].install(new MouseHandler(mouse));
  
  step();
}
コード例 #9
0
ファイル: affichage.cpp プロジェクト: g-truc/shooter
// Affichage d'insformations utiles pendant le jeu pour une partie à deux joueurs : Noms, scores, FPS, numéro du niveau.
void CAffichage::HUDJeu (unsigned int uiNiveau, unsigned int uiJoueur1, const char* szJoueur1, unsigned int uiJoueur2, const char* szJoueur2)
{
	int iChiffres = 2;
	int iScore = uiJoueur2;
	while (iScore /= 10)
		iChiffres++;

	Fps ();

	m_Font.SetCouleur(glm::vec3(0.0f, 1.0f, 0.0f));
	m_Font.Print (FONT_POSITION_CENTRE_HAUT, "Niveau %d - Scores : %d", uiNiveau + 1, uiJoueur1 + uiJoueur2);
	m_Font.SetCouleur(glm::vec3(0.5f, 0.5f, 1.0f));
	m_Font.Print (0, FENETRE_HAUTEUR - 16, "%s", szJoueur1);
	m_Font.Print (0, FENETRE_HAUTEUR - 32, "%d", uiJoueur1);
	m_Font.SetCouleur(glm::vec3(1.0f, 0.5f, 0.5f));
	m_Font.Print (FENETRE_LARGEUR - 12 * (strlen (szJoueur2) + 1), FENETRE_HAUTEUR - 16, "%s", szJoueur2);
	m_Font.Print (FENETRE_LARGEUR - 12 * iChiffres, FENETRE_HAUTEUR - 32, "%d", uiJoueur2);
}
コード例 #10
0
void init() {

	grabber.init(pa("-i"));

	if (pa("-s")) {
		utils::Size size = pa("-s");
		grabber.setDesiredSizeInternal(size);
	}

    // create the GUI
	gui << ( VBox()
			 << ( HBox()
				  << Draw().label("Original").handle("view1").minSize(16, 12)
				  << Draw().label("Median").handle("view2").minSize(16, 12)
				  << Draw().label("Bilateral Filtered").handle("view3").minSize(16, 12)
				  )
			 << ( HBox()
				  << Draw().label("Original").handle("viewedge1").minSize(16, 12)
				  << Draw().label("Median").handle("viewedge2").minSize(16, 12)
				  << Draw().label("Bilateral Filtered").handle("viewedge3").minSize(16, 12)
				  )
			 << CheckBox("Use LAB",true).handle("use_lab")
			 << CheckBox("Use gray image",false).handle("to_gray")
			 << Slider(1,24,4).label("Bilateral Kernel Radius").handle("bi_radius")
			 << Slider(1,24,4).label("Median Kernel Radius").handle("median_radius")
			 << FSlider(0.1,200,5).label("sigma_r (bilateral) ").handle("sigma_r")
			 << FSlider(0.1,200,5).label("sigma_s (bilateral) ").handle("sigma_s")
			 << Slider(0,255,200).label("Canny low th").handle("canny_low_th")
			 << Slider(0,255,255).label("Canny high th").handle("canny_high_th")
			 << Slider(10,100,100).label("ROI of Img (Percent)").handle("roi_size")
			 << Fps().handle("fps")
			 );
    gui << Show();

	bi_filter = new BilateralFilterOp();

}
コード例 #11
0
ファイル: treeTest.cpp プロジェクト: Rodot-/SpaceGameThing
int main(int argc, char* argv[]) {

	sf::RenderWindow window(sf::VideoMode(WIDTH, HEIGHT), "SpaceGameThing");
	sf::Clock clock;
	sf::Clock physClock;

	float dt;

	HeavenlyBody* planet = new HeavenlyBody(0.25, 25000, QUIET);
	planet->Load("../bin/planet.png");
	planet->SetPosition(WIDTH/2, 95);
	planet->SetCollidable(true);
	//planet->SetOrigin(95,95);
	planet->SetColor(sf::Color(255, 0, 0, 255));
	HitBoxBase<std::pair<sf::Vector2f, float> > hbox(std::pair<sf::Vector2f, float>(sf::Vector2f(95, 95), planet->GetRadius()));
	planet->SetHitBox((void*)(&hbox), collision::RADIAL);

	HeavenlyBody* planet2 = new HeavenlyBody(2.0, 200000, QUIET);
	planet2->Load("../bin/planet.png");
	planet2->SetPosition(WIDTH/2, HEIGHT+90);
	planet2->SetCollidable(true);
	//planet2->SetOrigin(95,95);
	planet2->SetColor(sf::Color(255, 0, 0, 255));
	HitBoxBase<std::pair<sf::Vector2f, float> > hbox2(std::pair<sf::Vector2f, float>(sf::Vector2f(95, 95), planet2->GetRadius()));
	planet2->SetHitBox((void*)(&hbox2), collision::RADIAL);


	HeavenlyBody* planet3 = new HeavenlyBody(0.5, 20000, QUIET);
	planet3->Load("../bin/planet.png");
	planet3->SetPosition(WIDTH/4, 90);
	planet3->SetCollidable(true);
	//planet3->SetOrigin(95,95);
	planet3->SetColor(sf::Color(255, 0, 0, 255));
	HitBoxBase<std::pair<sf::Vector2f, float> > hbox3(std::pair<sf::Vector2f, float>(sf::Vector2f(95, 95), planet3->GetRadius()));
	planet3->SetHitBox((void*)(&hbox3), collision::RADIAL);



	//test a compound asset
	CompoundAsset* cst = new CompoundAsset();
	cst->Load("../bin/scripts/assets/test.ass");
	cst->SetOrigin(256, 256);
	cst->SetPosition(WIDTH/2, HEIGHT/2);
	cst->setMass(100000.0);
	cst->SetScale(0.25, 0.25);

	AssetManager manager;
	PhysicsManager physManager;
	
	manager.Add("planet", planet);
	manager.Add("planet2", planet2);
	manager.Add("planet3", planet3);
	manager.Add("cst", cst);
	//manager.Add("redPlanet", surface);
	physManager.Add(cst);
	physManager.Add(planet);
	physManager.Add(planet2);
	physManager.Add(planet3);
	physManager.InitPhysVec();

	QuadTree QT(-3/2*WIDTH, 0, 3*WIDTH, HEIGHT); 
	//QT.AddGeometry(*surface);

	WorldGeometry* Geoms[30];
	std::string name = "surface";
	std::string index;
	std::string fin;
	std::stringstream num (std::stringstream::in | std::stringstream::out);
	for (int i = 0; i < 30; ++i) {
		Geoms[i] = new WorldGeometry();
		Geoms[i]->Load("../bin/planet.png");
		Geoms[i]->SetPosition(192*(i-15), HEIGHT - 190);
		Geoms[i]->SetCollidable(true);
		Geoms[i]->SetOrigin(95,95);
		QT.AddGeometry(*Geoms[i]);
		num << i;
		index = num.str();
		num.str("");
		fin = name + index;
		manager.Add(fin, Geoms[i]);
	}
	/*
	WorldGeometry* surface = new WorldGeometry();
	surface->Load("../bin/planet.png");
	surface->SetPosition(0, HEIGHT-190);
	surface->SetCollidable(true);
	surface->SetOrigin(95,95);
	*/



	planet->setVx(-180);
	planet->setVy(-40.0);
	planet2->setVx(50);
	int nFrames = 0;
	sf::Clock fClock;
	sf::Font font; //make a frame counter in a class later
	font.loadFromFile("../bin/DroidSans.tff");
	sf::Text Fps("0", font, 14);
	std::stringstream ss (std::stringstream::in | std::stringstream::out);

	std::set<WorldGeometry*> geoms;
	std::set<WorldGeometry*>::iterator geom;
	std::vector<HeavenlyBody*> bodies;
	bodies.push_back(planet);
	bodies.push_back(planet2);
	bodies.push_back(planet3);
	while (window.isOpen()) {
	
		sf::Event event;
		while (window.pollEvent(event)) {
			//player1->Interact(event); //shouldn't do this here
			if (event.type == sf::Event::Closed)
				window.close();
		}
		physManager.UpdatePhysics(physClock.restart().asSeconds());
	
		//quadTree experimentation
	
		for (int b = 0; b < 3; ++b) {	
			HeavenlyBody* plnt = bodies[b];
			for (int d = 0; d < 3; ++d) {
				if (d != b) {
					HeavenlyBody* other = bodies[d];
					//if (HaveCollided(plnt, other)) {
					if (plnt->HasCollided(other)) {

						printf("Collision Detected\n");
						//first, set up the change in radial velocity
						sf::Vector2f r = other->GetPosition() - plnt->GetPosition();
						float R = hypotf(r.x,r.y);
						sf::Vector2f sxy = other->GetPosition();
						sf::Vector2f pxy = plnt->GetPosition();
						sf::Vector2f v = (plnt->GetVelocity()*plnt->getMass() - other->GetVelocity()*other->getMass()); // dealta v (this is a diffrence of v)
						sf::Vector2f v2 = other->GetVelocity()*other->getMass(); // dealta v (this is a diffrence of v)
						sf::Vector2f v1 = plnt->GetVelocity()*plnt->getMass(); // dealta v (this is a diffrence of v)
						float damping = 0.85; //damping factor	
						sf::Vector2f frict = v;
						v1 -= r*(2.0f*(v.x*r.x+v.y*r.y)/(R*R)*damping);
						v2 += r*(2.0f*(v.x*r.x+v.y*r.y)/(R*R)*damping);
						//next, set up the change in tangential velocity

						v1 -= r*((frict.x*r.y-frict.y*r.x)/(R*R)*(1-damping)); //not real friction, 
						v2 += r*((frict.x*r.y-frict.y*r.x)/(R*R)*(1-damping)); //not real friction, 
						//but something at least, this can be fixed later

						//lastly, set up the change in angular momentum

						float omega, omega2;
						//sf::Vector2f delV = r*((frict.x*r.y-frict.y*r.x)/(R*R)*(1-damping)); //not real friction, 
						sf::Vector2f delV = frict*(1-damping); //not real friction, 
						omega = (1-damping)*(delV.x*r.x+delV.y*r.y/(R*R));//*plnt->getMass()/plnt->getI();
						omega2 = -(1-damping)*(delV.x*r.x+delV.y*r.y/(R*R));//*plnt->getMass()/plnt->getI();

						//then set the physics
						//plnt->setVx(v1.x/plnt->getMass());
						//plnt->setVy(v1.y/plnt->getMass());
						//plnt->setOmega(omega);
						plnt->setX(sxy.x-(95*other->GetRadius()+95*plnt->GetRadius())*(r.x)/R);
						plnt->setY(sxy.y-(95*other->GetRadius()+95*plnt->GetRadius())*(r.y)/R);
		
						//other->setVx(v2.x/other->getMass());
						//other->setVy(v2.y/other->getMass());
						//other->setOmega(omega2);
						//other->setX(pxy.x+(95*plnt->GetRadius()+95*other->GetRadius())*(r.x)/R);
						//other->setY(pxy.y+(95*plnt->GetRadius()+95*other->GetRadius())*(r.y)/R);

					}
				}
			}
			geoms = QT.GetContents(plnt->GetGlobalBounds());
			if (geoms.size() != 0) {
				for (geom = geoms.begin(); geom != geoms.end(); ++geom) {
					WorldGeometry* surface = *geom; //get out collider
					sf::Vector2f r = surface->GetPosition() - plnt->GetPosition(); //dealta r
					float R = hypotf(r.x,r.y);
					if (R < 95+plnt->GetRadius()*95.0) {

						//first, set up the change in radial velocity
						sf::Vector2f sxy = surface->GetPosition();
						sf::Vector2f v = plnt->GetVelocity(); // dealta v (this is a diffrence of v)
						float damping = 0.85; //damping factor	
						sf::Vector2f frict = v;
						v -= r*(2.0f*(v.x*r.x+v.y*r.y)/(R*R)*damping);
						//next, set up the change in tangential velocity

						v -= r*((frict.x*r.y-frict.y*r.x)/(R*R)*(1-damping)); //not real friction, 
						//but something at least, this can be fixed later

						//lastly, set up the change in angular momentum

						float omega;
						//sf::Vector2f delV = r*((frict.x*r.y-frict.y*r.x)/(R*R)*(1-damping)); //not real friction, 
						sf::Vector2f delV = frict*(1-damping); //not real friction, 
						omega = (1-damping)*(delV.x*r.x+delV.y*r.y/(R*R));//*plnt->getMass()/plnt->getI();

						//then set the physics
						plnt->setVx(v.x);
						plnt->setVy(v.y);
						plnt->setOmega(omega);
						plnt->setX(sxy.x-(95+95*plnt->GetRadius())*(r.x)/R);
						plnt->setY(sxy.y-(95+95*plnt->GetRadius())*(r.y)/R);
					}
				}
			}
		}
	
		//

		if (clock.getElapsedTime().asSeconds() > 1.0/FPS) {
			clock.restart();
			window.clear();
			nFrames += 1;
			manager.DrawAll(window);
			window.draw(Fps);
			window.display();
		}
		++nFrames;
		if (fClock.getElapsedTime().asSeconds() > 2.0){
			double fps = nFrames/fClock.restart().asSeconds();
			nFrames = 0;
			ss << fps;
			Fps.setString(ss.str());
			ss.str("");	
		}
	}
	return 0;
}
コード例 #12
0
void app_main(void)          
{

  win.x = 100;
  win.y = 100;
  win.dx = 400;
  win.dy = 400;	 

  draw_window();

  cgl = kosglCreateContext( 0, 0);
  kosglMakeCurrent( 0, 20, win.dx, win.dy-20, cgl);

  init();

  pri=new process_table_entry_;
  SysCall(66,1,1);

  reshape();
  
do{

   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

   glPushMatrix();
   glRotatef( view_rotx, 1.0, 0.0, 0.0 );
   glRotatef( view_roty, 0.0, 1.0, 0.0 );
   glRotatef( view_rotz, 0.0, 0.0, 1.0 );

   glPushMatrix();
   glTranslatef( -2.0, -2.0, 0.0 );
   glRotatef( angle, 0.0, 0.0, 1.0 );
   glCallList(gear1);
   glPopMatrix();

   glPushMatrix();
   glTranslatef( 4.1, -2.0, 0.0 );
   glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
   glCallList(gear2);
   glPopMatrix();

   glPushMatrix();
   glTranslatef( -2.1, 4.2, 0.0 );
   glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
   glCallList(gear3);
   glPopMatrix();

   glPopMatrix();
   
 kosglSwapBuffers();

 angle += 0.01 + 0.3* Fps (330,8);
 			
		  switch(SysCall(11))
		      {
		          case 1: draw_window();				  	   	  
				  	   	  reshape();
				  	   	  break;
				  	   	  
		          case 2: 		          
		          	   switch(__menuet__getkey()){

						   case KEY_F:
                                    if(!FullScreen){									 
									 skin=0;
									 SysCall(67,0,0,SysCall(14)>>16,SysCall(14)&0xffff);
									 draw_window();
									 reshape();
									 FullScreen = 1;
									}
									else{
									 skin=3;
									 draw_window();
									 SysCall(67,win.x,win.y,win.dx,win.dy);
									 reshape();
									 FullScreen = 0;
									};
						  			break;
		          
                           case KEY_ESC: disabletgl();
						  				 return;}
						  				 break;
						  			
			  	  case 3: disabletgl();
						  return;
		      }
コード例 #13
0
ファイル: physics-paper.cpp プロジェクト: ethz-asl/iclcv
void init(){

  //  scene.getLight(0).setOn(false);
  scene.getLight(0).setDiffuse(GeomColor(255,255,255,50));

  SceneLight &l = scene.getLight(1);
  static Camera cam(Vec(0,0,600,1),
                    Vec(0,0,-1,1),
                    Vec(0,-1,0,1));
  cam.setResolution(Size(1024,1024));
  scene.setGravity(Vec(0,0,-1000));

  l.setShadowCam(new Camera(cam));
  l.setShadowEnabled(true);
  l.setAnchorToWorld();
  l.setPosition(Vec(0,0,600,1));
  l.setOn(true);
  l.setSpecularEnabled(true);
  l.setDiffuseEnabled(true);
  l.setSpecular(GeomColor(0,100,255,255));
  l.setDiffuse(GeomColor(255,100,0,30));

  scene.setPropertyValue("shadows.use improved shading",true);
  scene.setPropertyValue("shadows.resolution",2048);
  scene.setPropertyValue("shadows.bias",10);


  //static const int W=20,H=13,DIM=W*H;
  static const int W=pa("-paper-dim",0), H=pa("-paper-dim",1);
  static Img8u frontFace = load<icl8u>(*pa("-ff"));
  static Img8u backFace = load<icl8u>(*pa("-bf"));

  const Size s(210,297);
  const Vec corners[4] = {
    Vec(-s.width/2, -s.height/2, 150,1),
    Vec(s.width/2, -s.height/2, 150,1),
    Vec(s.width/2, s.height/2, 150,1),
    Vec(-s.width/2, s.height/2, 150,1),
  };

  paper = new ManipulatablePaper(&scene,&scene,W,H,corners,true,&frontFace,&backFace);
  //scene.removeObject(paper);
  //paper->addShadow(-74.5);


  if(pa("-o")){
    std::vector<Camera> cams;
    for(int i=0;i<3;++i){
      cams.push_back(Camera(*pa("-c",i)));
    }
    capturer = new SceneMultiCamCapturer(scene, cams);
    //    Scene::enableSharedOffscreenRendering();
    scene.setDrawCamerasEnabled(false);
  }

  gui << Draw3D(Size::VGA).minSize(32,24).handle("draw")
      << (VBox().maxSize(12,100).minSize(12,1)
          << ( HBox()
               << Fps(10).handle("fps")
               << Button("add clutter").handle("add")
               )
          << ( HBox()
               << Button("stopped","running",true).out("run")
               << Button("paper ...").handle("props")
               )
          << ( HBox()
               << CheckBox("show cubes").out("showCubes")
               << CheckBox("show texture",false).out("showTexture")
               << CheckBox("show links",false).out("showLinks")
             )
          << FSlider(0,1,0.5).out("vertexMoveFactor").label("manual force")
          << FSlider(1,100,10).out("attractorStreangth").label("attractor force")
          << FSlider(0.0001,0.9999,0.9).handle("globalStiffness").label("global paper stiffness")
          << ( HBox()
               << Button("reset paper").handle("resetPaper")
               << Combo("1,5,10,25,!200,300,500").handle("maxFPS").label("max FPS")
               )
          << FSlider(0.1,20,2).handle("cm").label("collision margin")

          << ( HBox()
               << Button("memorize").handle("mem")
               << CheckBox("soften with mouse",true).handle("soften")
               << Button("test").handle("pct")
             )
          )

      << Show();

  propGUI << Prop("paper").minSize(16,1).maxSize(16,100) << Create();

  gui["pct"].registerCallback(paper_coords_test);
  gui["props"].registerCallback(utils::function((GUI&)propGUI,&GUI::switchVisibility));
  gui["resetPaper"].registerCallback(reset_paper);
  gui["globalStiffness"].registerCallback(change_global_stiffness);

  scene.PhysicsWorld::addObject(&ground);
  scene.Scene::addObject(&groundVis);

  DrawHandle3D draw = gui["draw"];
  draw->install(paper->createMouseHandler(0));
  draw->install(&foldLine);
  draw->link(scene.getGLCallback(0));

  foldLine.cb = utils::function(fold_line_cb);



}