Beispiel #1
0
int run_main (int argc, ACE_TCHAR *argv[])
{
  ACE_START_TEST (ACE_TEXT ("FlReactor_Test"));

  Fl_Window window (300, 370);

  Test_Window tw (10, 75, window.w () - 20, window.h ()-90);
  window.resizable (&tw);

  Fl_Hor_Slider slider (60, 5, window.w () - 70, 30, "Sides:");
  slider.align (FL_ALIGN_LEFT);
  slider.callback (sides_cb, &tw);
  slider.value (tw.sides ());
  slider.step (1);
  slider.bounds (3, 10);

  ACE_FlReactor reactor;
  ACE_Reactor r (&reactor);

  Fl_Box *box = new Fl_Box (FL_UP_BOX, 10, 40,
                            window.w () - 20, 30,
                            "Setting up");
  box->labelfont (FL_BOLD);

  Acceptor acceptor (&tw, box);

  ACE_INET_Addr address;

  if (acceptor.open (address, &r) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "%p\n",
                       "open acceptor"),
                      -1);

  acceptor.acceptor ().get_local_addr (address);

  const int bufsiz = 128;
  char buf[bufsiz];

  address.addr_to_string (buf, bufsiz, 0);

  char msg[2 * bufsiz];
  ACE_OS::sprintf (msg, "Listening on <%s>\n", buf);

  box->label (msg);
  box->redraw ();

  window.end ();
  window.show (argc, argv);
  tw.show ();

  return Fl::run ();

  ACE_END_TEST;
}
Beispiel #2
0
CDMVMDTestWindow::CDMVMDTestWindow( int w, int h, const char* label )
: Fl_Window( w, h, label )
{

	// create sliders on the right
	int interfaceWidth = 300;
	int interfaceStartX = w-(interfaceWidth+10);
	int menuHeight = 0;
	Fl_Hor_Slider* slider = new Fl_Hor_Slider( interfaceStartX, 30+menuHeight, interfaceWidth-100, 20, "XSlider" );
	slider->labeltype(FL_NORMAL_LABEL);
	slider->align(FL_ALIGN_RIGHT);
	slider->callback(&CDMVMDTestWindow::_sliderChanged, this );
	slider->value(0);
	slider->bounds(-1,1);

	slider = new Fl_Hor_Slider( interfaceStartX, 70+menuHeight, interfaceWidth-100, 20, "YSlider" );
	slider->labeltype(FL_NORMAL_LABEL);
	slider->align(FL_ALIGN_RIGHT);
	slider->callback(&CDMVMDTestWindow::_sliderChanged, this );
	slider->value(0);
	slider->bounds(-1,1);
	

	
	
	CDAssimpLoader loader;
	bool loaded = loader.loadModel("data/male_head_3ds-st.dae");
	assert(loaded);
	originalMesh = loader.getLoadedMesh();
	originalMesh.updateNormals();
	
	loaded = loader.loadModel("data/candide-closed.dae");
	assert(loaded);
	controlMesh = loader.getLoadedMesh();
	controlMesh.updateNormals();
	
	// test deformer
	deformer.setupDeformation(originalMesh, controlMesh);
	
	if ( glWindow ) {
		glWindow->redraw();
	}
	
	
	// create opengl window
	glWindow = new CDMVMDTestGlWindow( 10, 10, w-interfaceWidth-30, h-20, controlMesh, originalMesh );
	resizable(glWindow);
	glWindow->end();


	// done
	end();
		
	// setup idle
	Fl::add_timeout( framerate, &idleCallback, this );
		 
	// call first draw
	updateDeformation();
	deformer.compareDeformedWithOriginal();
	
	//CDMeshObjWriter writer;
	//writer.writeObj( deformer.getDeformedMesh(), "/tmp/deformed.obj");
}