|
|
Hi,
I have some problems in understanding the function of SDL and want help.
The problems are illustrated by examples stated below.
Examples:
(1) It's a function that works properly to define a sphere with a given
radius .
#declare fun1 = function(x,y,z,r){
x*x + y*y + z*z - r*r
}
It gives me an understanding that:
<1> (x,y,z) are coordinates of a point in scene space
<2> x,y,z,r are all floats
Is that right???
(2) It's a function that use x as a float value in a conditional
statement, but it canna pass parsing
#declare fun2 = function(x,y,z,r){
#if (x>0)
x*x + y*y + z*z - r*r
#end
}
In this function, i want use x to do a conditional comparison, but pov
will give an error "Float expected but vector or color expression found". I
canna understand why x becomes into a vector here whilist x works like a
float value in fun1().
And if i modify "#if (x>0)" to "#if (x.x > 0)", the x.x will always be 1.
That means the x is the system-defined vector <1,0,0> but not a parameter.
I'm confused.
(3)
#declare fun3 = function(x,y,z,r){
#if (r>0)
x*x + y*y + z*z - r*r
#end
}
Running it, the pov will say error "Expected numeric expression.
undefined identifier 'r'".
Is there a way in SDL to pass parameters to a function like the common
programm language such as c++?
I know SDL is just a description language that canna have the power like
programming language. but in my scene, i need use coordinates of points in
scene space to do conditional comparison in the function of iso-surface,
like in fun2(). How should i do? Any help will be appreciated
Post a reply to this message
|
|