Project Boeing 747 Development Thread

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,057
Reaction score
648
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Well it's time to address some errors (that is, the entire code). Today's topic: change of liveries.

It turns out that I programmed a function that builds the path where the skins are stored, that depend on a text file that defines the position of the skin and its name, in such a way that the path where the DDS file is is built and Orbiter searches for it, Orbiter finds it and we are all happy.

The problem is that as soon as I move the skin list file to the corresponding directory, instead of being in the root of Orbiter, and update the code, Orbiter no longer manages to change the skins and I suspect that it is not actually being able to build the path.

This is my function, and part of the header, any help is appreciated.
C++:
void B747SP::NextSkin() {
    if (currentSkin >= 15) {
        currentSkin = 0;
    }

    ChangeLivery();
    currentSkin++;
}

void B747SP::ChangeLivery() {
    const char item[5] = "SKIN";
    char skinname[256];
    char completedir_fus[256];
    char completedir_vs[256];
    char completedir_rw[256];
    char completedir_eng[256];
    char completedir_lw[256];
    const char SKINLIST[][15] = {"SKIN1", "SKIN2", "SKIN3", "SKIN4", "SKIN5", "SKIN6", "SKIN7", "SKIN8", "SKIN9", "SKIN10", "SKIN11", "SKIN12", "SKIN13", "SKIN14", "SKIN15"};
    
    skinlist = oapiOpenFile(fname, FILE_IN, TEXTURES);
    oapiReadItem_string(skinlist, SKINLIST[currentSkin], skinname);
    

    strcpy(completedir_fus, skindir);
    strcat(completedir_fus, skinname);
    strcat(completedir_fus, texname_fus);

    strcpy(completedir_vs, skindir);
    strcat(completedir_vs, skinname);
    strcat(completedir_vs, texname_vs);

    strcpy(completedir_rw, skindir);
    strcat(completedir_rw, skinname);
    strcat(completedir_rw, texname_rw);

    strcpy(completedir_eng, skindir);
    strcat(completedir_eng, skinname);
    strcat(completedir_eng, texname_eng);

    strcpy(completedir_lw, skindir);
    strcat(completedir_lw, skinname);
    strcat(completedir_lw, texname_lw);

    skin[0] = oapiLoadTexture(completedir_fus);
    skin[1] = oapiLoadTexture(completedir_vs);
    skin[2] = oapiLoadTexture(completedir_rw);
    skin[3] = oapiLoadTexture(completedir_eng);
    skin[4] = oapiLoadTexture(completedir_lw);


    ApplyLivery();
}

void B747SP::ApplyLivery(){

    if(!b747sp_dmesh) return;

    if(skin[0]) oapiSetTexture(b747sp_dmesh, 1, skin[0]);

    if(skin[1]) oapiSetTexture(b747sp_dmesh, 2, skin[1]);

    if(skin[2]) oapiSetTexture(b747sp_dmesh, 3, skin[2]);

    if(skin[3]) oapiSetTexture(b747sp_dmesh, 4, skin[3]);

    if(skin[4]) oapiSetTexture(b747sp_dmesh, 9, skin[4]);

}

C++:
//B747SP class interface

class B747SP : public VESSEL4{

    public:

        enum MySounds {engines_start, engines_shutdown, engines, cabin_ambiance, rotate};

        enum LandingGearStatus{GEAR_DOWN, GEAR_UP, GEAR_DEPLOYING, GEAR_STOWING} landing_gear_status;

        B747SP(OBJHANDLE hVessel, int flightmodel);
        virtual ~B747SP();
        
        void DefineAnimations(void);
        void ActivateLandingGear(LandingGearStatus action);
        void SetGearDown(void);
        void UpdateLandingGearAnimation(double);

        double UpdateLvlEnginesContrail();

        void ParkingBrake();

        void NextSkin();
        void ChangeLivery();
        void ApplyLivery();

        void ActivateBeacons(void);

        void LightsControl(void);

        void EnginesAutostart(void);
        void EnginesAutostop(void);
        void UpdateEnginesStatus(void);

        void clbkSetClassCaps(FILEHANDLE cfg) override;
        void clbkLoadStateEx(FILEHANDLE scn, void *vs) override;
        void clbkSaveState(FILEHANDLE scn) override;
        void clbkPreStep(double, double, double) override;
        void clbkPostCreation(void) override;
        void clbkPostStep(double, double, double) override;
        int clbkConsumeBufferedKey(int, bool, char *) override;

