|
![](/i/fill.gif) |
"Bridgeofstraws" <bri### [at] inbox com> wrote in message
news:web.4816ffbf42eefae121397d5a0@news.povray.org...
> Hello everyone,
>
> 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). Thank you for you time and help!
>
> The code of my macros is below.
>
> #macro M22 (BodyTexture1, BodyTexture2, ConeTexture, ImperfectionTexture)
> object{
> union{
> #switch(CSGOrIsosurface)
> #case(1)
> object{CSGM22Chassis
> texture {BodyTexture1}
> texture {BodyTexture2}
> texture {ConeTexture} //This is
> used
> with any texture to create a different coloured cone for the plane
> texture {ImperfectionTexture}
> translate z*15}
> ... snip ...
Hi,
I don't think you can 'compare' textures. However, A number of alternative
ideas do spring to mind to enable you to selectively use them, for example:
1. You could define a completely transparent texture and pass that into the
macro whenever you don't want to use an actual texture for that layer. e.g.:
#declare MyBlank = texture {pigment {rgbt 1}}
M22(MyBlank, MyBlank, texture {...}, etc...
2. You could use global identifiers instead of parameters, then test for
their existence within your macro e.g.:
#declare MyGlobalBodyTexture1 = texture { ...}
#macro M22 ()
... snip ...
object{CSGM22Chassis
#ifdef (MyGlobalBodyTexture1)
texture {MyGlobalBodyTexture1}
#end
#ifdef (MyGlobalBodyTexture2)
texture {MyGlobalBodyTexture2}
#end
... etc. ...
Making sure that at least one texture is always defined. You could do that
by using #ifndef to set a default texture whenever it hasn't been set
globally outside the macro call e.g.:
#ifndef(MyGlobalConeTexture)
#local MyGlobalConeTexture = texture {pigment {color Red}}
#end
> #break
> //--OR--
> #case(2)
> object{MeshM22Chassis
> //the next 2 lines, adjust for
> blenders
>
p.s. If you want to use the same textures for all of your different
possible chassis object definitions, you should be able to reduce your code
with:
object {
#switch(CSGOrIsosurface)
#case(1) CSGM22Chassis #break
#case(2) MeshM22Chassis #break
#else IsoM22Chassis
#end
texture {BodyTexture1}
texture {BodyTexture2}
... etc. ...
or by passing the object in as a parameter to the macro call, so that it
always has the same name.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |