POV-Ray : Newsgroups : povray.bugreports : Macro parameters with the same name : Macro parameters with the same name Server Time
8 Nov 2024 23:02:18 EST (-0500)
  Macro parameters with the same name  
From: Cousin Ricky
Date: 22 May 2023 14:02:55
Message: <646bae4f$1@news.povray.org>
I'm not sure how to categorize this, as it does not manifest with
properly constructed SDL; but it lets improper code render to completion
while leaving you scratching your head over why the image doesn't look
right.

Say you're developing a wood macro, and you start with:

  #macro MyWood
  ( Taper, Rings_map, c_Light, c_Dark,
    Grain_size, Roughness, Gnarl, Gnarl_size, v_Random
  )

It looks good, but you want to add varnish.  Your arguments are the
glossiness, the specular highlight roughness, and the varnish's index of
refraction:

  #macro MyVarnish (Glossiness, Roughness, IoR)

Finally, you think it would be convenient to combine the two macros into
one:

  #macro MyVarnishedWood
  ( Taper, Rings_map, c_Light, c_Dark,
    Grain_size, Roughness, Gnarl, Gnarl_size, v_Random,
    Glossiness, Roughness, IoR
  )

Do you see the problem?  I didn't--but neither did the POV-Ray parser.
When I combined the macros, I accidentally used the name 'Roughness' for
two different arguments.  I spent a week wondering why the final macro
didn't give the results I expected.  I think the parser should flag this
as a fatal error.


Post a reply to this message

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