POV-Ray : Newsgroups : povray.advanced-users : Changing POV #version mid-scene? Server Time
6 Dec 2021 13:30:28 EST (-0500)
  Changing POV #version mid-scene? (Message 1 to 8 of 8)  
From: posfan12
Subject: Changing POV #version mid-scene?
Date: 10 Jan 2014 17:11:36
Message: <52d07018$1@news.povray.org>
I'm quoting Travis Cobbs here:

http://forums.ldraw.org/read.php?22,11863,11913#msg-11913





 > Actually, I'm pretty sure you can switch it on the fly. I already
 > have code to do this in another situation (although I haven't been
 > able to track down what I can do to trigger the code). The output
 > looks something like so:

 > #if (version > 3.6) #version 3.6; #end
 > #include "somefile.inc"
 > #if (version < LDXOrigVer) #version LDXOrigVer; #end




Does this still work in POV 3.7?

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


Post a reply to this message

From: Doctor John
Subject: Re: Changing POV #version mid-scene?
Date: 10 Jan 2014 18:21:58
Message: <52d08096$1@news.povray.org>
On 10/01/2014 22:11, posfan12 wrote:
>
>
> Does this still work in POV 3.7?
>

Good question. Haven't tried... but why would you want to do it?

John


Post a reply to this message

From: clipka
Subject: Re: Changing POV #version mid-scene?
Date: 10 Jan 2014 18:50:38
Message: <52d0874e$1@news.povray.org>
Am 10.01.2014 23:11, schrieb posfan12:

>  > Actually, I'm pretty sure you can switch it on the fly. I already
>  > have code to do this in another situation (although I haven't been
>  > able to track down what I can do to trigger the code). The output
>  > looks something like so:
>
>  > #if (version > 3.6) #version 3.6; #end
>  > #include "somefile.inc"
>  > #if (version < LDXOrigVer) #version LDXOrigVer; #end
>
> Does this still work in POV 3.7?

Yes, although it will warn you that #version isn't the first statement 
in the scene file.

You can suppress the warning by using the following syntax:

   #version version;
   #if (version > 3.6) #version 3.6; #end
   #include "somefile.inc"
   #if (version < LDXOrigVer) #version LDXOrigVer; #end


Post a reply to this message

From: Cousin Ricky
Subject: Re: Changing POV #version mid-scene?
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

From: Doctor John
Subject: Re: Changing POV #version mid-scene?
Date: 11 Jan 2014 02:45:47
Message: <52d0f6ab$1@news.povray.org>
On 11/01/14 07:16, Cousin Ricky wrote:
> 
> 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.)
> 

Apart from, of course, crackle ;-)

John
-- 
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children


Post a reply to this message

From: posfan12
Subject: Re: Changing POV #version mid-scene?
Date: 11 Jan 2014 16:15:01
Message: <web.52d1b3d1b158b000390e55f30@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> 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.

For some reason I thought I read that POV-Ray reverts to 3.62 behavior if at any
point it encounters something other than #version 3.7 (and remains this way from
that point on).


Post a reply to this message

From: Alain
Subject: Re: Changing POV #version mid-scene?
Date: 11 Jan 2014 16:57:41
Message: <52d1be55$1@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.
>


Actualy, with version 3.7, having a file setting #version 3.6; will NOT 
make an object or texture with ambient 1 glow when using radiosity.

In version 3.7 using radiosity globaly disable ambient. You must use 
emission instead.


Post a reply to this message

From: clipka
Subject: Re: Changing POV #version mid-scene?
Date: 11 Jan 2014 19:05:20
Message: <52d1dc40$1@news.povray.org>
Am 11.01.2014 22:12, schrieb posfan12:
> "Cousin Ricky" <rickysttATyahooDOTcom> wrote:
>> 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.
>
> For some reason I thought I read that POV-Ray reverts to 3.62 behavior if at any
> point it encounters something other than #version 3.7 (and remains this way from
> that point on).

No, you can use "#version 3.7" to switch back.

Note however that some features' behaviour can only be affected 
"globally" by the #version statement. The "ambient" feature falls into 
this category: Whether it works when radiosity is active depends 
entirely on the last #version statement encountered in your scene.


Post a reply to this message

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