POV-Ray : Newsgroups : povray.beta-test : functions Server Time
31 Jul 2024 10:24:56 EDT (-0400)
  functions (Message 1 to 4 of 4)  
From: sacrofts
Subject: functions
Date: 6 Sep 2001 16:29:15
Message: <3b97dc9b$1@news.povray.org>
The following code was fine in megapov but generates this message in 
3.5:
    function {( ((y-5.5)+PFWaves(x+10,y,z)* <----ERROR
    Parse Error: Expected '.', * found instead

Have I missed something about the way functions work in 3.5?
Celeron 400Mhz, 192Mb, 3.5beta1, Win98

Steve

--code--------------------
#declare PFWaves =
   function {
      pigment {waves scale 10 
         color_map {
            [0 rgb 1.5] 
            [1 rgb 0]
           }
        }
     }
     
#declare PFRipples =
   function {
      pigment {ripples scale <2,4,2> rotate y*35 turbulence 0.5 octaves 
1 lambda 0.2
         ramp_wave
               color_map {
                  [0 rgb 5]
                  [0.025 rgb 0.51*5]
                  [0.05 rgb 0.26*5]
                  [0.1 rgb 0.1*5]
                  [1 rgb 0]
                 }
             }
         }

#declare ISOF_Water =
   function {( ((y-5.5)+PFWaves(x+10,y,z)*2) +PFRipples(x*1/2,y,z*1/2)) 
+noise3d(x,y,z)/3}


Post a reply to this message

From: Warp
Subject: Re: functions
Date: 6 Sep 2001 16:42:33
Message: <3b97dfb9@news.povray.org>
sacrofts <sac### [at] tinyonlinecouk> wrote:
: #declare PFWaves =
:    function {
:       pigment {waves scale 10 
:          color_map {
:             [0 rgb 1.5] 
:             [1 rgb 0]
:            }
:         }
:      }

  You should read the documentation more carefully.

  Your PFWaves function is a pigment function which returns a color. You
can't use a color in another function which expects a float. If you want
to use the pigment function in another function, you have to specify what
to do with the color returned by it. This is done with the dot operator.
  The most common use is .gray (ie. PFWaves(x,y,z).gray) but you can also
use .x, .y, .z and so on.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: sacrofts
Subject: Re: functions
Date: 6 Sep 2001 16:50:56
Message: <3b97e1b0@news.povray.org>
many thanks, I hadn't realised .gray existed!  Found it in the docs now.

Steve

>   The most common use is .gray (ie. PFWaves(x,y,z).gray) but you can 
also
> use .x, .y, .z and so on.


Post a reply to this message

From: Warp
Subject: Re: functions
Date: 6 Sep 2001 17:03:56
Message: <3b97e4bb@news.povray.org>
sacrofts <sac### [at] tinyonlinecouk> wrote:
: many thanks, I hadn't realised .gray existed!  Found it in the docs now.

  They are pretty hidden, that's true. They can be found in section 6.5.4.2.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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