Skip to content

Commit

Permalink
Overhauled frame number handling in animation status messages.
Browse files Browse the repository at this point in the history
Animation status messages now consistently display a running frame count and the total number of frames actually to be rendered, properly taking into account the Frame_Step setting.
Additionally, the status messages now also show the nominal frame number as used in the `frame_number` variable and the output filename.
  • Loading branch information
c-lipka committed Apr 28, 2016
1 parent 8706877 commit eeeb039
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 58 deletions.
27 changes: 17 additions & 10 deletions changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Detailed changelog information is available in the file `revision.txt`, which
should be located in the same directory as this file is.
------------------------------------------------------------------------------


Changes between 3.7.0 and 3.7.1-TBD
===================================

Expand All @@ -45,8 +46,8 @@ Prior to the release of 3.7.1, the following items still need urgent attention:

- The Windows version's inbuilt help index needs to be fixed.

New Features and Improvements
-----------------------------
New Features
------------

- A new inbuilt constant, `tau`, has been added as shorthand for `2*pi`, in
support of the world-wide initiative to obsolete pi in favour of the new,
Expand All @@ -67,8 +68,6 @@ New Features and Improvements

- The macro syntax has been extended to allow for optional parameters.

- POV-Ray for Windows now reports file names and line numbers of warnings.

- Light sources' distance-based fading can now be set to obey an inverse-power
law at all distances.

Expand All @@ -88,14 +87,10 @@ New Features and Improvements
- Fresnel angle-dependent attenuation can now also be applied to highlights
and the diffuse component for more physical realism.

- Colour maps, pigment maps and the like are no longer limited to 256 entries.

- The creation of a log for the `+C` render abort-continue feature can now be
suppressed using `-CC` to save disk space.

- The number of components ber blob is no longer artificially limited.

For more details on the new features, see the documentation.
For more details on the above new features, see the documentation.

Changed Behaviour
-----------------
Expand All @@ -110,7 +105,7 @@ Changed Behaviour
`#version 3.7` (or later) directive anywhere in the main scene file.

- Using `ambient` with a suspiciously high value in a non-legacy scene will
now prompt a warning, unless an `emission` is also specified.
now prompt a warning, unless `emission` is also specified.

- POV-Ray will now try to auto-detect whether an input TIFF file with alpha
channel uses premultiplied or non-premultiplied alpha mode, rather than
Expand Down Expand Up @@ -158,6 +153,14 @@ Compatibility Improvements
- Thread stack size has been increased to avoid problems on some platforms.
(requires boost 1.50 or later)

Miscellaneous Improvements
--------------------------

- Animation status messages now include the nominal frame number.
- POV-Ray for Windows now reports file names and line numbers of warnings.
- Colour maps, pigment maps and the like are no longer limited to 256 entries.
- The number of components ber blob is no longer artificially limited.

Fixed or Mitigated Bugs Reported by Static Code Analysis
--------------------------------------------------------

Expand Down Expand Up @@ -256,6 +259,9 @@ Reported via Windows Crash Reports:

Miscellaneous:

- Animation status messages now consistently display a running frame count and
the total number of frames actually to be rendered, properly taking into
account the Frame_Step setting.
- Fixed mesh_camera-related flaws in the parser.
- Fixed a family of bugs that could cause problems when using focal blur with
some camera types if the camera is very close to the surface of a media
Expand Down Expand Up @@ -284,6 +290,7 @@ Other Noteworthy
- The Visual Studio 2010 project for a console-only Windows version has been
revived.


---------------------------------
Changes between 3.7.RC7 and 3.7.0
---------------------------------
Expand Down
2 changes: 1 addition & 1 deletion source/base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define OFFICIAL_VERSION_STRING "3.7.1"
#define OFFICIAL_VERSION_NUMBER 371

#define POV_RAY_PRERELEASE "alpha.8581629"
#define POV_RAY_PRERELEASE "alpha.8586521"

#if (POV_RAY_IS_AUTOBUILD == 1) && ((POV_RAY_IS_OFFICIAL == 1) || (POV_RAY_IS_SEMI_OFFICIAL == 1))
#ifdef POV_RAY_PRERELEASE
Expand Down
33 changes: 20 additions & 13 deletions source/frontend/animationprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -101,7 +101,8 @@ AnimationProcessing::AnimationProcessing(POVMS_Object& options) :
oddFieldFlag = renderOptions.TryGetBool(kPOVAttrib_OddField, false);

clockDelta = double(finalClock - initialClock) / double(finalFrame - initialFrame);
frameNumber = subsetStartFrame;
runningFrameNumber = 1;
nominalFrameNumber = subsetStartFrame;
clockValue = POVMSFloat(double(clockDelta * double(subsetStartFrame - initialFrame)) + double(initialClock));

frameNumberDigits = 1;
Expand All @@ -116,7 +117,7 @@ POVMS_Object AnimationProcessing::GetFrameRenderOptions()
opts.SetFloat(kPOVAttrib_Clock, clockValue);

