Beispiel #1
0
void GlutIdle()
{
    static int lastRenderedPixels = 0;
    if ( mode == MODE_RENDERING ) {
        int nrp = renderImage.GetNumRenderedPixels();
        if ( lastRenderedPixels != nrp ) {
            lastRenderedPixels = nrp;
            if ( renderImage.IsRenderDone() ) {
                mode = MODE_RENDER_DONE;
                int endTime = (int) time(NULL);
                int t = endTime - startTime;
                int h = t / 3600;
                int m = (t % 3600) / 60;
                int s = t % 60;
                printf("\nRender time is %d:%02d:%02d.\n",h,m,s);

                renderImage.ComputeZBufferImage();
                
                std::string fileloc ("/Users/varunk/Desktop/RayTracerProj1/RayTracePrj11/RayTracePrj11/");
                
                renderImage.SaveZImage((fileloc + "zbuffer.ppm").c_str());
                
                renderImage.SaveImage((fileloc + "renderimage.ppm").c_str());
                
                renderImage.ComputeSampleCountImage();
                
                renderImage.SaveSampleCountImage((fileloc + "samplecountimage.ppm").c_str());
        
            }
            glutPostRedisplay();
        }
         if ( viewMode == VIEWMODE_IRRADCOMP ) glutPostRedisplay();
    }
}
Beispiel #2
0
void GlutIdle()
{
	static int lastRenderedPixels = 0;
	if ( mode == MODE_RENDERING ) {
		int nrp = renderImage.GetNumRenderedPixels();
		if ( lastRenderedPixels != nrp ) {
			lastRenderedPixels = nrp;
			if ( renderImage.IsRenderDone() ) {
				mode = MODE_RENDER_DONE;
				int endTime = (int) time(NULL);
				int t = endTime - startTime;
				int h = t / 3600;
				int m = (t % 3600) / 60;
				int s = t % 60;
				printf("\nRender time is %d:%02d:%02d.\n",h,m,s);
			}
			glutPostRedisplay();
		}
	}
}