|
|
For my recent and continuing 'city buildings' scene, I needed a way to load a
bunch of consecutively-numbered image_maps into an array. The only things that
change in the image_map titles are their numbers. Like...
my image 1 example (with, say, a .jpg extension)
my image 2 example
etc.
So I came up with some string-code to make the task very easy, which might be
useful to others here. (If you have already done this kind of thing previously,
please ignore-- you are smarter than I am!)
For, say, 50 different image_maps...
#declare MY_ARRAY = array[50]; // to create the initial empty array-- the index
is from zero to 49
#for(i,1,50)
#declare MY_STRING =
concat("my image"," ",str(i,0,0)," ","example.jpg")// the i is the re-created
image number. Note the added spaces between the extra double-quotes, to match
the image titles.
#declare MY_ARRAY[i - 1] =
pigment{image_map{jpeg MY_STRING interpolate 2}}
#end
Of course, you could further simplify the #for loop by inserting the entire
concat(...) string into the pigment itself, eliminating the
#declare MY_STRING = ...
To use an image_map later...
pigment{MY_ARRAY[27]}
Post a reply to this message
|
|