POV-Ray : Newsgroups : povray.general : string code to load consecutive image_maps into array : Re: string code to load consecutive image_maps into array Server Time
16 Apr 2024 17:53:43 EDT (-0400)
  Re: string code to load consecutive image_maps into array  
From: Kenneth
Date: 10 Oct 2020 11:25:00
Message: <web.5f81cc6229a401ccd98418910@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

>
> #macro mkPigment(i_)
>   pigment {image_map {jpeg concat("my image ",str(i_,0,0)," example.jpg")
> interpolate 2}}
> #end
>

Oops, I just noticed the difference between this macro and my array idea-- the
macro doe not actually pre-#declare the image, whereas the array does. The main
reason for the initial  ARRAY is that it essentially #declares all of the images
at the outset-- and its main 'reason for being' is that the various images might
be used *repetitively* in a scene (which I forgot to mention!) Pre-#declaring
the images saves a tremendous amount of RAM memory later, when the array
elements are called. Their repetitions are essentially 'instances' of the
image_maps, with little to no increase in memory use.  The macro, on the other
hand, would load the image into memory every time it's invoked.

For the macro, I came up with a slight change which *might* make it work
likewise... but I don't think so:

#macro mkPigment(i_)
#declare IMG =
pigment {image_map {jpeg concat("my image ",str(i_,0,0)," example.jpg")
interpolate 2}}
IMG
#end

That would just re-#declare the image for each macro call, with the same(?)
memory increase...unless each 'newly-#declared' identical IMG just takes the
place of the previous one in memory?


Post a reply to this message

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