POV-Ray : Newsgroups : povray.beta-test : #include files in macros undefine the parameters : Re: #include files in macros undefine the parameters Server Time
29 Jul 2024 18:26:37 EDT (-0400)
  Re: #include files in macros undefine the parameters  
From: Tor Olav Kristensen
Date: 30 Mar 2002 13:31:08
Message: <3ca6046c$1@news.povray.org>
I have not tested your code, but I suspect that the
extra #end after your fnDimp declaration is
causing this trouble.

The macro declaration is ended prematurely.
And therefore this line:

#debug concat("Initializing ",op," data...\n")

- is actually outside the macro, where the op
parameter is not defined


Tor Olav


David Wallace <dar### [at] earthlinknet> wrote in message
news:3ca5c3aa@news.povray.org...
> Put this in one file,
> ----------------
> #macro MakePara(ip,op)
>  #include ip
>   #debug concat("Initializing ",op," data...\n")
> #end
>
> MakePara("stormdef.inc", "storm.inc")
> ----------------
> and this in "stormdef.inc"
> ----------------
> #declare uMin = 0; // Minimum u value
> #declare uMax = radians(180); // Maximum u value
> #declare uNum = 90; // Number of points in u direction
> #declare uWrap = 0; // u wraps around if != 0
> #declare uSeed = 2252; // Random number seed for u parameter
>
> #declare vMin = 0; // Minimum v value
> #declare vMax = radians(358); // Maximum v value
> #declare vNum = 180; // Number of points in v direction
> #declare vWrap = 1; // v wraps around if != 0
> #declare vSeed = 7335; // Random number seed for v parameter
>
> #declare IsRnd = false; // True if random number used
>
> #declare Detail = "Partial"
>
> // Optional variables and subfunctions
> #declare fnDimp = function { pattern {
>  granite
>  warp {
>   black_hole 0, 2
>   strength 0.4
>   inverse
>  }
> } } #end
>
> // point function
> #macro pnt(i, j, p, q)
>  #local rd = sin(i)*(sin(6*j)+1.1);
>   #local xp = rd*cos(j);
>   #local yp = cos(i);
>   #local zp = rd*sin(j);
>   #local dp = <9,2,9>*(1+fnDimp(xp,yp,zp)*.02);
>   #local pt0 = <xp,yp,zp>*dp;
>   #local pt1 = vrotate(pt0, y*rd*90);
>   pt1
> #end
>
> #declare Smooth = 0; // Smooth flag
> ----------------
> Bad things happen.  Specifically, I suspect that any attempt to include a
> file within a macro undefines the parameters sent to it.  Some of my more
> complex attempts were able to access the parameters just before but not
> after the include.
>
> Intel Beta 14, Duron 800MHz, 512MB DDR, Win98SE
>
>
>


Post a reply to this message

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