Merry Xmas! Update to "Instrument panel follow-up"

Post requests, images, descriptions and reports about work in progress here.
Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Merry Xmas! Update to "Instrument panel follow-up"

Post #1by Boux » 18.12.2005, 18:03

Hi, there,
I am starting a new thread about the picture overlay Celestia mod.
I have done some good progress with the code.
Anybody who is able to compile will be able to implement the mod.
I have some further improvements in the pipe and this is a kind of very functional beta.
You will find below 5 screenshots which show how the overlay behaves in various scenarios.
Basically the mod consists of:
- a new 'logo.png' picture to be put in /celestia/textures/. It is up to those interested to create their own picture. My overlay is a 2048x1024 png picture.
- a new piece of code which replaces the logo block in celestiacore.ccp source file
The picture is dynamically loaded, refreshed and resized and lives nicely with Celestia.
I put the URLs below to the screenshots which show various situations.
Beware the files are pretty big.
Their names tell what they are supposed to show.

http://jmmi.club.fr/celestia/KDE_without_toolbars.jpg
http://jmmi.club.fr/celestia/KDE_with_small_toolbar.jpg
http://jmmi.club.fr/celestia/KDE_with_full_toolbar.jpg
http://jmmi.club.fr/celestia/KDE_with_bottom_overlay.jpg
http://jmmi.club.fr/celestia/KDE_withmessage.jpg

Now the block of code for those who want to play with.
It should be platform- and ui- independent but I cannot test on anything but Linux.
It is heavily documented in-line.

Code: Select all

  // Updated 24 / 12 / 05 //
  // See new improved code below in this thread//


Edit: thanks t00fri for giving me some hints :wink:
Last edited by Boux on 25.12.2005, 12:53, edited 2 times in total.

NoXion
Posts: 56
Joined: 01.05.2005
With us: 19 years 3 months

Post #2by NoXion » 19.12.2005, 22:49

Would it be possible to create custom cockpits?
Currently worldbuilding!

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 11 months
Location: NY, USA

Post #3by selden » 20.12.2005, 12:05

NoXion wrote:Would it be possible to create custom cockpits?


The intent is to be able to overlay any PNG image over Celestia's window. What picture you use is up to you.

(i.e. "Yes.")
Selden

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 11 months
Location: NY, USA

Post #4by selden » 20.12.2005, 12:25

It works under Windows, too.

Of course, there needs to be a command to turn it off.
Selden

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #5by Boux » 20.12.2005, 19:39

selden wrote:It works under Windows, too.
Good to know. Thanks!
selden wrote:Of course, there needs to be a command to turn it off.

I am looking at it.
There are at least three solutions: the ugly one, the bad one and the good one :wink:
Yes, it will be "toggleable" if this word does exists.
Another step will be to make it independent from the startup logo.

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 21 years 10 months
Location: Manassas, VA

Post #6by fsgregs » 21.12.2005, 01:06

Boux:

Your cockpit images are great. Please ... :? consider making them available as add-on images we can download.

Thanks for agreeing to add a toggle to turn the cockpit on and off.

Would it be possible to take Chris's 1.4.0 final version, which should be out any time now, and add your code to it?

If so, would anyone reading this post be willing to compile it for Windows as a customized version and make it available to all us compile-ignorant folks? ... pretty-please .... :)

Frank

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #7by Boux » 24.12.2005, 21:18

/!\ EDITED DEC. 26/!\
Changelog:
- Routine to toggle overlay picture on and off: "Z" is used now instead of "A"
- Routine to toggle overlay picture on and off: better initialization of the 'showPict' toggle variable when used first time in session
- Instructions below updated accordingly
__________________________________________________________________
OK, as promised, here are the elements for a release candidate cockpit overlay mod.
The overlay can now be toggled on/of with the "shift z" key combo.
"Z" is apparently not used by anything.
To get there, you will have to make some changes both in "celestiacore.h" and "celestiacore.ccp".
All the changes are fully documented in the files themselves and very easy to figure out.
First, the change in the header file "celestiacore.h". We have to put in there a variable that can be used globally in "celestiacore.ccp" where the main loop of Celestia is sitting.
Look at the very bottom of "celestiacore.h" for the lines:

