POV-Ray : Newsgroups : povray.advanced-users : function select logic : Re: function select logic Server Time
26 Apr 2024 15:28:11 EDT (-0400)
  Re: function select logic  
From: scott
Date: 23 Nov 2016 11:09:42
Message: <5835bf46$1@news.povray.org>
>> I think you misunderstand my point. Any #if, #declare etc will only get
>> evaluated once when the scene is parsed. You'll end up with either your
>> function declared or not declared. When you come to use that function in
>> a pigment or isosurface or whatever your #if #declare statements won't
>> be executed again. Any logic needs to go inside the function declaration
>> using the select function, not #if.
>
> True.
> Though I was looking at "equations" not any declared functions.

If this is the case then it's very easy, no need to use any functions or 
select at all ... sorry, blatant copy&paste of your example :-)

#if (R>1 | R<0 | G>1 | G<0 | B>1 | B<0)
      // do nothing, or whatever else you want
#else
      // we know here that RGB are all within the 0...1 range, so no need
      // to clamp with min/max
      object{ blah blah pigment{ color rgb <R,G,B>} }
#end

But I got the impression from Mike's post that he needed a function to 
do this for use later (maybe in a pigment?).


Post a reply to this message

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