POV-Ray : Newsgroups : povray.text.scene-files : Passing textures to MACROs : Passing textures to MACROs Server Time
28 Jul 2024 22:23:11 EDT (-0400)
  Passing textures to MACROs  
From: Rob Manley
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

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