POV-Ray : Newsgroups : povray.general : Details on layered textures/materials Server Time
24 Nov 2024 02:18:01 EST (-0500)
  Details on layered textures/materials (Message 31 to 31 of 31)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Chris R
Subject: Re: Details on layered textures/materials
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

<<< Previous 10 Messages Goto Initial 10 Messages

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