POV-Ray : Newsgroups : povray.general : Order of texture and pigment matter? : Re: Order of texture and pigment matter? Server Time
30 Jul 2024 22:18:53 EDT (-0400)
  Re: Order of texture and pigment matter?  
From: wealthychef
Date: 13 May 2008 12:30:00
Message: <web.4829c11eb71ebc3b4a296dd40@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> > Care to expand on that a little?  Why wouldn't it work?   What is going
> > on?
> > Clue, please.  :-)
>
> POV finds a finish identifier, not a finish statement,
> identifiers and statements aren't interchangeable.
> It expects usage like ...
>
> #declare testfinish = finish {ambient 0.7};
>
> triangle {
>     v0, v1, v2
>     texture {
>       pigment { Red }
>       finish { testfinish }
>     }
> }
>
> Declare statements shouldn't be confused with macros.
> A macro substitutes the lines directly into the calling
> code instead of using identifiers. Example...
>
> #macro testfinish() finish {ambient 0.7} #end
>
> triangle {
>     v0, v1, v2
>     texture {
>       pigment { Red }
>       testfinish()
>    }
> }
>
> Here testfinish() is replaced by "finish {ambient 0.7}"
> which is a finish statement instead of a finish identifier.

thank you.  This point has been confusing me for years about Povray, as I only
occasionally dabble in it.  So it seems as though in a #declare statement, the
"finish {ambient 0.7}" piece is somehow compiled (?) into a "finish
identifier?"   What is the difference between an identifier and a statement?
Is this true:  "finish" is to "identifier" in Povray as "integer" is to
"variable" in C?
Aha! I think I get it:

If I were to say
#declare testtexture texture { pigment {Red} finish {ambient 0.7} };

I then use it like this:

triangle {
v0,v1,v2
 texture {testtexture}
}

Thank you.  It's interesting and revealing.


Post a reply to this message

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