Code: Select all

    Selection lastSelection;
    string selectionNames;

#ifdef CELX
    friend View* getViewByObserver(CelestiaCore*, Observer*);
    friend void getObservers(CelestiaCore*, std::vector<Observer*>&);
#endif
};

#endif // _CELESTIACORE_H_


Add the "Boux" commented line as follows:

Code: Select all

    Selection lastSelection;
    string selectionNames;

bool showPict;// added by Boux - this variable will be used in celestiacore.ccp to toggle on/off the overlay picture

#ifdef CELX
    friend View* getViewByObserver(CelestiaCore*, Observer*);
    friend void getObservers(CelestiaCore*, std::vector<Observer*>&);
#endif
};

#endif // _CELESTIACORE_H_


Now in "celestiacore.ccp", there are two changes.
First, look for the "//Show logo at start" block and replace it with the following piece of code:

Code: Select all

    // Show logo at start - start replacing with new code from here

    if ((logoTexture != NULL) && (showPict==true))// look if there is a logo pict loaded and if we want it to show up or not
    {
        glEnable(GL_TEXTURE_2D); //initialize OpenGl for texture rendering

            float xSize = (logoTexture->getWidth()); // get pict width
            float ySize = (logoTexture->getHeight()); // get pict height
            float coeffx = xSize/width; // compute pict width/view window width ratio
            float coeffy = ySize/height; // compute pict height/view window height ratio
            xSize = int (xSize/coeffx); // compute new picture width size to fit viewport
            ySize = int (ySize/coeffy); // compute new picture height to fit viewport

            float left = (width - xSize)/2; // to be sure pict is perfectly centered in viewport
            int bottom = 0; //pict locked at bottom of screen

            float topAlpha, botAlpha; //relative top and bottom  pict transparencies
            botAlpha = 1.0f; // initialization, no transparency needed here!
            topAlpha = 1.0f; // initilization, no transparency needed here!

      if (messageText != "" && currentTime < messageStart + messageDuration) // check for on-screen message
      {
         botAlpha = 0.2f; // make the bottom of pict transparent to make message visible
         topAlpha = 0.8f; // keep the top of pict semi-transparent
      }
      else
                  botAlpha = 1.0f; // make the pict opaque, info is shown through small window in pict
                  topAlpha = 1.0f; // make the pict opaque as there is nothing to read
      {

      if (textEnterMode & KbAutoComplete) // check if window at bottom of screen is open by return key
      {
         bottom = 100; // make some room for it
         ySize = ySize-100; // resize pict height accordingly
      }
      else
         bottom = 0; // put the pict at the very bottom of screen as there is nothing to show
         ySize = ySize;

      logoTexture->bind(); // otherwise binary pict file garbage on screen!

      glBegin(GL_QUADS); // start OpenGl rendering stuff and dynamically adjust picture to viewport
      glColor4f(1.0f, 1.0f, 1.0f, botAlpha);
      glTexCoord2f(0.0f, 1.0f);
      glVertex2i(int (left), bottom);
      glTexCoord2f(1.0f, 1.0f);
      glVertex2i(int (left) + int (xSize), bottom);

      glColor4f(1.0f, 1.0f, 1.0f, topAlpha);
      glTexCoord2f(1.0f, 0.0f);
      glVertex2i(int (left) + int (xSize), bottom + int (ySize));
      glTexCoord2f(0.0f, 0.0f);
      glVertex2i(int (left), bottom + int (ySize));
      glEnd(); // OpenGl rendering stuff is finished
   }
    } // end of the logo picture overlay routine - end of new code


Now, look for this part in "celestiacore.ccp" where the keyboard is read:

Code: Select all

    case '=':
        renderer->setLabelMode(renderer->getLabelMode() ^ Renderer::ConstellationLabels);
        notifyWatchers(LabelFlagsChanged);
        break;

    case 'B':
        renderer->setLabelMode(renderer->getLabelMode() ^ Renderer::StarLabels);
        notifyWatchers(LabelFlagsChanged);
        break;


