POV-Ray : Newsgroups : povray.general : Details on layered textures/materials : Re: Details on layered textures/materials Server Time
3 May 2024 09:56:29 EDT (-0400)
  Re: Details on layered textures/materials  
From: Chris R
Date: 8 Apr 2024 12:05:00
Message: <web.6614152f5a557964549645b25cc1b6e@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 7-4-2024 om 16:38 schreef Bald Eagle:
> > Now THAT is weird.
> >
>
> OK. "Solved" that one I guess.
>
> I noticed earlier in the code provided by Chris, that /inside/ the
> (sub-) macros he used a semicolon to end a texture. The original code of
> the granite macro did not have those and - iirc - they were not used as
> such any more since... POV-Ray 3.5? 3.6?
>
> Anyway, you can safely delete one of the two M_Granite textures,
> provided that you add a semicolon at the end of the declaration (and
> before invoking the texture obviously) like this:
>
> #declare M_Granite =
> texture {
>    //interior {ior 1.6}
>    #if (Pol) //polished
>      #if (Type=off)
>        T1_GranitePol
>      #else
>        T1_GranitePol
>        T2_GranitePol
>      #end  //Type
>    #else //frosted
>      #if (Type=off)
>        T1_GraniteFro
>        Crand(0.25)
>        //Tcrand
>      #else
>        T1_GraniteFro
>        T2_GraniteFro
>        Crand(0.25)
>        //Tcrand
>      #end  //Type
>    #end  //Pol
>    scale M_scale
>    rotate M_rotat
>    translate M_trans
> } //texture
> ;
>
> M_Granite
>
>
> So that seems to be solved although I do not understand /why/ or
> /how/... :-(
>
> --
> Thomas
The semi-colon at the end of the texture declaration I understand.  I do this
all the time when I create macros that generate texture identifiers.  If you
don't put the semicolon in, the parser assumes you are creating a layered
texture, with the second layer being "M_Granite", which is an undeclared
identifier.

In all of the macros I create for textures, the template is the following to
avoid that parsing problem:

#macro Create_texture()
   #local _t = texture {
   };

   _t
#end

-- Chris R


Post a reply to this message

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