Esempio n. 1
0
void RenderMessageHandler::Progress(Console *console, POVMS_Object& obj, bool verbose)
{
	ostringstream sstr;

	switch(obj.GetType(kPOVMSObjectClassID))
	{
		case kPOVObjectClass_PhotonProgress:
		{
			int cpc(obj.GetInt(kPOVAttrib_CurrentPhotonCount));

			sstr << Message2Console::GetProgressTime(obj, kPOVAttrib_RealTime)
			     << " Photons " << cpc << "    \r";
			break;
		}
		case kPOVObjectClass_RadiosityProgress:
		{
			int pt(obj.GetInt(kPOVAttrib_Pixels));
			int pc(obj.GetInt(kPOVAttrib_PixelsCompleted));
			int percent = 0;

			if(pt > 0)
				percent = (pc * 100) / pt;

			sstr << Message2Console::GetProgressTime(obj, kPOVAttrib_RealTime)
			     << " Radiosity pretrace completed " << pc << " of " << pt << " pixels (" << percent << "%)    \r";
			break;
		}
		case kPOVObjectClass_RenderProgress:
		{
			int pt(obj.GetInt(kPOVAttrib_Pixels));
			int pp(obj.GetInt(kPOVAttrib_PixelsPending));
			int pc(obj.GetInt(kPOVAttrib_PixelsCompleted));
			int percent = 0;

			if(pt > 0)
				percent = (pc * 100) / pt;

			sstr << Message2Console::GetProgressTime(obj, kPOVAttrib_RealTime)
			     << "Rendering completed " << pc << " of " << pt << " pixels (" << percent << "%) and " << pp << " pixels pending    \r";
			break;
		}
	}

	console->Output(sstr.str());
}
Esempio n. 2
0
void ParserMessageHandler::Progress(Console *console, POVMS_Object& obj, bool verbose)
{
    std::ostringstream sstr;

    switch(obj.GetType(kPOVMSObjectClassID))
    {
        case kPOVObjectClass_ParserProgress:
        {
            sstr << Message2Console::GetProgressTime(obj, kPOVAttrib_RealTime)
                 << " Parsing " << (obj.GetLong(kPOVAttrib_CurrentTokenCount) / (POVMSLong)(1000)) << "K tokens\r";
            break;
        }
        case kPOVObjectClass_BoundingProgress:
        {
            sstr << Message2Console::GetProgressTime(obj, kPOVAttrib_RealTime)
                 << " Bounding " << (obj.GetLong(kPOVAttrib_CurrentNodeCount) / (POVMSLong)(1000)) << "K nodes\r";
            break;
        }
    }

    console->Output(sstr.str());
}