Matthieu LABAN
.NET, My Life, Flight Simulation and Real Flight...

 
About Me :
25 Years old developer and aviation
enthusiast living in Santa Clara, California.
View Matthieu Laban's profile on LinkedIn 
Contact me at :
mlaban at gmail dot com


Photo & Video Galleries:
- Gallery List
- Flight Videos
Resume :
e-mail me to get my latest résumé
Panel Gauges with Dynamic Textures 

[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]

Cessna 421 - New envmap and Specular Ligthing

As some of you have noticed, on the latest screenshots of the game, was an attitude indicator gauge on the lower left corner of the screen. The placement of this instrument  was becoming annoying so I decided I would put it at its proper place that is, inside the cockpit, screwed to the instrument panel.

To create an instrument, I had to go through a few steps.

1 - Create an object in the model editor (A plane, with a dummy texture)
2 – Assign an xml tag to this object. This tag contains the name of the gauge class to use on this particular object. The texture of the gauge will replace the dummy texture.
3 – Load the airplane, and find all objects that reference a gauge in their xml properties
4 – Load the specified gauges from the code
5 – Every interval (1 second by default), call the Paint() method of every gauge, for them to update and render their stuff on their internal bitmap.
6 – After the Paint() call, copy each gauge bitmap to dynamic textures
7 – At 3D object rendering, replace the dummy texture by the gauge dynamic texture.

Two great things about this:
- I can place a gauge almost anywhere on the airplane.
- The drawing part is done with GDI+ so I don’t need to implement some sort of API for drawing stuff in gauges.

One thing that I fear:
- I don’t know how this will behave with lots of gauges
- I already know that big textures (>512) slow the game during the copying from system memory to video memory. That’s why I do this every 1 second. So far, I have not witnessed any slow downs with current gauges. Their sizes vary from 128x128 to 256x256.

I had already coded some gauges back when I was working on the instrument panel so it only took a couple minutes to adapt the code of each one to the new system.
So now, there are 4 gauges inside the Cessna 421 :
- An attitude indicator (Artificial horizon)
- A variometer
- An Altimeter
- A Garmin 430 only showing Com1 and Com2 radios for now.

Screenshots :

[Gauges] Stress test [Gauges] Inside view
Stress test and new Garmin 430

[Gauges] Inflight [Gauges] Zooming on the cockpit
Views from oustide of the airplane

[Gauges] Garmin 430 close up [Gauges] Garmin 430 
Close up showing Com1 and Com2 radio settings and Inside view

[Gauges] Panel from oustide
Another outside view

There is no user interaction yet but I’ll implement that soon. I’ll try to make something better that FS2004 system. I hate it; it’s a pain to change radio frequencies. I think I’m going to do something similar to what we had in Flight Unlimited 2 and 3, the click and drag method…

Since this is a big update to the game, I’ve released a version today, it’s downloadable on my website here:
http://matt-online.homeip.net/flightsimulatorbeta.aspx

Happy Landings,
Matt