// Persistence of Vision Ray Tracer Scene Description File // File: SimpleNetAnimator.pov // Vers: intentionally unspecified // Desc: A super simple system for networked computers to "distribute" frames to render. // Actually each machine either renders a legitimate frame from local SDL and creates a // centrally-located and approprietely numbered "flag-file", or renders a blank frame if // this "flag-file" already exists. The blank frames should be quick, small if // compressed, and easy to sort out. External scripts, programs or any sort of a // frame-server are all avoided in this way - it's pure POV. // // Set up a shared network directory to place flag-files and make sure POV-Ray on all // machines can read & write to this directory. You'll need to define // NetworkPathForFrameFlags, FrameFlagName, AnimationSceneFile and optionally // ThisComputersName and MakeFrameFlagSummary: // // NetworkPathForFrameFlags - String ending with a backslash and specifying the shared // directory where flag-files can be placed. Don't forget // to double the backslashes. // FrameFlagName - String specifying the basic, un-numbered name for the // flag-files. It doesn't have to match AnimationSceneFile. // AnimationSceneFile - Specifies the file to be animated! // // ThisComputersName - "" by default, this optional identifier // can be set on each machine to identify the creator of // each frame-flag. This information can also be #included // from a file unique to each machine. // MakeFrameFlagSummary - If this is defined and "true" the contents of all the // frame flags will be listed, line by line in frame order // in a new file created after the last frame (or subset). // Date: 2007-01-25 // Auth: Charles C // *************************************************************************************************************************** // It would be nice to pass these strings in from the .ini file but since we can only // do that with float constants, it'll need to be done in SDL. Modify this file, // #include this file from another, but in either case we need E.g.: //#local NetworkPathForFrameFlags = "\\\\NetDrive\\SharedDir\POV\Animation\\FrameFlags\\"; //#local FrameFlagName = "F_Flag_MyAnimation"; //#local AnimationSceneFile = "MyAnimation.pov"; //#local ThisComputerName = ""; //#local MakeFrameFlagSummary = yes; // The following file should NOT be distributed to other computers. I put this file in // each machine's "\bucket_of_renders" directory as I call it, which I also have on // the Library_Path. I put it there instead of with the other SDL files because I // copy updated SDL files to each machine just before rendering... // The contents of this file should contain a line such as: // #declare ThisComputersName = "Computer_1"; #if(file_exists("ThisComputersName.txt")) #include "ThisComputersName.txt" #end // *************************************************************************************************************************** #ifndef(NetworkPathForFrameFlags) #error "Please define NetworkPathForFrameFlags.\n" #end #ifndef(FrameFlagName) #error "Please define FrameFlagName.\n" #end #ifndef(AnimationSceneFile) #error "Please define AnimationSceneFile.\n" #end #ifndef(ThisComputersName) #declare ThisComputersName = ""; #warning "You can define a unique ThisComputerName for each machine. \"\" is being used instead.\n" #end #local ThisFramesFlagFile = concat(NetworkPathForFrameFlags, FrameFlagName, str(frame_number,0,0),".txt") ; #if(file_exists(ThisFramesFlagFile)) //then render a blank scene.... #local RenderingThisFrame = no; //only needed for optional section below #else //put a flag file in the shared directory: #fopen NewFlagFile ThisFramesFlagFile write #write(NewFlagFile, concat("\"Frame number ", str(frame_number,0,0), " has been flagged by ", ThisComputersName, ".\"\n")) #fclose NewFlagFile //and render a legitimate frame: #include AnimationSceneFile #local RenderingThisFrame = yes; //only needed for optional section below #end // *************************************************************************************************************************** // *************************************************************************************************************************** // ***** The following is entirely optional and can be deleted or commented out. ********************************************* // #ifndef(MakeFrameFlagSummary) #local MakeFrameFlagSummary = no; #end #if( ((frame_number = final_frame) & RenderingThisFrame) & MakeFrameFlagSummary ) //then this machine is rendering the final frame and gets the honor of putting //the contents of the flag-files into a single file in the shared directory: #local FrameFlagsListFileName = concat(NetworkPathForFrameFlags, FrameFlagName, "_Summary.txt"); #fopen NewFrameFlagSummary FrameFlagsListFileName write #fclose NewFrameFlagSummary //contents are now erased #fopen NewFrameFlagSummary FrameFlagsListFileName append //and open again ready for line items. #write( NewFrameFlagSummary, concat("AnimationSceneFile was : \"", AnimationSceneFile, "\"\n") ) #write( NewFrameFlagSummary, concat("initial_clock was : ", str(initial_clock,0,8), "\n") ) #write( NewFrameFlagSummary, concat("final_clock was : ", str(final_clock,0,8), "\n") ) #write( NewFrameFlagSummary, concat("initial_frame was : ", str(initial_frame,0,0), "\n") ) #write( NewFrameFlagSummary, concat("final_frame was : ", str(final_frame,0,0), "\n\n\n") ) // #local FrameFlagFile_Ctr = initial_frame; #while (FrameFlagFile_Ctr <= final_frame) #local A_FlagFileName = concat(NetworkPathForFrameFlags, FrameFlagName, str(FrameFlagFile_Ctr,0,0),".txt") ; #if(file_exists(A_FlagFileName) ) #fopen A_FlagFile A_FlagFileName read #read ( A_FlagFile, A_FlagFile_String) #fclose A_FlagFile #else #local A_FlagFile_String = concat("\n FrameFlag number ", str(FrameFlagFile_Ctr,0,0), " is missing!\n"); #end //end if #write( NewFrameFlagSummary, concat(A_FlagFile_String,"\n") ) #local FrameFlagFile_Ctr = FrameFlagFile_Ctr +1; #end //end while // #fclose NewFrameFlagSummary #end //end if // // ***************************************************************************************************************************