POV-Ray : Newsgroups : povray.newusers : How to declare a look_like light_source with various colors? : Re: How to declare a look_like light_source with various colors? Server Time
2 Jul 2024 22:26:50 EDT (-0400)
  Re: How to declare a look_like light_source with various colors?  
From: clipka
Date: 28 Dec 2010 03:53:14
Message: <4d19a57a$1@news.povray.org>
Am 28.12.2010 05:15, schrieb JSmith:
> Hi Users,
>
> I would like to declare a light_source that looks_like a sphere.  My current
> code is:
>
> #declare flare =
>      light_source {
>          <0, 0, 0>
>          color Yellow
>          looks_like {
>              sphere {
>                  <0, 0, 0>, 0.01
>                  texture {
>                      pigment {color Yellow}
>                      finish {ambient 1.0 diffuse 0.0}
>                  }
>              }
>          }
> }
>
> I would like to be able to do something like:
>
> object { flare
>           pigment { color Red }
> }
>
> and the color of the light_source and sphere be red.  How might I go about doing
> this?

Looks like a job for a macro:

#macro Flare(C)
   light_source {
     ...
     color C
     looks_like {
       ...
         color C
       ...
     }
   }
#end

object { Flare(Red) }

See the docs for more details on macros.


Post a reply to this message

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