POV-Ray : Newsgroups : povray.general : Is it possible to have optional arguments in macros. : Re: Is it possible to have optional arguments in macros. Server Time
30 Jul 2024 22:21:56 EDT (-0400)
  Re: Is it possible to have optional arguments in macros.  
From: Christian Froeschlin
Date: 29 Apr 2008 16:33:52
Message: <48178630@news.povray.org>
Bridgeofstraws wrote:

> I was wondering if it is possible to develop a way so that the M22 object may
> not necessarily need all 4 textures.  Whether it be by making optional macros
> or special if statements that compare textures (because I could make a null
> texture). 

One possibility would be to provide flags as explicit parameters as in

#macro M22_INTERN(USE_T1, T1, USE_T2, T2)
...
#if (USE_T1)
   texture {T1}
#end
...
#end

and provide convenience macro wrappers such as

#macro M22_1(T)
   M22_INTERN(true,T,false,T)
#end

#macro M22_2(T1,T2)
   M22_INTERN(true,T1,true,T2)
#end


But actually, I think in your case it is simply possible to write

#macro M22 (TextureList)
...
   object{CSGM22Chassis
   texture {TextureList}
...
#end

and calling it like

M22(texture {BodyTexture1} texture {BodyTexture2})


Post a reply to this message

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