|
|
> #declare MyFn = function {
> #switch ( y )
> #case ( 1 )
> // funcion code 1
> #break // 1
> #case ...
> #end // switch
> }
>
> Parse Error: Float expected but vector or color expression found.
>
> Is there a vector function I can use to get they y component, MyFn.y, <y> or
> such?
Hmm... that's not gonna work.
The #switch executes at parse time, whereas the rest of the function
executes at trace time. In other words, you can use a switch that
depends on a constant defined somewhere else (e.g., animation frame
number), but *not* on a parameter to the function.
(The exact error you're seeing is because "y" has two meanings in
POV-Ray. Usually y = <0, 1, 0> - *except* inside functions, where "y"
suddenly means the 2nd parameter to the function. But only at trace
time, not parse time. Confused? POV-Ray is!)
Andrew @ home.
Post a reply to this message
|
|