POV-Ray : Newsgroups : povray.general : Question About Macros : Re: Question About Macros Server Time
11 Aug 2024 05:12:26 EDT (-0400)
  Re: Question About Macros  
From: Remco de Korte
Date: 14 Oct 1999 17:51:21
Message: <38065081.FB55C864@xs4all.nl>
Andrea Ryan wrote:
> 
> Where can I find information on these temple include files? I want default values.
> Brendan Ryan
> 
> Remco de Korte wrote:
> 
> > Andrea Ryan wrote:
> > >
> > >     Is it a good idea to include transformations in macros like:
> > >
> > > #macro MakeBall (translatex, translatey, translatez, scalex, scaley,
> > > scalez, radius)
> > > sphere { <translatex, translatey, translatez>,radius
> > > scale <scalex, scaley, scalez>
> > > texture {...}
> > > }
> > > #end
> > >
> > > or let others add object statements and transformations?
> > > Brendan Ryan
> >
> > There's a limit to the amount of parameters a macro can handle (I soon found
> > out).
> > It's also not easier to work with a macro that only needs a few essential
> > parameters.
> > For instance, if a macro just declares an object you can easily scale, rotate or
> > translate it outside that macro by including it in an object statement, leaving
> > the essentials to the actual macro-declaration. To turn things round: you can
> > add the most redundant parameters to a macro and it will still work (in the
> > example of the object-macro you could add parameters declaring ground_fog,
> > sky_sphere etc. - of course these might also be meaningful to the macro).
> >
> > If you _need_ a lot of parameters it's also an idea to pass those in an
> > include-file.
> > You could use a template-include with default values... eeh... oh well, this is
> > not what you asked, never mind.
> >
> > Remco

This is way off what you probably want, but here is a little description of what
I meant. It's from real life, by the way...

If you have a macro which needs heaps of parameters you can also put all those
parameters in one include file and pass the name of that include as parameter.
The inc-file would only have a series of declarations for each parameter-value
for your macro. This makes it easier to keep track of what you're doing in case
you're experimenting with different settings.
You could create one include with values for each parameter you set as default.
To make it more complicated you could put each declaration in a
#ifndef-statement so the macro will (only) use the default value for those
parameters you haven't defined elsewhere.
Do you still follow? Well, I have a hard time, but I have to since I work with a
model that works this way. I have dozens of data-include-files, each with their
own set of parameter-values, overriding the default-values from another file.
If you lose track you easily get conflicts with redeclarations.

By the way: I wouldn't want anyone else to have to work with this clutter of
includes of mine. You would probably declare me mad (or inefficient).

Remco


Post a reply to this message

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