Page 1 of 5

oolite cockpit/increasing the viewing angle

Posted: Tue Dec 11, 2012 7:25 pm
by Blecha
So I am fairly new to oolite but no less obsessed. I have been wanting to build a cockpit for FPV airplanes and general flight stuff but I am actually in the serious planning stages now. With most flight sim software you can fairly easily tweak it to work with a curved screen and projectors, oolite on the other hand is locked in to its default viewing angle. I am a fairly proficient C and python coder so I would probably end up digging into this at some point regardless of difficulty but I wanted to see how hard you folks thought it would be before I start buying expensive hardware. So here are my questions:

What sections of code would I want to start looking at to adjust the viewing angle?

Are there any inbuilt issues with changing this?

Is it even "possible" with the current codebase to go up to say 180 degrees? 220? 360?

Thanks to anyone who can help point me in the right direction :)

Re: oolite cockpit/increasing the viewing angle

Posted: Wed Dec 12, 2012 9:41 am
by another_commander
I believe the best place to start looking for field of view modifications would be GameController.m, method - (void)setUpBasicOpenGLStateWithSize:(NSSize)viewSize, particularly the glFrustum call line. With some very crude, quick and dirty experiments, it seems that it is relatively straight forward setting the FOV to values other than the default. Here is one screenie taken at Lave with a FOV set close to 180 degrees.
Image
For angles higher than this, we seem to be getting some positioning and depth buffer issues (mainly objects popping in/out of existence, exhausts misplacement etc.). Also the scanner gets scaled together with the view depending on selected FOV, which is not what we really want, but for the purposes of testing and proof of concept, this much should be good enough for now.

Edit to add: Topic moved to Discussion, as it is not Linux specific.

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 11:50 am
by Day
Hi everybody,

here is a new Jameson having flown only some short hours, with most OXZ activated.

I would find really useful to be able to modify via oxp the viewing angle.
I went to see into the code, and what it would take for this is to make writable by oxp the variable GameController.setUpBasicOpenGLStateWithSize.ratio, currently fixed to 0.5.

Currently, this gives (if i'm doing it correctly) a viewing angle of 2*Tan-1(ratio=0.5/1) = 53° for the vertical axe.
The angle for the horizontal axe depends on the geometry of your screen.

I look forward to having some equipments upgrade allowing to have a greater angle of view :-)
And better still, an angle of view depending on the current activity, for example greater when in jump mode :-)

Would this be possible?

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 2:16 pm
by another_commander
Changes that occurred in the rendering code after my initial message seem to have complicated things a bit. At the moment of writing this, I am not able to change the field of view just by changing the ratio value in trunk.

But even if it worked, it would still need plenty of fine tuning, as you don't really want the scanner to follow changes in the FOV. The side effects with objects popping up and disappearing at certain ratio values would also have to be fixed. So it needs some work. It would be quite interesting to have FOV set via preferences or OXP methods, provided that it gets done properly and not as a quick hack (which what changing ratio really was).

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 2:44 pm
by Day
Hi another_commander, thanks for answering.

Well, I wasn't aware of it as I just got a quick view in this method, but you're right if some things like the scanner are related to the FOV, then the change is not obvious.

Oh well, i guess i'll have to wait for the time this idea is considered top of TODO :-p

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 2:51 pm
by Cody
G'day, Day - welcome aboard!

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 2:52 pm
by another_commander
@Day: If you would like to give it a try by all means go ahead! Patches with improvements are more than welcome and we can help with questions that may pop up along the way.

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 3:00 pm
by Day
@Cody: thank you, Cody :-)

@another_commander: well, i'm proficient in a number of languages, but not in C or objective-C :-/
Is there somebody in the dev team working on linux? What is the config they use? Eclipse like in http://wirecode.blogspot.fr/2007/11/obj ... lipse.html ?

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 3:07 pm
by another_commander
Day wrote:
Is there somebody in the dev team working on linux? What is the config they use? Eclipse like in http://wirecode.blogspot.fr/2007/11/obj ... lipse.html ?
OTOH cim, kanthoney, submersible and quite often Getafix all work on Linux. I'm sure one (or more) of them will be here soon to help with your question.

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 3:16 pm
by Cody
another_commander wrote:
... cim, kanthoney, submersible and quite often Getafix all work on Linux.
The Penguinistas have taken over the asylum!

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 3:25 pm
by Smivs
An asylum as a refuge for the sane - interesting concept :)

...and welcome, Day.

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 3:29 pm
by Day
Thank you Commander Smivs :-)

Re: oolite cockpit/increasing the viewing angle

Posted: Tue Mar 03, 2015 6:10 pm
by cim
Day wrote:
Is there somebody in the dev team working on linux? What is the config they use? Eclipse like in http://wirecode.blogspot.fr/2007/11/obj ... lipse.html ?
Nothing so fancy here - emacs to edit the source code, and a terminal window to type 'make' into to build it. (And another terminal window to type 'grep' into if I forget which file something is in)

Re: oolite cockpit/increasing the viewing angle

Posted: Wed Mar 04, 2015 1:24 am
by Diziet Sma
G'day, Day! Welcome aboard.. 8)

Not a member of the dev team, but for my modest needs, I use Smartgit (or sometimes just git in a terminal), Geany as my editor, and a terminal window for make, etc..

Just go with whatever IDE you're comfortable/familiar with, would be my suggestion.

Re: oolite cockpit/increasing the viewing angle

Posted: Wed Mar 04, 2015 9:31 am
by Day
Hi and thanks, cim and Diziet Sma :-)

Ok, I'll take the easier path for me, it should be Eclipse now.