POV-Ray : Newsgroups : povray.general : how to call multiple instances of a macro? : Re: how to call multiple instances of a macro? Server Time
30 Jul 2024 12:30:38 EDT (-0400)
  Re: how to call multiple instances of a macro?  
From: clipka
Date: 11 Mar 2009 22:05:00
Message: <web.49b86bb4dc08335801985dd0@news.povray.org>
-------------
#macro lamp1(location,pointat,brightness)
  light_source{...}
#end

#macro lamp2(location,pointat,brightness)
  light_source{...}
#end

.....

#macro ParseLiteral(s)
  #local FileName = "ParseLiteral_$$$.inc";
  #fopen ParseLiteral_FD FileName write
  #write (ParseLiteral_FD, s)
  #fclose ParseLiteral_FD
  #include FileName
#end

#macro stringOfLights(Lamp,Center,Brightness)
  #local i=1;
  #while(i<10)
    ParseLiteral(Lamp) (Center+i*x,Center+i*x+<point_vector>,Brightness)
    #local i=i+1;
  #end
#end

stringOfLights("lamp1",<1,2,3>,10)

#local i=rand(R)*10;
stringOfLights(concat("lamp", str(i,0,0)),<4,5,6>,10)

-------------

POV SDL may be cumbersome at times, but let nobody say it wasn't flexible...


Post a reply to this message

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