| 190 | } |
| 191 | |
| 192 | static void DoRendering(RenderSession *session) { |
| 193 | const unsigned int haltTime = session->GetRenderConfig().GetProperties().Get(Property("batch.halttime")(0)).Get<unsigned int>(); |
| 194 | const unsigned int haltSpp = session->GetRenderConfig().GetProperties().Get(Property("batch.haltspp")(0)).Get<unsigned int>(); |
| 195 | |
| 196 | char buf[512]; |
| 197 | const Properties &stats = session->GetStats(); |
| 198 | while (!session->HasDone()) { |
| 199 | boost::this_thread::sleep(boost::posix_time::millisec(1000)); |
| 200 | |
| 201 | session->UpdateStats(); |
| 202 | const double elapsedTime = stats.Get("stats.renderengine.time").Get<double>(); |
| 203 | const unsigned int pass = stats.Get("stats.renderengine.pass").Get<unsigned int>(); |
| 204 | const float convergence = stats.Get("stats.renderengine.convergence").Get<unsigned int>(); |
| 205 | |
| 206 | // Print some information about the rendering progress |
| 207 | sprintf(buf, "[Elapsed time: %3d/%dsec][Samples %4d/%d][Convergence %f%%][Avg. samples/sec % 3.2fM on %.1fK tris]", |
| 208 | int(elapsedTime), int(haltTime), pass, haltSpp, 100.f * convergence, |
| 209 | stats.Get("stats.renderengine.total.samplesec").Get<double>() / 1000000.0, |
| 210 | stats.Get("stats.dataset.trianglecount").Get<double>() / 1000.0); |
| 211 | |
| 212 | LC_LOG(buf); |
| 213 | } |
| 214 | |
| 215 | // Save the rendered image |
| 216 | session->GetFilm().SaveOutputs(); |
| 217 | } |
| 218 | |
| 219 | int main(int argc, char *argv[]) { |
| 220 | try { |
no test coverage detected