POV-Ray : Newsgroups : povray.general : string interpretation : string interpretation Server Time
31 Jul 2024 06:25:51 EDT (-0400)
  string interpretation  
From: Jim
Date: 17 Sep 2007 20:05:00
Message: <web.46ef14c6c496b69291227f400@news.povray.org>
I'm trying to create a sort of "catalog" of textures in the various standard
include files - for instance, "woods.inc" which defines T_Wood1 through
T_Wood35.

After setting up a simple test scene, I convert it into an animation so that
each texture is rendered in its own frame. I find myself wanting to define
the texture that is used based on the frame number thusly:

#declare textString = concat ("T_Wood",str(frame_number,2,0));
[...]
texture { textString }

That doesn't work. :(


So am I left with a hand-coded #switch statement with a series of #cases-
#case(n)
#declare MyTexture = texture{T_Wood<n>}
#break

There's no "casting" of a string to any other type. Or is there perhaps some
magic solution I'm not seeing?

The "woods" file is actually pretty easy to enumerate compared to some of
the others - so I'm really after a more general solution. I know I could
whip something up in Perl that would spit out scene files dynamically (and
of course call up POV with input from stdin) but I would like to keep
everything in the POV SDL if possible.

Thanks for any tips/hints anyone can offer.


Post a reply to this message

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