        bool clbkLoadVC(int) override;
        //void clbkMFDMode(int, int) override;
        //bool clbkVCRedrawEvent(int, int, SURFHANDLE) override;

        void clbkVisualCreated(VISHANDLE vis, int refcount) override;
        void clbkVisualDestroyed (VISHANDLE vis, int refcount) override;

        VISHANDLE visual;
        MESHHANDLE b747sp_mesh, mhcockpit_mesh, fccabin_mesh;  //Mesh handle
        unsigned int uimesh_Cockpit = 1;
        DEVMESHHANDLE b747sp_dmesh;  //Mesh template handle

        XRSound *m_pXRSound;
        

    private:

        unsigned int anim_landing_gear;
        unsigned int anim_door;
        unsigned int anim_laileron;
        unsigned int anim_raileron;
        unsigned int anim_elevator;
        unsigned int anim_elevator_trim;
        unsigned int anim_rudder;
        unsigned int anim_engines;

        double lvlcontrailengines;
        double landing_gear_proc;
        double engines_proc;
        double pwr;

        AIRFOILHANDLE lwing, rwing, lstabilizer, rstabilizer;
        CTRLSURFHANDLE hlaileron, hraileron;
        THRUSTER_HANDLE th_main[4], th_retro[4];
        THGROUP_HANDLE thg_main, thg_retro;
        BEACONLIGHTSPEC beacon[5];
        FILEHANDLE skinlist, skinlog;
        SURFHANDLE skin[5];
        SURFHANDLE vcMfdTex;
        char skinpath[256];
        LightEmitter *l1, *l2, *l3, *l4, *cpl1, *cpl2, *fcl1, *fcl2, *fcl3, *fcl4, *fcl5, *fcl6, *fcl7, *fcl8, *fcl9, *fcl10, *fcl11, *fcl12;
        

        COLOUR4 col_d = {0.9,0.8,1,0};
        COLOUR4 col_s = {1.9,0.8,1,0};
        COLOUR4 col_a = {0,0,0,0};
        COLOUR4 ccol_d = {1, 0.508, 0.100};
        COLOUR4 ccol_s = {1, 0.508, 0.100};
        COLOUR4 ccol_a = {1, 0.508, 0.100};
        COLOUR4 fccol_d = {1, 1, 1};
        COLOUR4 fccol_s = {1, 1, 1};
        COLOUR4 fccol_a = {1, 1, 1};

        const char fname[34] = "Boeing_747\\B747SP\\Skins\\skins.txt";  //File where skin list is stored. Relative to ORBITER_ROOT.
        const char skindir[25] = "Boeing_747\\B747SP\\Skins\\";  //Path where actual skins are stored. Relative to ORBITER_ROOT\\Textures.

        //Name of the textures to be applied.
        const char texname_fus[14] = "\\Fuselage.dds";
        const char texname_vs[25] = "\\Vertical_stabilizer.dds";
        const char texname_rw[15] = "Right_wing.dds";
        const char texname_eng[9] = "ENG1.dds";
        const char texname_lw[14] = "Left_wing.dds";

};

And that's how it was before the change, when Orbiter was still looking for the skin list file in the Orbiter root. And it worked.
C++:
void B747SP::NextSkin() {
    if (currentSkin >= 5) {
        currentSkin = 0;
    }

    ChangeLivery();
    currentSkin++;
}

void B747SP::ChangeLivery() {
    const char item[5] = "SKIN";
    char skinname[256];
    char completedir_fus[256];
    char completedir_vs[256];
    char completedir_rw[256];
    char completedir_eng[256];
    char completedir_lw[256];
    const char SKINLIST[][6] = {"SKIN1", "SKIN2", "SKIN3", "SKIN4", "SKIN5"};
    
    skinlist = oapiOpenFile(fname, FILE_IN, ROOT);
    oapiReadItem_string(skinlist, SKINLIST[currentSkin], skinname);


    strcpy(completedir_fus, skindir);
    strcat(completedir_fus, skinname);
    strcat(completedir_fus, texname_fus);

    strcpy(completedir_vs, skindir);
    strcat(completedir_vs, skinname);
    strcat(completedir_vs, texname_vs);

    strcpy(completedir_rw, skindir);
    strcat(completedir_rw, skinname);
    strcat(completedir_rw, texname_rw);

    strcpy(completedir_eng, skindir);
    strcat(completedir_eng, skinname);
    strcat(completedir_eng, texname_eng);

    strcpy(completedir_lw, skindir);
    strcat(completedir_lw, skinname);
    strcat(completedir_lw, texname_lw);

    skin[0] = oapiLoadTexture(completedir_fus);
    skin[1] = oapiLoadTexture(completedir_vs);
    skin[2] = oapiLoadTexture(completedir_rw);
    skin[3] = oapiLoadTexture(completedir_eng);
    skin[4] = oapiLoadTexture(completedir_lw);


    ApplyLivery();
}

