POV-Ray : Newsgroups : povray.unofficial.patches : MegaPOV quirks and questions.. : Re: MegaPOV quirks and questions.. Server Time
2 Sep 2024 00:16:15 EDT (-0400)
  Re: MegaPOV quirks and questions..  
From: Nathan Kopp
Date: 24 Jul 2000 23:47:07
Message: <397d0dbb@news.povray.org>
Alex Vandiver <van### [at] tiacnet> wrote...
> Firstly, there seems to be some portability problems with
> respect to isosurfaces -- namely division by zero.  Rendering the
> following scene produces two completely different results under Linux
> and Windows.  Under the former, the result is pure black.  The latter
> spits out a while circle...

Yes.  I've known about this problem for a while now, but I don't know
exactly how to fix it (or even how it should be fixed exactly).

> The other, unrelated, quirk is that of nested macro definitions.  Why
> does MegaPOV specifically complain about them, and refuse to parse
> them?  Is there a workaround?  Because otherwise Chris Colefax's
> wonderful spline macro file is useless in MegaPOV..

Nested macro definitions are not necessary (and really should be avoided).
Programmers tend to think that nesting macro definitions is necessary (to
keep the "scope" of variables), but you need to remember that POV-Ray
scripting uses dynamic scoping rules, so that whether or not a variable
exists depends on when and where the code is RUN, not where it is DECLARED.
You can declare macros apart from each-other, and then just use them in a
nested way.

This...

#macro a()
  #macro b()
    // do stuff for macro b
  #end // macro b
  // do stuff for macro a
#end // macro a

...means the same thing as this...

#macro a()
  // do stuff for macro a
#end // macro a

#macro b()
  // do stuff for macro b
#end // macro b

...except that you can't do the first one in MegaPov.  You can simply
un-nest the nested macros and everything should work perfectly.

-Nathan


Post a reply to this message

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