POV-Ray : Newsgroups : povray.bugreports : #switch...#end bug with 3.7 RC5 Server Time
31 Oct 2024 10:21:13 EDT (-0400)
  #switch...#end bug with 3.7 RC5 (Message 1 to 2 of 2)  
From: Jörg 'Yadgar' Bleimann
Subject: #switch...#end bug with 3.7 RC5
Date: 17 Mar 2012 11:27:35
Message: <4f64ad67@news.povray.org>
High!

Version 3.7 RC5 apparently is not yet able to handle animation loops 
properly: when I tried to render this script

   background
   {
     #switch (clock)
       #range (0, 24)
         color rgb 0
       #break
       #range (25, 99)
         color rgb (clock-25)*<0, 1/75, 1/75>
       #break
       #range (100, 299)
         color rgb <0, 1, 1>
       #break
     #end
   }
   camera {
     location <0, 2, -3>
     look_at  <0, 1,  2>
   }
   sphere
   {
     #switch (clock)
       #range (0, 99)
         <0, 1, 2>, 0
       #break
       #range (100, 199)
         <0, 1, 2>, (clock-100)*0.02
       #break
       #range (200, 299)
         <0, 1, 2>, 2
       #break
     #end
     texture 			// line 32
     {
       pigment { color <1, 1, 0> }
     }
   }
   light_source
   {
     <2, 4, -3>
     #switch (clock)
       #range (0, 199)
         color rgb 0
       #break
       #range (200, 299)
         color rgb (clock-200)*0.01
       #break
       #range (300, 399)
         color rgb 1
       #break
     #end

   }

with +ki0 +kf299 +kfi0 +kff 299, PoV-Ray prompted an error message on 
line 32: parse error: Expected 'numeric expression', texture found instead

The same scene runs flawlessly under 3.6!

See you in Khyberspace!

Yadgar


Post a reply to this message

From: clipka
Subject: Re: #switch...#end bug with 3.7 RC5
Date: 17 Mar 2012 14:00:21
Message: <4f64d135$1@news.povray.org>

> High!
>
> Version 3.7 RC5 apparently is not yet able to handle animation loops
> properly: when I tried to render this script
>
> [...]
>
> with +ki0 +kf299 +kfi0 +kff 299, PoV-Ray prompted an error message on
> line 32: parse error: Expected 'numeric expression', texture found instead
>
> The same scene runs flawlessly under 3.6!

Looks like POV-Ray slips through the second #switch statement without 
matching any of the #range blocks. Note that you failed to cover the 
whole possible range: 99.5, for instance, isn't in included.

Now you may think that your animation settings should make sure that 
clock = frame number, and therefore an integer value. However, note that 
those settings don't instruct POV-Ray to just use frame_number as clock 
- it still computes the clock like it would for any "odd" setting. As a 
result, you may get rounding differences, and end up with clock values 
of something like 99.999999.

Just make sure your ranges overlap (e.g. #range(0,100) and 
#range(100,200)); POV-Ray will pick the first match and be done with it, 
so a value of 100 will only hit the first range block.


Post a reply to this message

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