POV-Ray : Newsgroups : povray.newusers : Calling 'procedures' with variables? : Re: Calling 'procedures' with variables? Server Time
5 Sep 2024 14:21:05 EDT (-0400)
  Re: Calling 'procedures' with variables?  
From: Chris Huff
Date: 29 Aug 2000 17:33:41
Message: <chrishuff-C8E47D.16351429082000@news.povray.org>
In article <39AC2738.5D9668D1@istar.ca>, sde### [at] istarca wrote:

> I've created a pigment type which depends on a variable, n. If I
> #declare n before the pigment code, it runs correctly.
> 
> However, I would like to be able to call this pigment type many times,
> with different values of n. I thought that I could simply remove the
> #declare before the pigment code, and use the code like:

You aren't "calling a pigment type", you are creating a copy of a 
variable which has already been parsed.


> How can I use the pigment code as a procedure, called with the variable?
> I've tried #macro, but haven't gotton anything working.

The macro feature is what you want. Just wrap the pigment definition in 
a macro statement and use the parameters to specify your variables. What 
were you trying to do?

#macro Radial(Rays, ClrA, ClrB)
    pigment {radial
        frequency Rays
        color_map {
            [0 color ClrA]
            [1 color ClrB]
        }
    }
#end

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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