POV-Ray : Newsgroups : povray.newusers : Calling pre-defined textures with a concat generated string. Server Time
14 Nov 2024 02:22:57 EST (-0500)
  Calling pre-defined textures with a concat generated string. (Message 1 to 6 of 6)  
From: Alan Holding
Subject: Calling pre-defined textures with a concat generated string.
Date: 16 Jul 1999 16:11:43
Message: <378f91ff@news.povray.org>
Hello.

Is it possible to use a concat generated string to call a pre-defined
texture?

In other words, why doesn't this code ...

// counter is a declared float in a loop with current value of 1

#declare vasetex = concat ( "T_Gold_", str(counter,1,0), "A")

texture { vasetex }

...let me call the texture T_Gold_1A, which is a pre-defined texture in the
file "golds.inc"?

I've trawled through the Help file but can't find any clarification.

Apologies if the answer is staring me in the face.

Thanks,
Alan.


Post a reply to this message

From: Chris Huff
Subject: Re: Calling pre-defined textures with a concat generated string.
Date: 16 Jul 1999 16:28:06
Message: <378F96F4.9827A22@compuserve.com>
The problem is that vasetex is a string variable, not a directive. One
way to work around this is to make an array of the textures instead.
Another way would be to use the file directives to write the texture
string to a file, then include that file in the proper place.


Post a reply to this message

From: Peter Popov
Subject: Re: Calling pre-defined textures with a concat generated string.
Date: 16 Jul 1999 16:35:24
Message: <378f95e1.7233577@204.213.191.228>
On Fri, 16 Jul 1999 21:10:16 +0100, "Alan Holding" <spe### [at] hotbotcom>
wrote:

Hi Alan.

What you're trying to do is use a string constant where a texture
identifier should be used. This doesn't work. Recently I asked a
similar question and the general opinion was that it could be achieved
by adequate use of file input/output. Try this:

#declare vasetex = concat ( "T_Gold_", str(counter,1,0), "A")

#fopen F "tempfile.tmp" write
  #write (F, vasetex)
#fclose F

object { Vase texture { include "tempfile.tmp" } }

POV is currently heavily rendering so I haven't tried this, but I'm
pretty certain it should work.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Alan Holding
Subject: Re: Calling pre-defined textures with a concat generated string.
Date: 16 Jul 1999 18:21:38
Message: <378fb072@news.povray.org>
Hello, Peter.

Thanks to you and Chris Huff everything is working fine now!  (Just had to
change the 'include' to '#include' in the code you supplied.)

I've now got five lovely shiny golden vases.  And the potential to do all
kinds of crazy string manglin' madness!

Thanks again,
Alan.

--
http://www.specto.ukf.net/
Another pointless website.


Post a reply to this message

From: Peter Popov
Subject: Re: Calling pre-defined textures with a concat generated string.
Date: 16 Jul 1999 22:44:42
Message: <378fecbc.1472982@204.213.191.228>
On Fri, 16 Jul 1999 23:21:28 +0100, "Alan Holding" <spe### [at] hotbotcom>
wrote:

>Hello, Peter.
>
>Thanks to you and Chris Huff everything is working fine now!  (Just had to
>change the 'include' to '#include' in the code you supplied.)

<hides in a corner>

Puhleeease forgive my poor soul

<pulls out a pocket knife and commits sepuko>

Seriously, sorry about that. I either have to have more coffee when I
post or put a reminder somewhere that there's always the F7 key. Too
bad it does not help for POV code :(

>I've now got five lovely shiny golden vases.  And the potential to do all
>kinds of crazy string manglin' madness!

When are we going to see them?

>Thanks again,
>Alan.

Anytime.

<runs spell checker before hitting 'send'>
<it coughs on 'sepuko' :)>


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Alan Holding
Subject: Re: Calling pre-defined textures with a concat generated string.
Date: 17 Jul 1999 05:59:38
Message: <3790540a@news.povray.org>
Peter Popov wrote in message

>When are we going to see them?


I've posted it to povray.binaries.images, though it's not that brilliant.
I'm still very new to POV-Ray and it's taking me a while to get my brain
round all the maths.  ;->

The post in p.b.i. is called 5 Gold Vases - 1st image.

Thanks,
Alan.


Post a reply to this message

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