POV-Ray : Newsgroups : povray.newusers : How to print a color generated by a macro? : Re: How to print a color generated by a macro? Server Time
2 May 2024 17:20:37 EDT (-0400)
  Re: How to print a color generated by a macro?  
From: wealthychef
Date: 26 Aug 2014 18:35:01
Message: <web.53fd0a77246d976e784e7dc60@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 26.08.2014 04:30, schrieb wealthychef:
> > I want to print out the color my macro is returning somehow.
> > I've tried blah blah blah... FAIL
>
> "Returning" values from within control structures in a macro can be
> troublesome; try something like this:
>
>    #macro ColorFromBurgers(burgers)
>      #switch(burgers)
>        #range(-5,-1)
>          #local Result = rgb <141,211,199>/255.0;
>        #break
>        #case (0)
>          #local Result = rgb <255,255,179>/255.0;
>        #break
>        #case (10)
>          #local Result = rgb <190,186,218>/255.0;
>        #break
>      #end
>      Result
>    #end
>
>
> As for printing the result, remember that colours are vector-like
> beasts, so vstr() should do the job.

Thank you so much for the help!  Cheers.  That worked great.


Post a reply to this message

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