|
|
> Hmmm, then it is very strange because the values my script outputs are
> bad... because my OpenGL program reads them in the
> What-You-Have-Is-What-You-See.
>
> The problem is probably where the script writes to the disk...
I narrowed the problem and it is around my trace call...
I trace a ray from <X,2,Y> to <X,-2,Y> and any hit gets written to the
disk.
Now I checked if the hits I get have the same x and z values as my trace
line, and about 99% of them dont.
I checked for those that have inconsistent XZ values if the vector was
<0,0,0> and many of them are not...
So, with my current code as I understand it, the ray is diverted in
another direction somehow...
Now that I eliminate every inconsistent trace returns (such as <0,0,0>
and vector.x != X, etc...) I get only two good surface hit on my
object... The two of them are on X = 0 and Z = 0;
Here is my updated code... can someone help me find where the problem is?
BTW, I'm sorry to switch Y for Z, I'll clarify that in future posts...
#macro TraceRay(X, Y)
#if(!defined( myFile))
#error "Could not open temp.pov-stdout.txt"
#end
#write(myFile, " Y ", str(Y,5,2), " ")
#declare StartRay = <X,2,Y>;
#declare SurfaceTouch = StartRay;
#while(StartRay.y > -1)
#if(StartRay.x != X | StartRay.z != Y)
#error "Inconsistent XY"
#end
#declare SurfaceTouch = trace(MyObject, StartRay, <X, -2, Y>);
#if(SurfaceTouch.x = X & SurfaceTouch.z = Y)
#write(myFile str(SurfaceTouch.y, 0,3), " ")
// Good!
#else
#if(SurfaceTouch.x = 0 & SurfaceTouch.y = 0 & SurfaceTouch.z = 0)
#debug "Got no hit at all!\n"
#else
#debug concat("\nGot hit with inconsistent XZ values: ",
str(SurfaceTouch.x-X, 0, 10), "\n")
#end
// There was no hit, stop tracing...
#declare SurfaceTouch = <X,-2,Y>;
#end
#declare StartRay = SurfaceTouch;
#end
#write(myFile "E\n")
#end
--
Dedicated to audio/visual and interactive artwork.
Author of The Primary Colors of CSound:
http://www.geocities.com/simonlemieux/PCCS/index.html
Post a reply to this message
|
|