void simulate() { cout << "Simulating..." << endl; for (int i = 0; i < 5; i++) { cout << "#" << i << endl; nextStage(); cout << "Tracing..." << endl; traceRays(h_rays, scene); nextStage(); cout << "Interacting..." << endl; interactRays(h_rays); } }
void masterFunc() { Octree t; vector3 cam(-0.5,-0.5, -800); vector3 camX(1,0,0); vector3 camY(0,1,0); vector3 camZ(0,0,1); BITMAP32 render(512,512); vector3 p; vector3 lightdir(-1,-1,1); vector3 lightdir2(0,1,0); lightdir.normalize(); int treeSize; char * treeBuffer; //t.loadFromBitmaps("./dicom/IM_0001%03d.bmp", 200); //t.writeToFile("octree.dat"); cout << "Loading octree data" << endl; t.readFromFile("octree.dat", treeBuffer, treeSize); MPI_Bcast (&treeSize, 1, MPI_INT, MASTER, MPI_COMM_WORLD); //Broadcast header with tree size MPI_Bcast (treeBuffer, treeSize, MPI_BYTE, MASTER, MPI_COMM_WORLD); //Broadcast tree cout << "Data sent from master node." << endl; int frames = 1; time_t startTime = time(0); for(int i = 0; i < frames; i++) { double xcenter = 30, zcenter = -25, radius = 500; RaytraceCamera camera(vector3(xcenter+radius*cos(i*2*PI/frames)+1,-9,zcenter+radius*sin(i*2*PI/frames)+1), vector3(xcenter,-10,zcenter)); cout << "Generating rays..." << endl; vector<RayPixel> rays = camera.generateRays(512,512); cout << rays.size() << " rays generated." << endl; traceRays(rays, t, render); cout << "Loop " << i << ": done tracing rays!" << endl; time_t seconds = time(0); cout << "Frame " << i << " done at " << difftime(seconds, startTime) << endl; exportBMP(render,"render" + toString(i) + ".bmp"); } }