POV-Ray : Newsgroups : povray.binaries.images : Woven Cloth Texture : Re: Woven Cloth Texture Server Time
31 Jul 2024 14:35:04 EDT (-0400)
  Re: Woven Cloth Texture  
From: Dave Blandston
Date: 17 Feb 2010 08:50:01
Message: <web.4b7bf3a8adaa4c5ecba3fb0f0@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote:
> Forgive my confusion/ignorance, but I see the same pigment name P_Cloth
> declared three times successively and still the result is correct. How is
> this possible without parse confusion?
>
> Thomas

Here's a simple computer programming example to show how and why this works:

   x = 1;
   .
   .
   .
   x = x + 1;

In this case, the variable "x" is assigned a value (1), then later it's assigned
a new value based on the old value. This works because when the new value is
assigned, a temporary copy is made of the old value, manipulated (in this case 1
is added), then re-stored in the original location and becomes "x" again.
"P_Cloth" is just a more complex variable that can be manipulated like any
simpler variable. The restriction would be that once "P_Cloth" is defined as a
pigment it must remain a pigment.

This can be a useful technique to make your scenes more readable, and also more
efficient by not leaving intermediate variables laying around.

Regards,
Dave Blandston


Post a reply to this message

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