Between case'=' and case 'B' add this piece of code:

Code: Select all

//Routine to toggle overlay picture on and off
case 'Z':// added by Boux
   if (showPict==true)// added by Boux
      showPict=false;// added by Boux
   else// added by Boux
   if (showPict==false)// added by Boux
      showPict=true;// added by Boux
break;// added by Boux


Build the executable, copy it in the relevant Celestia directory for your os and you are done with the code.

Now, go to your /celestia/textures/ folder and rename "logo.png" to a "logo.png_save" backup in case you want to keep the original in a safe place.
Go grab my Shuttle overlay picture there:
http://jmmi.club.fr/celestia/shut_custom_6.png
Rename it "logo.png" and put it in your /celestia/textures/ folder.

That's it. Run Celestia and enjoy the Shuttle's cockpit view and toggle it on/off with the "shift z" key combo.
Merry Xmas to all of you :D

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 21 years 10 months
Location: Manassas, VA

Post #8by fsgregs » 27.12.2005, 17:29

Boy oh Boy!!! :) :)

I love the final result. My students will just go BONKERS!!!

Could someone patch this code into 1.4.0 final and make a Windows exe version available ASAP???

PLEASE ... :D :D :D

Frank

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 4 months
Location: Hamburg, Germany

Post #9by t00fri » 27.12.2005, 17:38

fsgregs wrote:Boy oh Boy!!! :) :)

I love the final result. My students will just go BONKERS!!!
...


Your students all seem to be future space pilots...

(what would be your students' secret reaction if there was also a not too obvious button that could activate a laser gun? In summary: I think listening too much to young students' preferences is not always the best option ;-) )

Bye Fridger
Last edited by t00fri on 27.12.2005, 17:41, edited 1 time in total.

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #10by Boux » 27.12.2005, 17:40

fsgregs wrote:Boy oh Boy!!! :) :)

I love the final result. My students will just go BONKERS!!!

Could someone patch this code into 1.4.0 final and make a Windows exe version available ASAP???

PLEASE ... :D :D :D

Frank


The kids here love it 8O
I am right now testing and finalizing a new version which makes the overlay image entirely independent from the logo routines. The startup logo will be untouched and will work as it should.
It will be up to the user'choice to have the additional overlay or not.
When it's done, I will release a Linux executable and the set of modified sourcefiles.
Hopefully somebody who compiles under Windows will be kind enough to build an executable and make it available.

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #11by Boux » 27.12.2005, 17:46

t00fri wrote:Your students all seem to be future space pilots...

(what would be your students' secret reaction if there was also a not too obvious button that could activate a laser gun? In summary: I think listening too much to young students' preferences is not always the best option ;-) )

Bye Fridger


I am doing this for the kids, not for astrophysicists :wink:
At least they are learning something while their imagination takes them out there.
When they want to play with laser guns, they just grab their consoles.

buggs_moran
Posts: 835
Joined: 27.09.2004
With us: 19 years 10 months
Location: Massachusetts, USA

Post #12by buggs_moran » 01.01.2006, 20:55

Boux wrote:
t00fri wrote:Your students all seem to be future space pilots...

(what would be your students' secret reaction if there was also a not too obvious button that could activate a laser gun? In summary: I think listening too much to young students' preferences is not always the best option ;-) )

Bye Fridger

I am doing this for the kids, not for astrophysicists :wink:
At least they are learning something while their imagination takes them out there. When they want to play with laser guns, they just grab their consoles.


Not to mention the fact, sometimes, it's that little added "extra" that grabs their attention and keeps them focused. I can't wait to show my students this when it's available... It would be nice if they were satisfied with the view alone. Cockpits aside, the possibilities for informational overlays is there too and potentially very useful.
Homebrew:
WinXP Pro SP2
Asus A7N8X-E Deluxe
AMD Athlon XP 3000/333 2.16 GHz
1 GB Crucial RAM
80 GB WD SATA drive
ATI AIW 9600XT 128M

