POV-Ray : Newsgroups : povray.general : #macro question : Re: #macro question Server Time
7 Aug 2024 09:27:09 EDT (-0400)
  Re: #macro question  
From: Ron Parker
Date: 11 Oct 2001 09:20:13
Message: <slrn9sb74e.chi.ron.parker@fwi.com>
On 11 Oct 2001 05:40:58 -0400, Warp wrote:
>Kevin Loney <klo### [at] pt2mcom> wrote:
>: second question, is there anyway to set up a refernece parameter in a macro?
>
>  For what purpose?
>
>  (Macros are not functions, so parameters are not passed by value anyways...)

Well, they are and they aren't.  Parameters are references unless they can't
be a reference.  This:

#macro Foo(A)
  #declare A=5;
#end

#declare B=10;
#declare C=20;
Foo(B);
Foo(0+C);

leads to two different results.  B gets set to 5, but C gets left alone, 
because "B" can be passed as a reference but the expression "0+C" can't.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

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