void B747SP::ApplyLivery(){

    if(!b747sp_dmesh) return;

    if(skin[0]) oapiSetTexture(b747sp_dmesh, 1, skin[0]);

    if(skin[1]) oapiSetTexture(b747sp_dmesh, 2, skin[1]);

    if(skin[2]) oapiSetTexture(b747sp_dmesh, 3, skin[2]);

    if(skin[3]) oapiSetTexture(b747sp_dmesh, 4, skin[3]);

    if(skin[4]) oapiSetTexture(b747sp_dmesh, 9, skin[4]);

}
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,057
Reaction score
648
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Wow! Very nice!
Another possible variant......
wX5bNBoNsnrxgygEJptQSn.jpg
Challenge Accepted!
Screenshot_20240409_192002.jpg
Well, now 14 more liveries remain to be made.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,623
Reaction score
2,341
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Challenge Accepted!
View attachment 37736
Well, now 14 more liveries remain to be made.

Aside of liveries, I think he meant also adding support (for example by an attachment point) for the optional fifth engine pylon, that some (or just one?) 747 variant had.
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,678
Reaction score
902
Points
128
Location
Code 347
Aside of liveries, I think he meant also adding support (for example by an attachment point) for the optional fifth engine pylon, that some (or just one?) 747 variant had.
Yes, just need an attachment point to hang the mount and LauncherOne off.
I had fun flying the Stargazer/Pegasus launches, and it'd be nice to fly the 747 out of Newquay.
I don't know much about LauncherOne - it had a couple of successes I think.
Anyhow, the 747 looks great (y)
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,057
Reaction score
648
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Yes, just need an attachment point to hang the mount and LauncherOne off.
I had fun flying the Stargazer/Pegasus launches, and it'd be nice to fly the 747 out of Newquay.
I don't know much about LauncherOne - it had a couple of successes I think.
Anyhow, the 747 looks great (y)
Thank you for your words! In fact, I'm also going to make the 747 variant with the launcher. I hope to have everything ready for the 1.0 release.
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
401
Reaction score
515
Points
108
Location
Lviv
Preferred Pronouns
he/him
Hi, thanks for the development.
I'm just going to ask, since you've made the KleinVision AirCar for the OpenOrbiter, then does it mean that the Boeing will be compatible with the OpenOrbiter, not only with the Orbiter 2016?
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,057
Reaction score
648
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Hi, thanks for the development.
I'm just going to ask, since you've made the KleinVision AirCar for the OpenOrbiter, then does it mean that the Boeing will be compatible with the OpenOrbiter, not only with the Orbiter 2016?
Yes, exactly, "Project Jumbo" will be compatible with OpenOrbiter (Windows and Linux).

Hi, thanks for the development.
And thanks to you for your words!
By the way, I think my next project will be a plane that was very very big...
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,369
Reaction score
3,304
Points
138
Location
Massachusetts
Modeling the Boeing Model 985-121 "microfighters" to start working on the Boeing 747-AAC.
View attachment 37860
@Matias Saibene - You have lost your marbles, but I say that with the deepest awe and respect! This is amazing. :salute:

Don't hurt yourself! Do it so long as it is fun for you, not because I proposed it in jest. I don't want that on my conscience.
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,057
Reaction score
648
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Thank you, thank you friends!
I love modeling with Blender and the ideas you all give me and your words and comments are my fuel. I consider my project my small grain of sand to make the Orbiter Universe bigger. Obviously it's going to have its flaws and bugs, but I'm also working on eliminating them and polishing the add-on as best I can to have everything ready for release 1.0.

Since I discovered Orbiter back in 2010, I always wanted to make my own spaceships but never could because of using SketchUp.
But since @Gondos kindly ported the code to Linux (because my laptop is from 2013 and Blender no longer works on Windows 10 with integrated Sandy Bridge graphics) I started to see the possibility of modeling for Orbiter. Then I started a YouTube course on C++ and then I realized that I had the power (the Matrix soundtrack starts playing) to carry out my ideas.

I never thought I would have so many comments and ideas on this project, thank you very much friends. I hope to polish all the details (especially the 3D cockpit which was a bit ugly) and make a launch that lives up to the quality of Orbiter and its community.
 
Top