POV-Ray : Newsgroups : povray.unofficial.patches : #if within statements. A bug? Server Time
2 Nov 2024 13:19:54 EDT (-0400)
  #if within statements. A bug? (Message 1 to 3 of 3)  
From: omniVERSE
Subject: #if within statements. A bug?
Date: 20 Oct 1999 02:03:54
Message: <380d5b4a@news.povray.org>
When something doesn't work like I want I usually work around it, just
thought I'd ask what others thought and see if I'm doing things right in the
first place.
When a '#if' or '#switch' directive (others possibly?) is applied within a
'pigment' or 'finish' statement for example, the parser errors on it.  The
same thing is apparently okay in official POV 3.1g yet not so in 3.1e
(UVPov, Super Patch).
Like:

object {TestIf
 pigment {
  #if (DoThis)
   rgb<1,1,1>
  #else
   rgb<0,0,0>
  #end
 }
 finish {ambient .1
  #if (DoThis)
   diffuse .6
  #else
   diffuse 0
  #end
 }
}

Won't parse.  I even had a '#while' loop refuse to work in one file and yet
do so in another, both in official POV 3.1g oddly enough.  So I don't know
if the parser (pvengine for that matter) is glitching on it or what might be
happening.  Anyone else experience this kind of thing?

Bob
--
// omniVERSE
// http://users.aol.com/inversez/


Post a reply to this message

From: Juha Leppälä
Subject: Re: #if within statements. A bug?
Date: 21 Oct 1999 16:04:32
Message: <380F805F.76228F79@kolumbus.fi>
omniVERSE wrote:
> 
> When something doesn't work like I want I usually work around it, just
> thought I'd ask what others thought and see if I'm doing things right in the
> first place.
> When a '#if' or '#switch' directive (others possibly?) is applied within a
> 'pigment' or 'finish' statement for example, the parser errors on it.  The
> same thing is apparently okay in official POV 3.1g yet not so in 3.1e
> (UVPov, Super Patch).
> Like:
> 
> object {TestIf
>  pigment {
>   #if (DoThis)
>    rgb<1,1,1>
>   #else
>    rgb<0,0,0>
>   #end
>  }
>  finish {ambient .1
>   #if (DoThis)
>    diffuse .6
>   #else
>    diffuse 0
>   #end
>  }
> }
> 

I had no problem parsing the following in Superpatch
//Start code
#declare Test=0;
sphere { 0,1 pigment { #if(Test) rgb <1,0,1> #else rgb <0,1,0> #end } }
// End code

Maybe you haven't declared DoThis or TestIf.



Post a reply to this message

From: omniVERSE
Subject: Re: #if within statements. A bug?
Date: 21 Oct 1999 21:44:14
Message: <380fc16e@news.povray.org>
Alright, it seems to be only when using them within a layered texture
Otherwise it can parse okay when within a regular single texture somewhere.
Try this out, it fails even in official POV-Ray so it's not a topic of the
UVpov or Super patches alone. And as I said before I think it does so with
#while, #switch, #ifdef, or any other "#" directive, even '#declare'.

#declare IFBUG=yes;

#declare GoldR_M =
 texture {
  pigment {radial frequency 24 color_map {
        [0 color rgb<1.6,.9,.3>*3]
        [.25 color rgb<.99,.4,.2>]
        [.5 color rgb<.5,.3,.1>*.1]
        [.75 color rgb<.99,.4,.2>]
        [1 color rgb<1.6,.9,.3>*3]
        } cubic_wave rotate 90*x }
 normal {radial 1

 #if(IFBUG=no) //  here's the trouble!

    frequency 24 cubic_wave

 #end

 rotate 90*x}
   finish {ambient .05 diffuse .8 phong .4 phong_size 150 specular .6
roughness .007
         reflection .3 reflection_exponent .3
        metallic .6 brilliance 2 crand .036}
}
 texture {
  pigment {radial frequency 24 color_map {
        [0 color rgbf<1.5,.9,.2,.9>]
        [.25 color rgbf<1,.35,.4,.8>]
        [.5 color rgbf<.4,.3,.2,.99>*.2]
        [.75 color rgbf<1,.35,.4,.8>]
        [1 color rgbf<1.5,.9,.2,.9>]
        } cubic_wave rotate 90*x }
    normal {radial .9 frequency 24 triangle_wave rotate 90*x}
   finish {

 #if(IFBUG=yes) //  here's the trouble!

   ambient .15 diffuse .4 phong .5 phong_size 200 specular .5 roughness .009

 #end

         reflection .5 reflection_exponent .7
        metallic .9 brilliance 4 crand .03}
}

//Bob


news:380F805F.76228F79@kolumbus.fi...
> omniVERSE wrote:
> >
> > When something doesn't work like I want I usually work around it, just
> > thought I'd ask what others thought and see if I'm doing things right in
the
> > first place.
> > When a '#if' or '#switch' directive (others possibly?) is applied within
a
> > 'pigment' or 'finish' statement for example, the parser errors on it.
The
> > same thing is apparently okay in official POV 3.1g yet not so in 3.1e
> > (UVPov, Super Patch).
> > Like:
> >
> > object {TestIf
> >  pigment {
> >   #if (DoThis)
> >    rgb<1,1,1>
> >   #else
> >    rgb<0,0,0>
> >   #end
> >  }
> >  finish {ambient .1
> >   #if (DoThis)
> >    diffuse .6
> >   #else
> >    diffuse 0
> >   #end
> >  }
> > }
> >
>
> I had no problem parsing the following in Superpatch
> file://Start code
> #declare Test=0;
> sphere { 0,1 pigment { #if(Test) rgb <1,0,1> #else rgb <0,1,0> #end } }
> // End code
>
> Maybe you haven't declared DoThis or TestIf.
>


Post a reply to this message

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