POV-Ray : Newsgroups : povray.advanced-users : Can strings be used to create identifiers? : Re: Can strings be used to create identifiers? Server Time
26 Jun 2024 00:03:41 EDT (-0400)
  Re: Can strings be used to create identifiers?  
From: Kenneth
Date: 24 Feb 2014 19:20:05
Message: <web.530be09ee7c7ab47c2d977c20@news.povray.org>
Sorry for the delay in responding; I was giving some thought to your
suggestions.

Alain wrote:
>
> Write the generated names to an inc file. The generated files need to
> contain ONLY the name of a single array.
>
> Next, whenever you need to use one of the generated names, #include the
> corresponding file.

Yes, a nice idea; I didn't think of #writing the files. I see how this would
work; and I could then create an automated way of #read-ing back the #include
files (which I've done before.) Of course, I was *hoping* that all of the
automated identifier-naming could be done totally within my SDL scene-- just to
be more 'elegant' and self-contained. But that's a minor consideration.

Thanks!

>
> If you want to use color_vector_type as a substitute for rgb=, you need
> to define a macro.
>
> #macro color_vector_type()  rgb= #end
> pigment{color_vector_type() <.3,.6,.9>}

YES, that works; I tried it. (Actually just rgb, not rgb= ) That came as a
surprise; I have never used a macro in quite this way. In fact, it gives me
ideas on how to improve some of my old scenes.

Very helpful, and very much appreciated!

(IMO, something should be added to the documentation that describes this kind of
macro use. The idea of using a macro to insert a KEYWORD is not obvious there,
and it seems to be a rather powerful feature; it's the only way I know of at
present to do such a thing, since using a string doesn't work. *Maybe* it could
also be done by using a #read block, reading in a simple #written rgb, for
example. Just a guess.)


Post a reply to this message

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