POV-Ray : Newsgroups : povray.newusers : #declare/Object coloring question : Re: The macro itself :) Server Time
4 Nov 2024 13:00:49 EST (-0500)
  Re: The macro itself :)  
From:
Date: 18 Sep 2003 16:45:09
Message: <3f6a1955$1@news.povray.org>
Declaration of MyTorus is not neccessary (and #local instead of
#declare would avoid introduction/overwriting of variables in the
main scene). My favourite method is like this:



#macro MyTorusMacro (LightColor)

#local I = 0;
#local N = 10;

union {

  // ... whatever ...

  // *no* closing brace! This makes application of *all* object
  // modifiers possible in the main scene, even bounded_by, no_image.
  // 'Match Brace' in the Search menu (and human readers) will *not*
  // be irritated by this omission if the brace appears in a comment
  // instead of beeing omitted completely, like in the following line:

  // "}" of union omitted to allow application of modifiers!

#end// macro MyTorusMacro



Call such macros in this way:

MyTorusMacro (Blue) /*{*/ scale ... rotate ... translate ... }



The commented-out opening brace isn't neccessary for parsing but
avoids irritation of 'Match Brace'. Normally I would call it a
bug to match a brace within a comment or inside a string with a
brace outside; in this case although I'm quite happy with this
behaviour.

   Sputnik


Post a reply to this message

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