コード例 #1
0
ファイル: main.cpp プロジェクト: ongbe/Advanced-Graphics
void walk_tree()
{
    static Stopwatch timer;
    timer.start();
    
    scale_factor = sqrt(2.0*pow(((double)width/(bbmax-bbmin).max()), 2.0));
    
    vert_ls splats = sphere_tree->recurseToDepth(recursion_depth);
    
    splats.sort(testSize);
    
    maxSplatSize = scale_factor * (splats.front()->size - splats.back()-> size)/2.0;
    
    fastSplats.clear();    
    fastSplats.reserve(splats.size());
    
    for (vert_it it = splats.begin(); it != splats.end(); it++)
    {
        fastSplats.push_back(**it);
    }

    splatParts.clear();
    splatSizes.clear();
    
    partitionSizes(fastSplats.begin(), fastSplats.end(), 5);
    
    splatParts.push_back(fastSplats.end());
    
    cout << splatSizes.size() << endl;
    
    timer.stop();
    printf("Recursed to depth %u in %f seconds\n", recursion_depth, timer.time());
    printf("Displaying %lu splats, with %lu sizes\n", splats.size(), splatSizes.size() );
    timer.reset();
}
コード例 #2
0
ファイル: Lab0.cpp プロジェクト: xiaji/GPGN598A
int main() {
  printf("c++\n");
  int n = 1001;
  double maxtime = 2.0;
  float a = 0.99f;
  float* x = new float[n];
  float* y = new float[n];
  for (int i=0; i<n; ++i) x[i]=0;
  x[0] = x[n/2] = x[n-1] = 1;
  int nsmooth;
  Stopwatch sw;
  Dsp dsp;
  sw.start();
  for (nsmooth=0; sw.time()<maxtime; ++nsmooth)
    dsp.smooth(a,x,y,n);
  sw.stop();
  printf("nsmooth = %d\n", nsmooth);
  printf("   mean = %12.8f\n", dsp.mean(y,n));
  printf("   time = %12.8f\n", sw.time());
  printf(" mflops = %d\n", (int)(6.0e-6*n*nsmooth/sw.time()));
  return 0;
}
コード例 #3
0
ファイル: scanmatchingevaluation.cpp プロジェクト: gaf90/Tesi
void doScanMatchTiming(
        SemiDeterministicRetriever &sdr, double &assocTotalTime, double &scanTotalTime) {
    static QMutex perche;
    perche.lock();
    S matcher;
    sdr.stopwatch.reset();
    Stopwatch scanTotal;
    scanTotal.start();
    matcher.setRetriever(sdr);
    matcher.run();
    scanTotal.stop();
    assocTotalTime += sdr.stopwatch.time();
    scanTotalTime += scanTotal.time();
    perche.unlock();
}
コード例 #4
0
ファイル: main.cpp プロジェクト: ongbe/Advanced-Graphics
GLint main(int argc, char **argv)
{  
    // need this call to initialize glut/GL -- don't execute any OpenGL code before this call!
    glutInit(&argc,argv);
    
    // size and placement hints to the window system
    glutInitWindowSize(width,height);
    glutInitWindowPosition(10,10);
    
    // double buffered, RGB color mode, use depth buffer 
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    
    // create a GLUT window (not drawn until glutMainLoop() is entered)
    // wid is the window ID
    wid = glutCreateWindow("QSplat Implementation");    
    
    // time to register callbacks 
    
    // window size changes 
    glutReshapeFunc(reshape);
    
    // keypress handling when the current window has input focus 
    glutKeyboardFunc(keyboard);
    
    // mouse event handling 
    glutMouseFunc(mouse_button);           // button press/release
    glutMotionFunc(button_motion);         // mouse motion w/ button down
    
    // function to draw contents of our window -- 
    //  this is where most of your work will focus!
    glutDisplayFunc(draw);
    
    // read the input mesh
    if (argc<2)
    {
        cout << "Use mesh name as the command line argument" << endl;
        return 0;
    }
    ifstream ifs(argv[1]);
    if (!ifs)
    {
        cout << "Can't open " << argv[1] << endl;
        return 0;
    }
    
    Stopwatch timer;
    
    timer.start();
    
    read_mesh(ifs);    
    build_sphere_tree();
    
    timer.stop();
    
    printf("\nProcessed the mesh in %f seconds\n\n", timer.time() );
    
    walk_tree();
    
    create_menu();
    // this is the event loop entry:
    // take event off the queue, call the handler, repeat
    glutMainLoop();
    
    return 0;
}
コード例 #5
0
ファイル: Image.Load.cpp プロジェクト: rdcastan/dream
		Ref<Image> Image::load_from_data (const Ptr<IData> data) {
			static Stopwatch t;
			static unsigned count = 0; ++count;

			Ref<Image> loaded_image;
			Shared<Buffer> buffer;

			t.start();

			buffer = data->buffer();

			switch (buffer->mimetype()) {
			case IMAGE_JPEG:
				loaded_image = load_jpeg_image(data);
				break;
			case IMAGE_PNG:
				loaded_image = load_png_image(data);
				break;
			//case Data::IMAGE_DDS:
			//	loaded_image = load_ddsimage(data);
			default:
				logger()->log(LOG_ERROR, "Could not load image: Unsupported image format.");
			}

			t.pause();

			logger()->log(LOG_INFO, LogBuffer() << "*** Total time to load " << count << " images: " << t.time() << "s");

			return loaded_image;
		}