|
 |
Wasn't it Simon de Vet who wrote:
>My code is of the form:
>
>#macro PigmentFunc (n)
> #declare Pigment = pigment { bla bla n bla bla }
>#end
>
>I then try to call it by using:
>
>PigmentFunc (0.5)
>texture {Pigment}
>
>
>However, Pov still complains when it gets to the first line of the code which
>contains the n variable, saying "numeric expression expected but undeclared
>identifier 'n' found instead."
>
>Am I missing something fundamental here? Would there be any benifit in my
>posing the code?
The problem is somewhere else, in part of the code that you're not
describing. The syntax you describe above works perfectly for me, e.g.
#macro PigmentFunc (n)
#declare Pigment = pigment{rgb <n,n,0>}
#end
PigmentFunc (0.2)
sphere{-x,1
texture{Pigment}
}
PigmentFunc(0.5)
sphere{0,1
texture{Pigment}
}
PigmentFunc(0.9)
sphere{x,1
texture{Pigment}
}
Works perfectly, though it might have been simpler to code it more like
this:-
#macro PigFun (n)
rgb <n,n,0>
#end
sphere {y,1 texture{pigment{PigFun(0.1)}}}
sphere {-y,1 texture{pigment{PigFun(0.9)}}}
Are you using the official POVRay, or MEGAPov? There can sometimes be
strange behaviour in MEGAPov in the following circumstances:
If you declare a #macro inside a #while loop.
If you declare one #macro inside another #macro declaration.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
 |