// Explorer.cpp : Defines the exported functions for the DLL application.
//
#define STRICT
#define ORBITER_MODULE
#include "orbitersdk.h"
HINSTANCE g_hDLL;
// Vessel Parameters
const double EXP_SIZE = 3000; // mean radius in meters
const VECTOR3 EXP_CS = {4327830,2655468,29516712}; //Explorer cross section in m^2
const VECTOR3 EXP_PMI = {15.5,22.1,7.7}; //Principal Moments of Inertia, normalized, m^2
const double EXP_EMPTYMASS = 100000000; //empty vessel mass in kg
const double EXP_FUELMASS = 50000000; //max fuel mass in kg
const double EXP_ISP = 500000; //fuel-specific impulse in m/s
const double EXP_MAXMAINTH = 44.3e7;
const double EXP_RCSTH = 7.5e7;
const VECTOR3 EXP_DOCK0_POS = {0,-10,1400.8};
const VECTOR3 EXP_DOCK0_DIR = {0,0,1};
const VECTOR3 EXP_DOCK0_ROT = {0,1,0};
const VECTOR3 EXP_DOCK1_POS = {-95,-145,1800.8};
const VECTOR3 EXP_DOCK1_DIR = {0,0,1};
const VECTOR3 EXP_DOCK1_ROT = {0,1,0};
const VECTOR3 EXP_DOCK2_POS = {-95,-100,1800.8};
const VECTOR3 EXP_DOCK2_DIR = {0,0,1};
const VECTOR3 EXP_DOCK2_ROT = {0,1,0};
// Explorer vessel class interface
class Explorer: public VESSEL3 {
public:
Explorer (OBJHANDLE hVessel, int flightmodel);
~Explorer() ;
void clbkSetClassCaps(FILEHANDLE cfg);
};
Explorer::Explorer(OBJHANDLE hVessel, int flightmodel)
:VESSEL3(hVessel, flightmodel)
{
}
Explorer::~Explorer()
{
}
DLLCLBK void InitModule (HINSTANCE hModule)
{
g_hDLL = hModule;
}
void Explorer::clbkSetClassCaps (FILEHANDLE cfg)
{
THRUSTER_HANDLE th_main, th_rcs[14], th_group[4];
SetSize (EXP_SIZE);
SetEmptyMass (EXP_EMPTYMASS);
SetPMI (EXP_PMI);
SetCrossSections (EXP_CS);
SetDockParams (EXP_DOCK0_POS, EXP_DOCK0_DIR, EXP_DOCK0_ROT);
SetDockParams (EXP_DOCK1_POS, EXP_DOCK1_DIR, EXP_DOCK1_ROT);
SetDockParams (EXP_DOCK2_POS, EXP_DOCK2_DIR, EXP_DOCK2_ROT);
PROPELLANT_HANDLE ph_main = CreatePropellantResource(EXP_FUELMASS);
//main engine definition and exhaust locations
th_main = CreateThruster(_V(0,0,-2268.6), _V(0,0,1), EXP_MAXMAINTH, ph_main, EXP_ISP);
CreateThrusterGroup(&th_main, 8, THGROUP_MAIN);
AddExhaust(th_main, 200, 61, _V(-117.6,0,-2268.6), _V(0,0,-1));
AddExhaust(th_main, 200, 61, _V(117.6,0,-2268.6), _V(0,0,-1));
AddExhaust(th_main, 150, 38, _V(-82,-138.3,-2212.4), _V(0,0,-1));
AddExhaust(th_main, 150, 38, _V(82,-138.3,-2212.4), _V(0,0,-1));
AddExhaust(th_main, 150, 38, _V(82,138.3,-2212.4), _V(0,0,-1));
AddExhaust(th_main, 150, 38, _V(-82,138.3,-2212.4), _V(0,0,-1));
AddExhaust(th_main, 150, 38, _V(-255,0,-2213.5), _V(0,0,-1));
AddExhaust(th_main, 150, 38, _V(255,0,-2213.5), _V(0,0,-1));
//RCS Engine Definitions
// **Port-side Aft**
th_rcs[0] = CreateThruster(_V(-310, 0, -2017.5),_V(1,0,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Starboard-side Aft**
th_rcs[1] = CreateThruster(_V(310, 0, -2017.5),_V(-1,0,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Top Aft**
th_rcs[2] = CreateThruster(_V(-85.28, 190.9, -2001.8), _V(0,-1,0), EXP_RCSTH, ph_main, EXP_ISP);
th_rcs[3] = CreateThruster(_V(85.28, 190.9, -2001.8), _V(0,-1,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Bottom Aft**
th_rcs[4] = CreateThruster(_V(-85.28, -190.9, -2001.8), _V(0,1,0), EXP_RCSTH, ph_main, EXP_ISP);
th_rcs[5] = CreateThruster(_V(85.28, -190.9, -2001.8), _V(0,1,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Port-side Front**
th_rcs[6] = CreateThruster(_V(-305.97,0,1847.05), _V(1,0,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Starboard-side Front**
th_rcs[7] = CreateThruster(_V(305.97,0,1847.05), _V(-1,0,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Bow, Topside**
th_rcs[8] = CreateThruster(_V(85.28,101.08,1874.62), _V(0,-1,0), EXP_RCSTH, ph_main, EXP_ISP);
th_rcs[9] = CreateThruster(_V(-85.28,101.08,1874.62), _V(0,-1,0), EXP_RCSTH, ph_main, EXP_ISP);
// **Bow, Bottom**
th_rcs[10] = CreateThruster(_V(85.28,-101.08,1874.62), _V(0,1,0), EXP_RCSTH, ph_main, EXP_ISP);
th_rcs[11] = CreateThruster(_V(-85.28,-101.08,1874.62), _V(0,1,0), EXP_RCSTH, ph_main, EXP_ISP);
// **forward translation thruster (located on stern of ship)
th_rcs[12] = CreateThruster(_V(0,0,-2300), _V(0,0,1), EXP_RCSTH, ph_main, EXP_ISP);
// **reverse translation thruster (located on bow of ship)
th_rcs[13] = CreateThruster(_V(0,0,2300), _V(0,0,-1), EXP_RCSTH, ph_main, EXP_ISP);
//Define Thruster Groups for Attitude Control
//**Pitch Up**
th_group[0] = th_rcs[2];
th_group[1] = th_rcs[3];
th_group[2] = th_rcs[10];
th_group[3] = th_rcs[11];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHUP);
//**Pitch Down**
th_group[0] = th_rcs[4];
th_group[1] = th_rcs[5];
th_group[2] = th_rcs[8];
th_group[3] = th_rcs[9];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHDOWN);
//**Bank Left**
th_group[0] = th_rcs[2];
th_group[1] = th_rcs[9];
th_group[2] = th_rcs[10];
th_group[3] = th_rcs[5];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_BANKLEFT);
//**Bank Right**
th_group[0] = th_rcs[3];
th_group[1] = th_rcs[8];
th_group[2] = th_rcs[4];
th_group[3] = th_rcs[11];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_BANKRIGHT);
//**Attitude Up**
th_group[0] = th_rcs[4];
th_group[1] = th_rcs[5];
th_group[2] = th_rcs[10];
th_group[3] = th_rcs[11];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_UP);
//**Attitude Down**
th_group[0] = th_rcs[2];
th_group[1] = th_rcs[3];
th_group[2] = th_rcs[8];
th_group[3] = th_rcs[9];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_DOWN);
//**Yaw Left**
th_group[0] = th_rcs[7];
th_group[2] = th_rcs[0];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWLEFT);
//**Yaw Right**
th_group[0] = th_rcs[6];
th_group[1] = th_rcs[1];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWRIGHT);
//**Attitude Left**
th_group[0] = th_rcs[1];
th_group[1] = th_rcs[7];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_LEFT);
//**Attitude Right**
th_group[0] = th_rcs[0];
th_group[1] = th_rcs[6];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_RIGHT);
//**Attitude Forward**
CreateThrusterGroup (th_rcs+12, 1, THGROUP_ATT_FORWARD);
CreateThrusterGroup (th_rcs+13, 1, THGROUP_ATT_BACK);
//**Camera Offset**
SetCameraOffset (_V(0,101.08,1874.62));
//**Add the mesh**
AddMesh("Explorer");
}
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new Explorer (hvessel, flightmodel);
}
DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (Explorer*)vessel;
}