POV-Ray : Newsgroups : povray.general : Issue with function parameters : Re: Issue with function parameters Server Time
3 Aug 2024 12:18:40 EDT (-0400)
  Re: Issue with function parameters  
From: Dan P
Date: 13 Feb 2004 18:29:40
Message: <402d5de4$1@news.povray.org>
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:402d3fac$1@news.povray.org...
> In article <402d339c@news.povray.org> , Florian Brucker
<tor### [at] torfboldcom>
> wrote:
<snip />

> However, even there the detailed differences between a "macro" and
variable
> are not really explained formally as they are a rather computer science
> based topic that is very hard to simplify and requires a heavy CS
background
> to really comprehend.

I'll take a shot at this one:

In the context of POV-ray, a #macro is just a convenient way to add more
code before it gets submitted to the rendering engine. For example, if you
call a #macro:

#macro Something(sweet)
  color rgb sweet
#end

Something (1)
...
It actually replaces the code before it renders the scene with:

color rgb 1
----

You just don't see that happen unless you generate files from POV-ray.

When you use a macro to make something like fur, it is actually making
thousands of thin little cylinders (or whatever depending upon how you
implement the fur) that you really couldn't hand-write unless you were a
masochist.

Variables are different -- when you are rendering, say, an isosurface, x, y,
and z in the call to the function change depending on the pixel POV-ray is
rendering at the time (not directly, though; it depends on where a straight
line from your eye intersects with the screen and object itself and the
pixel color depends on the light sources and material and... well,  it's
complicated, like Thorsten said).

Just think of #macros as a factory for writing code for you and variables as
something that gets evaluated for every pixel POV-Ray renders.

I know this is a simplification, but I think it gets the idea across.


Post a reply to this message

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