POV-Ray : Newsgroups : povray.newusers : #declare inside a loop - name depending on counter? : Re: #declare inside a loop - name depending on counter? Server Time
28 Jul 2024 16:31:49 EDT (-0400)
  Re: #declare inside a loop - name depending on counter?  
From: Blue Herring
Date: 10 Jun 2008 09:07:14
Message: <484e7c82$1@news.povray.org>
Chris B wrote:
> Sounds to me like you would be better off using arrays:
> 
> #declare ClockX = array[100];
> #declare SomeCounter = 0;
> #while (SomeCounter <100)
>   ....
>   #declare ClockX[SomeCounter] = ...  ;
>   #declare SomeCounter = SomeCounter + 1;
> #end
> 
> The only way that I know of doing precisely what you asked for is to create 
> a string using the concat function that you write out to a file, then 
> #include the file on the following line so that it gets parsed. I think 
> there is a function somewhere to do this for you, but it obviously 
> introduces additional disk IO that can slow your render down.

The Parse_String macro in strings.inc does this for you.  However, I 
would agree with you that I don't see a good reason to use this instead 
of arrays in this circumstance.

-- 
-The Mildly Infamous Blue Herring


Post a reply to this message

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