POV-Ray : Newsgroups : povray.general : texture cross dissolve : Re: texture cross dissolve Server Time
1 Aug 2024 10:12:22 EDT (-0400)
  Re: texture cross dissolve  
From: Christoph Hormann
Date: 1 Nov 2005 07:54:50
Message: <dk7odk$nbh$1@chho.imagico.de>
Paul Bourke wrote:
> 
> My question now is how can I automate this texture handling without the 
> tedious in the way I'm doing it now, just repeating each declaration. 
> In the end I hope to have "hundreds" of textures.
> 
> So I will have one of these for each texture
> 
> #declare texture01 = texture { pigment { image_map { tga "textures/tex01.tga" once }
} finish { texfinish } }
> #declare texture02 = texture { pigment { image_map { tga "textures/tex02.tga" once }
} finish { texfinish } }
>    :
>    :
>    etc, 35 times

Use arrays:

#declare Textures=array[35]

#local Cnt=0;

#while (Cnt<35)
   #declare Textures[Cnt] =
     texture {
       pigment {
         image_map {
           tga concat("textures/tex",str(-2, 0, Cnt),".tga")
           once
         }
       }
       finish { texfinish }
     }
   #local Cnt=Cnt+1;
#end

(Untested - could contain errors)

Note you should be careful with using all lower case custom identifiers 
- if future versions of POV-Ray introduce keywords with the same name 
your scene will get incompatible.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 31 Oct. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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