// append to console files if not first frame (user can set this for first frame via command line to append all data to existing files, so don't set it to false)
if(frameNumber > subsetStartFrame)
if(nominalFrameNumber > subsetStartFrame)
opts.SetBool(kPOVAttrib_AppendConsoleFiles, true);

POVMS_List declares;
Expand All @@ -140,7 +141,7 @@ POVMS_Object AnimationProcessing::GetFrameRenderOptions()

POVMS_Object frame_number(kPOVMSType_WildCard);
frame_number.SetString(kPOVAttrib_Identifier, "frame_number");
frame_number.SetFloat(kPOVAttrib_Value, frameNumber);
frame_number.SetFloat(kPOVAttrib_Value, nominalFrameNumber);
declares.Append(frame_number);

POVMS_Object initial_clock(kPOVMSType_WildCard);
Expand All @@ -163,33 +164,39 @@ POVMS_Object AnimationProcessing::GetFrameRenderOptions()

void AnimationProcessing::ComputeNextFrame()
{
frameNumber+= frameStep;
clockValue = POVMSFloat(double(clockDelta * double(frameNumber - initialFrame)) + double(initialClock));
nominalFrameNumber+= frameStep;
++runningFrameNumber;
clockValue = POVMSFloat(double(clockDelta * double(nominalFrameNumber - initialFrame)) + double(initialClock));
}

bool AnimationProcessing::MoreFrames()
{
return (frameNumber+frameStep <= subsetEndFrame);
return (nominalFrameNumber+frameStep <= subsetEndFrame);
}

POVMSInt AnimationProcessing::GetFrameNumber()
POVMSInt AnimationProcessing::GetNominalFrameNumber()
{
return frameNumber;
return nominalFrameNumber;
}

POVMSInt AnimationProcessing::GetStartFrame()
POVMSInt AnimationProcessing::GetRunningFrameNumber()
{
return runningFrameNumber;
}

POVMSInt AnimationProcessing::GetSubsetStartFrame()
{
return subsetStartFrame;
}

POVMSInt AnimationProcessing::GetEndFrame()
POVMSInt AnimationProcessing::GetSubsetEndFrame()
{
return subsetEndFrame;
}

POVMSInt AnimationProcessing::GetTotalFrames()
POVMSInt AnimationProcessing::GetTotalFramesToRender()
{
return subsetEndFrame - subsetStartFrame + 1;
return (subsetEndFrame - subsetStartFrame) / frameStep + 1;
}

POVMSFloat AnimationProcessing::GetClockValue()
Expand Down
24 changes: 18 additions & 6 deletions source/frontend/animationprocessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -57,10 +57,21 @@ class AnimationProcessing
void ComputeNextFrame();
bool MoreFrames();

POVMSInt GetFrameNumber();
POVMSInt GetStartFrame();
POVMSInt GetEndFrame();
POVMSInt GetTotalFrames();
/// Get nominal frame number.
POVMSInt GetNominalFrameNumber();

/// Get running frame number.
POVMSInt GetRunningFrameNumber();

/// Get subset start frame number.
POVMSInt GetSubsetStartFrame();

/// Get subset end frame number.
POVMSInt GetSubsetEndFrame();

/// Get the total number of frames to actually render.
POVMSInt GetTotalFramesToRender();

POVMSFloat GetClockValue();
int GetFrameNumberDigits();
private:
Expand All @@ -79,7 +90,8 @@ class AnimationProcessing
POVMSBool oddFieldFlag;

POVMSFloat clockValue;
POVMSInt frameNumber;
POVMSInt runningFrameNumber;
POVMSInt nominalFrameNumber;

POVMSInt frameStep;

Expand Down
6 changes: 3 additions & 3 deletions source/frontend/simplefrontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -271,7 +271,7 @@ State SimpleFrontend<PARSER_MH, FILE_MH, RENDER_MH, IMAGE_MH>::Process()
{
options = animationProcessing->GetFrameRenderOptions();
if (imageProcessing != NULL)
options.SetUCS2String(kPOVAttrib_OutputFile, imageProcessing->GetOutputFilename(options, animationProcessing->GetFrameNumber(), animationProcessing->GetFrameNumberDigits()).c_str());
options.SetUCS2String(kPOVAttrib_OutputFile, imageProcessing->GetOutputFilename(options, animationProcessing->GetNominalFrameNumber(), animationProcessing->GetFrameNumberDigits()).c_str());
}
else
if (imageProcessing != NULL)
Expand Down Expand Up @@ -374,7 +374,7 @@ State SimpleFrontend<PARSER_MH, FILE_MH, RENDER_MH, IMAGE_MH>::Process()
try
{
if(animationProcessing != NULL)
imageProcessing->WriteImage(options, animationProcessing->GetFrameNumber(), animationProcessing->GetFrameNumberDigits());
imageProcessing->WriteImage(options, animationProcessing->GetNominalFrameNumber(), animationProcessing->GetFrameNumberDigits());
else
imageProcessing->WriteImage(options);
}
Expand Down
2 changes: 1 addition & 1 deletion unix/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.1-alpha.8581629
3.7.1-alpha.8586521
4 changes: 2 additions & 2 deletions vfe/unix/unixconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
/// Copyright 1991-2014 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -515,7 +515,7 @@ int main (int argc, char **argv)
}

