POV-Ray : Newsgroups : povray.advanced-users : Changing POV #version mid-scene? : Re: Changing POV #version mid-scene? Server Time
3 Jun 2024 02:59:21 EDT (-0400)
  Re: Changing POV #version mid-scene?  
From: Cousin Ricky
Date: 11 Jan 2014 02:20:01
Message: <web.52d0efd7b158b000306548240@news.povray.org>
posfan12 <pos### [at] gmailcom> wrote:
> Does this still work in POV 3.7?

Include files do it all the time, and yes, in 3.7.  They typically restore the
old version at the end.  Using colors.inc as an example:
___________________________________

#ifndef(Colors_Inc_Temp)

#declare Colors_Inc_Temp = version;
#version 3.5;

....

#version Colors_Inc_Temp;
#end
___________________________________

Tell Michael to look in the 3.7 include directory.  Only one of the official
include files sets #version 3.7;.

Setting the #version in the include file insures that POV-Ray will know which
version the file was intended for.  For example, an include file written for 3.6
might use ambient to make an object glow.  This does not work in 3.7 when
radiosity is used, but with a #version 3.6; POV-Ray 3.7 will know that it should
revert to earlier behavior just for this file.  Thus, an include file written
for 3.6 will behave predictably in a scene written for 3.7.  (This is one answer
to Doctor John's question.)

Of course, it is common courtesy for the include file to restore the previous
version so there are no baffling surprises for the user.

One trick I have used in certain include files is to test the scene version, and
adjust the code accordingly to allow for advanced features without totally
abandoning users of older versions.  For example, in caption.inc (available in
the Object Collection), I wrote:
_______________________________________________________________

#ifndef (Caption_Inc_Temp) #declare Caption_Inc_Temp = version;
....
#if (version < 3.7) #version 3.5; #else #version 3.7; #end

....

    finish
    { #if (version < 3.7)
        #if (Emission < 0)
          ambient 1 diffuse 0
        #else
          ambient Emission
        #end
      #else
        #if (Emission < 0)
          ambient 0 diffuse 0 emission 1
        #else
          emission Emission
        #end
      #end
    }

....

#version Caption_Inc_Temp;
#end
_______________________________________________________________

For 3.7 scenes, an object can have an additional glow, while keeping the default
ambient (if Emission >= 0).  Earlier scenes don't get to keep both, but #version
3.5; is set anyway because that is the earliest version for which I know the
code will work.

> ---
> This email is free from viruses and malware because avast! Antivirus protection is
active.
> http://www.avast.com

Avast! has bungled the signature.  It's supposed to be two hyphens and a
trailing space so that mailers and newsreaders will know not to quote it in
replies.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.