|
|
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> I want to use an array inside a function, for example:
>
> function(x,y,z){MYARRAY[][]}
>
> I can hard code an array index, and it is fine:
>
> eg. function(x,y,z){MYARRAY[2][3]}
>
> , however I can't create an array index from a function. I get an error "Float
> expected but vector or color expression found"
>
> e.g. function(x,y,z){MYARRAY[max(min(int(x),9),0)][max(min(int(y),9),0)]}
>
> parsing the function inside the array indices we return valid integer indices,
> but it appears that POV is not parsing it this way: rather than precalculating
> the function using the "x" and "y" values from the function, it is seeing them
> as x and y vectors (<1,0,0>, <0,1,0>) which gives the error. Changing to a
> different reference from x,y,z eg.
>
> e.g. function(xx,yy,zz){MYARRAY[max(min(int(xx),9),0)][max(min(int(yy),9),0)]}
>
> results in an undeclared indetifier 'xx' error.
>
> I there some way I can work around this and force the function inside to be
> calculated into my index value before the array tries to parse it?
>
> -tgq
As far as I'm aware it simply can't be done. Functions and the SDL are basically
two completely different things that are interpreted at different times.
When I ran into this problem, I worked around it by stuffing my array values
into a spline, then did a spline lookup inside my function. Perhaps you can get
that trick to work for you too.
Cheers,
Edouard.
Post a reply to this message
|
|