POV-Ray : Newsgroups : povray.general : macro parameters Server Time
26 Dec 2024 14:15:43 EST (-0500)
  macro parameters (Message 1 to 4 of 4)  
From: kurtz le pirate
Subject: macro parameters
Date: 12 Feb 2006 03:32:15
Message: <kurtzlepirate-D923AB.09321512022006@news.povray.org>
hi,

i am trying to make a macro with one of parameters is "normal" like this
#macro foo(.., .., thisNormal, ..)
  ...
  normal { thisNormal }
  ...
#end

ok, works fine... but in some cases i don't want normal.
how can i pass a "no-normal" or "empty-normal" parameters ?

any ideas ?

thanks.


Post a reply to this message

From: Chris B
Subject: Re: macro parameters
Date: 12 Feb 2006 08:24:22
Message: <43ef3706$1@news.povray.org>
"kurtz le pirate" <kur### [at] yahoofr> wrote in message
news:kurtzlepirate-D923AB.09321512022006@news.povray.org...
> hi,
>
> i am trying to make a macro with one of parameters is "normal" like this
> #macro foo(.., .., thisNormal, ..)
>  ...
>  normal { thisNormal }
>  ...
> #end
>
> ok, works fine... but in some cases i don't want normal.
> how can i pass a "no-normal" or "empty-normal" parameters ?
>
> any ideas ?
>
> thanks.

Hi Kurtz,

I don't know how to do exactly what you ask. Just in case no-one else does 
either, here's a work-around.
Forgive me if it's just dodging the question, or if it's describing 
something that's already obvious to you.

Regards,
Chris B.

camera {location <0,0,-4> look_at <0,0,0>}
light_source{<0,3,-10> rgb 1}
#macro foo ()
  cylinder {-1,1,0.5
    texture {
      pigment {color rgb <1,1,1>}
      #ifdef (thisNormal) normal {thisNormal} #end
    }
  }
#end

#declare thisNormal = normal {agate};
foo()
#undef thisNormal
object {foo() rotate -y*90}
#declare thisNormal = normal {marble 2 turbulence 0.5};
object {foo() rotate y*135}


Post a reply to this message

From: kurtz le pirate
Subject: Re: macro parameters
Date: 12 Feb 2006 12:41:14
Message: <kurtzlepirate-50646F.18411412022006@news.povray.org>
In article <43ef3706$1@news.povray.org>,
 "Chris B" <c_b### [at] btconnectcomnospam> wrote:

> "kurtz le pirate" <kur### [at] yahoofr> wrote in message
> news:kurtzlepirate-D923AB.09321512022006@news.povray.org...
> > hi,
> >
> > i am trying to make a macro with one of parameters is "normal" like this
> > #macro foo(.., .., thisNormal, ..)
> >  ...
> >  normal { thisNormal }
> >  ...
> > #end
> >
> > ok, works fine... but in some cases i don't want normal.
> > how can i pass a "no-normal" or "empty-normal" parameters ?
> >
> > any ideas ?
> >
> > thanks.
> 
> Hi Kurtz,
> 
> I don't know how to do exactly what you ask. Just in case no-one else does 
> either, here's a work-around.
> Forgive me if it's just dodging the question, or if it's describing 
> something that's already obvious to you.
> 
> Regards,
> Chris B.
> 
> camera {location <0,0,-4> look_at <0,0,0>}
> light_source{<0,3,-10> rgb 1}
> #macro foo ()
>   cylinder {-1,1,0.5
>     texture {
>       pigment {color rgb <1,1,1>}
>       #ifdef (thisNormal) normal {thisNormal} #end
>     }
>   }
> #end
> 
> #declare thisNormal = normal {agate};
> foo()
> #undef thisNormal
> object {foo() rotate -y*90}
> #declare thisNormal = normal {marble 2 turbulence 0.5};
> object {foo() rotate y*135}

thanks chris. my english is not very good :))
but you help me. in fact, normal{} must be global's declared and not a  
parameter for the macro and, with #ifdef and #undef i can make want i 
want.

thanks too


Post a reply to this message

From: Florian Siegmund
Subject: Re: macro parameters
Date: 15 Feb 2006 02:55:01
Message: <web.43f2ddf6d2798c27a671bd170@news.povray.org>
kurtz le pirate <kur### [at] yahoofr> wrote:
> hi,
>
> i am trying to make a macro with one of parameters is "normal" like this
> #macro foo(.., .., thisNormal, ..)
>   ...
>   normal { thisNormal }
>   ...
> #end
>
> ok, works fine... but in some cases i don't want normal.
> how can i pass a "no-normal" or "empty-normal" parameters ?
>
> any ideas ?
>
> thanks.

If you prefer your own code (with thisNormal as a non-global declared
variable), you can use it like this, too:

camera {location <0,0,-4> look_at <0,0,0>}
light_source{<0,3,-10> rgb 1}
#macro foo (thisNormal)
  cylinder {-1,1,0.5
    texture {
      pigment {color rgb <1,1,1>}
      normal {thisNormal}
    }
  }
#end

foo(normal {function {0}})

object {foo(normal {marble 2 turbulence 0.5}) rotate -y*90}
object {foo(normal {marble 2 turbulence 0.5}) rotate y*135}

// function {0} means "no normal"


Post a reply to this message

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