Patrick Quirk wrote:
Great! I shamelessly modified one of your scripts to change the view on command.
That's what it's there for ... :-)
I had a thought about the viewer class that Jim Wilson pointed me to. Is all the HPR information contained in the VIEW matrix? Is there anything else included in it? If not, could I not just make a matrix from gluLookAt and stick that in for the view matrix instead? Surely there's something wrong with doing it this way, it'd be too easy...
I'm talking "data free" here now which I probably shouldn't be (but I'm at work so I don't have an hour to dig in and refresh my memory.) I think we have a lookat viewer mode so it might be worth looking through that to see how they do the matrix stuff. You might also look through the code that calculates the (sun) light vector and figures out how to align the sky. There could be something useful in there.
I'm a bit surprised though. Is your source application already using the FlightGear coordinate system? That seems somewhat unlikely to me which would mean you are probably doing some work to get a lookat and up vector in the FG world coordinate system, no?
If you want to hack something out yourself, you could observe that if you project the lookat vector onto the local horizontal plane, you should be able to extra heading pretty trivially from that. Perhaps you could use the relative length of the projected vector to get pitch? And maybe you could do something similar for roll by projecting the up vector onto the local horizontal plane. We do something sort of similar to compute sky dome orientation (relative to sunrise/sunset effects.) We have a sunlight vector (similar to a lookat vector) and we need to project that onto the local horizontal plane to determine the ground local heading towards the sun. This gives us a rotation angle so we can alighn the redish part of the sky with the sun location when doing sunset/rise effects.
There's probably a saner way to do what you want and compute it more directly, but I'll have to defer to the experts on that. :-)
Curt. -- Curtis Olson http://www.flightgear.org/~curt HumanFIRST Program http://www.humanfirst.umn.edu/ FlightGear Project http://www.flightgear.org Unique text: 2f585eeea02e2c79d7b1d8c4963bae2d _______________________________________________ Flightgear-devel mailing list [email protected] http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
