POV-Ray : Newsgroups : povray.text.scene-files : Passing textures to MACROs Server Time
29 Jul 2024 00:23:49 EDT (-0400)
  Passing textures to MACROs (Message 1 to 3 of 3)  
From: Rob Manley
Subject: Passing textures to MACROs
Date: 2 Mar 1999 16:56:25
Message: <36dc5e89.0@news.povray.org>
Hi

(Pov-Ray for Windows 3.1a)

I'm trying to pass a pigment (or texture, etc) to a Macro, but I can't get
it to work. The manual seems to indicate that it should be possible. Can
anyone tell me why the first example (below) works, but the second doesn't.

I know that neither do anything very interesting, but that's not the point
......

Thanks very much

Rob
(rob### [at] manleysfreeservecouk)

// Example 1
#declare MyBox = box {<-5,0,0>,<5,0.25,4>}

#macro StackBoxes ()
        #declare Count = 0;
        #while (Count < 5)
                object { MyBox
                         pigment {colour rgb <1,0,0>}
                         translate y*0.25*Count
                }
                #declare Count = Count + 1;
        #end //while
#end //macro

light_source
{
  0*x
  color rgb <1,1,1>
  translate <-20, 40, -20>
}

camera
{
  location  <0.0 , 5.0 ,-10.0>
  look_at   <0.0 , 0.0 , 0.0>
}


background { color red 0.1 green 0.3 blue 0.8 }

StackBoxes ()

/*****************************************************************/

//Example 2

#declare MyBox = box {<-5,0,0>,<5,0.25,4>}

#declare MyColour = pigment {colour rgb<1,0,0>}

#macro StackBoxes (Appearance)
        #declare Count = 0;
        #while (Count < 5)
                object { MyBox
                         Appearance
                         translate y*0.25*Count
                }
                #declare Count = Count + 1;
        #end //while
#end //macro

light_source
{
  0*x
  color rgb <1,1,1>
  translate <-20, 40, -20>
}

camera
{
  location  <0.0 , 5.0 ,-10.0>
  look_at   <0.0 , 0.0 , 0.0>
}


background { color red 0.1 green 0.3 blue 0.8 }

StackBoxes (MyColour)

//END


Post a reply to this message

From: David Wilkinson
Subject: Re: Passing textures to MACROs
Date: 2 Mar 1999 17:56:41
Message: <36dc6b9f.23064084@news.povray.org>
On Tue, 2 Mar 1999 21:58:41 -0000, "Rob Manley"
<rob### [at] manleysfreeservecouk> wrote:

>Hi
>
>(Pov-Ray for Windows 3.1a)
>
>I'm trying to pass a pigment (or texture, etc) to a Macro, but I can't get
>it to work. The manual seems to indicate that it should be possible. Can
>anyone tell me why the first example (below) works, but the second doesn't.
>
>I know that neither do anything very interesting, but that's not the point
>......
>
>Thanks very much
>
>Rob
>(rob### [at] manleysfreeservecouk)
>
>// Example 1
>#declare MyBox = box {<-5,0,0>,<5,0.25,4>}
>
>#macro StackBoxes ()
>        #declare Count = 0;
>        #while (Count < 5)
>                object { MyBox
>                         pigment {colour rgb <1,0,0>}
>                         translate y*0.25*Count
>                }
>                #declare Count = Count + 1;
>        #end //while
>#end //macro
>
>light_source
>{
>  0*x
>  color rgb <1,1,1>
>  translate <-20, 40, -20>
>}
>
>camera
>{
>  location  <0.0 , 5.0 ,-10.0>
>  look_at   <0.0 , 0.0 , 0.0>
>}
>
>
>background { color red 0.1 green 0.3 blue 0.8 }
>
>StackBoxes ()
>
>/*****************************************************************/
>
>//Example 2
>
>#declare MyBox = box {<-5,0,0>,<5,0.25,4>}
>
>#declare MyColour = pigment {colour rgb<1,0,0>}
>
>#macro StackBoxes (Appearance)
>        #declare Count = 0;
>        #while (Count < 5)
>                object { MyBox
>                         Appearance
>                         translate y*0.25*Count
>                }
>                #declare Count = Count + 1;
>        #end //while
>#end //macro
>
>light_source
>{
>  0*x
>  color rgb <1,1,1>
>  translate <-20, 40, -20>
>}
>
>camera
>{
>  location  <0.0 , 5.0 ,-10.0>
>  look_at   <0.0 , 0.0 , 0.0>
>}
>
>
>background { color red 0.1 green 0.3 blue 0.8 }
>
>StackBoxes (MyColour)
>
>//END
>

In the second example you are passing a pigment identifier without
stating it is a pigment.  The POV-Ray diagnostic says it all. This
works;

                object { MyBox
                         pigment { Appearance }
                         translate y*0.25*Count
                }

David
------------
dav### [at] cwcomnet
http://www.hamiltonite.mcmail.com
------------


Post a reply to this message

From: Rob Manley
Subject: Re: Passing textures to MACROs
Date: 4 Mar 1999 14:16:28
Message: <36dedc0c.0@news.povray.org>
David Wilkinson wrote in message :
>In the second example you are passing a pigment identifier without
>stating it is a pigment.  The POV-Ray diagnostic says it all. This
>works;
>
>                object { MyBox
>                         pigment { Appearance }
>                         translate y*0.25*Count
>                }
>
>David
>------------
>dav### [at] cwcomnet
>http://www.hamiltonite.mcmail.com
>------------

Thanks David, I had it in my head that by declaring the actual parameter as
a full pigment statement, the pigment keyword was not required again in the
macro body.

Cheers

Rob


Post a reply to this message

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