Hunter Parasite
Posts: 265
Joined: 18.09.2005
With us: 18 years 11 months
Location: CT

Post #13by Hunter Parasite » 01.01.2006, 21:01

whoa. just whoa. now this gets you away form the im-just-floating-out-in-space-looking-at-stars-before-I-die feeling. I cant wait until i cant get it!

Stew2000
Posts: 28
Joined: 30.12.2005
With us: 18 years 7 months
Location: UK

Post #14by Stew2000 » 01.01.2006, 21:14

Hunter Parasite wrote:I cant wait until i cant get it!


8O A bit of re-wording might be needed :wink:

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 11 months
Location: NY, USA

Post #15by selden » 01.01.2006, 21:19

Selden

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 2 months
Location: Rome, ITALY

Post #16by ANDREA » 08.01.2007, 18:52

Here is my little variation to Boux's cockpit (that my students absolutely love!).
I have taken the original Shuttle cockpit images, reduced the size of transparent windows (that are still too big, anyhow), and reduced a lot the internal lighting, adding some bright LEDs here and there.

Image

I feel now it's more real, having for my job a lot of experience of aircraft cockpit visibility during night flights. :wink:
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #17by Boux » 08.01.2007, 19:48

Ah Ah,
Nice interpretation from a pilot?
I am more the kind of a nuke attack submarine guy and love long night tactical tricky navigation exercises with red lights all over the place.
If you like uber-hi-tech cockpits, just let me know.
I may have something for you :D
Intel core i7 3770 Ivy Bridge @ 4.4 GHz -16 GB ram - 128 GB SSD cache - AMD Radeon 7970 3 GB o'clocked - Windows 7 64 Ultimate / Linux Kubuntu

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 2 months
Location: Rome, ITALY

Post #18by ANDREA » 08.01.2007, 19:59

Boux wrote:Ah Ah, Nice interpretation from a pilot?
I am more the kind of a nuke attack submarine guy and love long night tactical tricky navigation exercises with red lights all over the place.
If you like uber-hi-tech cockpits, just let me know. I may have something for you :D

I was not a pilot, but an airline safety engineer (with a lot of miles and flight hours in my notebook).
I understand your preference for red lights, but I would like (oh yes!) to see uber-hi-tech cockpits, please. :wink:
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #19by Boux » 08.01.2007, 20:06

ANDREA wrote:
Boux wrote:Ah Ah, Nice interpretation from a pilot?
I am more the kind of a nuke attack submarine guy and love long night tactical tricky navigation exercises with red lights all over the place.
If you like uber-hi-tech cockpits, just let me know. I may have something for you :D
I was not a pilot, but an airline safety engineer (with a lot of miles and flight hours in my notebook).
I understand your preference for red lights, but I would like (oh yes!) to see uber-hi-tech cockpits, please. :wink:
Bye

Andrea :D


I have one ready at my workplace. I made it long ago and can no longer find it here at home.
It is on a server.
I will upload something tomorrow.
The ultimate cockpit eh eh :lol:
Intel core i7 3770 Ivy Bridge @ 4.4 GHz -16 GB ram - 128 GB SSD cache - AMD Radeon 7970 3 GB o'clocked - Windows 7 64 Ultimate / Linux Kubuntu

Topic author
Boux
Posts: 435
Joined: 25.08.2004
With us: 19 years 11 months
Location: Brittany, close to the Ocean

Post #20by Boux » 08.01.2007, 21:19

To give you an idea
Injection into an orbit around Saturn :)
Image
I have still to tweak the overlay code and rebuild.
Ideally with all Celestia HUD flight data integrated into the dashboard's lcd displays.
Intel core i7 3770 Ivy Bridge @ 4.4 GHz -16 GB ram - 128 GB SSD cache - AMD Radeon 7970 3 GB o'clocked - Windows 7 64 Ultimate / Linux Kubuntu


Return to “Add-on development”