//========================================================================= // Persistence of Vision Ray Tracer version 3.8 // Scene Description Language (SDL) // File: Self-Including POV-Ray scene file // Version: 1.0 // Last updated: 16-Feb-2023 // Prototype file to illustrate the idea of // a POV-Ray file including itself, with logic // and flow-control to determine which parts of // code get executed during which iteration of // parsing. So many possibilities! // // Author: Bill Walker "Bald Eagle", 2023 // email: see posts in news.povray.org // //------------------------------------------------------------------------ #ifndef (Flag) #version 3.8; global_settings {assumed_gamma 1} #declare Flag = 1; #end #if (Flag = 3) #debug "\n \n" #debug "THIRD parsing of scene file \n" #debug "--------------------------- \n" #debug "Here, at the top of the scene file, you can \n" #debug "put all of the things that a user would want \n" #debug "to see right away without scrolling through \n" #debug "possibly hundreds of lines of code. \n" #debug "A 'control panel', a camera definition that \n" #debug "depends on the location of objects that aren't \n" #debug "created until later in the file.... \n" #end #if (Flag = 2) #debug "\n \n" #debug "SECOND Parsing of scene file \n" #debug "--------------------------- \n" #debug "All kinds of interesting stuff \n" #debug "can be put in this section. \n" #debug "Perhaps you #declared some \n" #debug "objects or made some calculations \n" #debug "that you would have needed 'foreknowledge' \n" #debug "of in later code. Or maybe you needed \n" #debug "to write some information to disk, \n" #debug "before reading it back in again. \n" #debug "One might even think about writing \n" #debug "macros to make a self-writing POV \n" #debug "scene based on things that would \n" #debug "need to be computed, held in memory, \n" #debug "or otherwise be done in a single parse \n" #debug "phase, but seems impossible since \n" #debug "scene files usually only ever get parsed \n" #debug "once, and in order. \n" #end #if (Flag = 1) #debug "FIRST parsing of scene file \n" #debug "--------------------------- \n" #debug "You can put all sorts of stuff \n" #debug "here that you want at the bottom \n" #debug "of the scene file that you'd like\n" #debug "to be out of the way, but needs to \n" #debug "be parsed before other blocks of code. \n" #debug "macros, function definitions, and \n" #debug "even huge 256-entry color_maps or \n" #debug "array declarations. \n" #end // You can likely also use #switch / #case / #break #declare Flag = Flag +1; #if (Flag < 4) #include "SelfIncludingPovFile.pov" #end