if (flags & stAnimationStatus)
fprintf(stderr, "\nRendering frame %d of %d\n", session->GetCurrentFrame(), session->GetTotalFrames());
fprintf(stderr, "\nRendering frame %d of %d (#%d)\n", session->GetCurrentFrame(), session->GetTotalFrames(), session->GetCurrentFrameId());
if (flags & stAnyMessage)
PrintStatus (session);
if (flags & stBackendStateChanged)
Expand Down
15 changes: 8 additions & 7 deletions vfe/vfe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -920,30 +920,31 @@ State VirtualFrontEnd::Process()
m_Session->SetSucceeded (false);
if (animationProcessing != NULL)
{
shelloutProcessing->SetFrameClock(animationProcessing->GetFrameNumber(), animationProcessing->GetClockValue());
shelloutProcessing->SetFrameClock(animationProcessing->GetNominalFrameNumber(), animationProcessing->GetClockValue());
if (shelloutProcessing->SkipNextFrame() == false)
{
UCS2String filename;
int frame = animationProcessing->GetFrameNumber() - animationProcessing->GetStartFrame() ;
int frameId = animationProcessing->GetNominalFrameNumber();
int frame = animationProcessing->GetRunningFrameNumber();
options = animationProcessing->GetFrameRenderOptions ();
if (m_Session->OutputToFileSet())
{
filename = imageProcessing->GetOutputFilename (options, animationProcessing->GetFrameNumber(), animationProcessing->GetFrameNumberDigits());
filename = imageProcessing->GetOutputFilename (options, frameId, animationProcessing->GetFrameNumberDigits());
options.SetUCS2String (kPOVAttrib_OutputFile, filename.c_str());

// test access permission now to avoid surprise later after waiting for
// the render to complete.
if (m_Session->TestAccessAllowed(filename, true) == false)
{
string str ("IO Restrictions prohibit write access to '") ;
string str ("IO Restrictions prohibit write access to '");
str += UCS2toASCIIString(filename);
str += "'";
throw POV_EXCEPTION(kCannotOpenFileErr, str);
}
shelloutProcessing->SetOutputFile(UCS2toASCIIString(filename));
m_Session->AdviseOutputFilename (filename);
}
m_Session->AppendAnimationStatus (frame + 1, animationProcessing->GetTotalFrames(), filename) ;
m_Session->AppendAnimationStatus (frameId, frame, animationProcessing->GetTotalFramesToRender(), filename);
}
}

Expand Down Expand Up @@ -1163,7 +1164,7 @@ State VirtualFrontEnd::Process()
if (animationProcessing != NULL)
{
if (m_Session->OutputToFileSet())
m_Session->AdviseOutputFilename (imageProcessing->WriteImage(options, animationProcessing->GetFrameNumber(), animationProcessing->GetFrameNumberDigits()));
m_Session->AdviseOutputFilename (imageProcessing->WriteImage(options, animationProcessing->GetNominalFrameNumber(), animationProcessing->GetFrameNumberDigits()));
m_Session->AdviseFrameCompleted();
}
else
Expand Down
14 changes: 8 additions & 6 deletions vfe/vfesession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -109,6 +109,7 @@ void vfeSession::Clear(bool Notify)
m_PercentComplete = 0;
m_PixelsRendered = 0;
m_TotalPixels = 0;
m_CurrentFrameId = 0;
m_CurrentFrame = 0;
m_TotalFrames = 0;
if (Notify)
Expand Down Expand Up @@ -296,14 +297,15 @@ void vfeSession::AppendStatusMessage (const boost::format& fmt, int RecommendedP
NotifyEvent(stStatusMessage);
}

void vfeSession::AppendAnimationStatus (int Frame, int Total, const UCS2String& Filename)
void vfeSession::AppendAnimationStatus (int FrameId, int SubsetFrame, int SubsetTotal, const UCS2String& Filename)
{
boost::mutex::scoped_lock lock(m_MessageMutex);

m_CurrentFrame = Frame;
m_TotalFrames = Total;
m_StatusQueue.push (StatusMessage (*this, Filename, Frame, Total));
m_StatusLineMessage = (boost::format("Rendering frame %d of %d") % Frame % Total).str();
m_CurrentFrameId = FrameId;
m_CurrentFrame = SubsetFrame;
m_TotalFrames = SubsetTotal;
m_StatusQueue.push (StatusMessage (*this, Filename, SubsetFrame, SubsetTotal, FrameId));
m_StatusLineMessage = (boost::format("Rendering frame %d of %d (#%d)") % SubsetFrame % SubsetTotal % FrameId).str();
if (m_MaxStatusMessages != -1)
while (m_StatusQueue.size() > m_MaxStatusMessages)
m_StatusQueue.pop();
Expand Down
Loading

0 comments on commit eeeb039

Please sign in to comment.