Request Single Person Spacecraft

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
On group and texture is fine, but each button needs is it's own area of the texture.
Did you define the VC buttons active areas in DefineMFDButtons() with correct xyz coordinates?
Yes. But for some reason. It never goes to the clbkVCMouseEvent area where to turn on/off the MFD.

Also MFD1 buttons are the same for MFD2 and 3. So if I turn MFD1 off in the NON VC view all the mfd buttons are off
 

Max-Q

99 40
Addon Developer
Joined
Jul 5, 2021
Messages
765
Reaction score
1,181
Points
108
Location
Cislunar Space
Website
www.orbiter-forum.com
Yes. But for some reason. It never goes to the clbkVCMouseEvent area where to turn on/off the MFD.
Does clbkVCMouseEvent() get called at all?

Also MFD1 buttons are the same for MFD2 and 3. So if I turn MFD1 off in the NON VC view all the mfd buttons are off
Umm... never seen THAT one before... o_O

As far as the third screen, are all three cdr1_mfd, plt1_mfd, and cntr1_mfd defined somewhere with correct data?
FYI, you can get rid of the variables check_mfds and fail_mfd[]. These were part of the system I used to fail MFDs.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Thanks. Yes. cdr1_mfd = { 2,GRP_LeftMFDScreen }; plt1_mfd = { 2,GRP_RightMFDScreen }; cntr1_mfd = { 2,GRP_CenterMFDScreen };
2 is the vc mesh

no this clbkVCMouseEvent is never called. I have the debug script and it is never seen. Also a break which it never hits
void SPS::clbkMFDMode(int mfd, int mode) { oapiVCTriggerRedrawArea(-1, ALL_MFD_BUTTONS); } //------------------------------------------------------------------------- bool SPS::clbkLoadVC(int id) { SetCameraOffset(_V(0, .595, 0)); SetCameraDefaultDirection(_V(0, -0.1908, 0.9816)); DefineMFDButtons(); oapiVCRegisterMFD(MFD_LEFT, &cdr1_mfd); oapiVCRegisterMFD(MFD_RIGHT, &plt1_mfd); oapiVCRegisterMFD(MFD_USER1, &cntr1_mfd); return true; } //------------------------------------------------------------------------- bool SPS::clbkVCMouseEvent(int id, int event, VECTOR3& p) { sprintf(oapiDebugString(), "Mouse position: X %f Y %f Z %f bt%d", p.x, p.y, p.z, id); if (id == CDR1_PWR) { oapiSendMFDKey(MFD_LEFT, OAPI_KEY_ESCAPE); } return true; if (id == CDR1_SEL) { oapiSendMFDKey(MFD_LEFT, OAPI_KEY_F1); return true; } if (id == CDR1_MNU) { oapiSendMFDKey(MFD_LEFT, OAPI_KEY_GRAVE); return true; } if (id == PLT1_PWR) { oapiSendMFDKey(MFD_RIGHT, OAPI_KEY_ESCAPE); } return true; if (id == PLT1_SEL) { oapiSendMFDKey(MFD_RIGHT, OAPI_KEY_F1); return true; } if (id == PLT1_MNU) { oapiSendMFDKey(MFD_RIGHT, OAPI_KEY_GRAVE); return true; } if (id == CNTR1_PWR) { oapiSendMFDKey(MFD_USER1, OAPI_KEY_ESCAPE); } return true; if (id == CNTR1_SEL) { oapiSendMFDKey(MFD_USER1, OAPI_KEY_F1); return true; } if (id == CNTR1_MNU) { oapiSendMFDKey(MFD_USER1, OAPI_KEY_GRAVE); return true; } if (id == CDR1_LBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_LEFT, button, event); return true; } if (id == CDR1_RBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_LEFT, button + 6, event); return true; } if (id == PLT1_LBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_RIGHT, button, event); return true; } if (id == PLT1_RBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_RIGHT, button + 6, event); return true; } if (id == CNTR1_LBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_USER1, button, event); return true; } if (id == CNTR1_RBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_USER1, button + 6, event); return true; } return false; } bool SPS::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) { bool return_value = false; if (id == ALL_MFD_BUTTONS) { PaintMFDButtons(surf); return_value = true; } return return_value; } void SPS::PaintMFDButtons(SURFHANDLE surf) { HDC hDC = oapiGetDC(surf); for (int mfd = 0; mfd < 3; mfd++) { // D. Beachy: BUGFIX: if MFD powered off, do not paint buttons if (oapiGetMFDMode(mfd) == MFD_NONE) { } else { // MFD powered on sprintf(oapiDebugString(), "MFD MODE %d MFD %d ", oapiGetMFDMode(mfd), mfd); HFONT pFont = (HFONT)SelectObject(hDC, g_Param.font[0]); SetTextColor(hDC, RGB(255, 255, 255)); SetTextAlign(hDC, TA_CENTER); SetBkMode(hDC, TRANSPARENT); const char* label; int y = 16; for (int bt = 0; bt < 6; bt++) { if (label = oapiMFDButtonLabel(mfd, bt)) { TextOut(hDC, mfd_buttons_ypos[mfd], y, label, strlen(label)); y += 64; } else break; } int y2 = 16; for (int bt = 6; bt < 12; bt++) { if (label = oapiMFDButtonLabel(mfd, bt)) { TextOut(hDC, mfd_buttons_ypos[mfd] + 128, y2, label, strlen(label)); y2 += 64; } else break; } //TextOut (hDC, 234, 1, "PG", 2); SelectObject(hDC, pFont); } } oapiReleaseDC(surf, hDC); } void SPS::DefineMFDButtons() { SURFHANDLE mfd_buttons_surf; mfd_buttons_surf = oapiGetTextureHandle(hOrbiterVCMesh, 3); oapiVCRegisterArea(CDR1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CDR1_SEL, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CDR1_MNU, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CDR1_PWR, CDR1_PWR_AREA.pt1, CDR1_PWR_AREA.pt2, CDR1_PWR_AREA.pt3, CDR1_PWR_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CDR1_SEL, CDR1_SEL_AREA.pt1, CDR1_SEL_AREA.pt2, CDR1_SEL_AREA.pt3, CDR1_SEL_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CDR1_MNU, CDR1_MNU_AREA.pt1, CDR1_MNU_AREA.pt2, CDR1_MNU_AREA.pt3, CDR1_MNU_AREA.pt4); oapiVCRegisterArea(PLT1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(PLT1_SEL, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(PLT1_MNU, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(PLT1_PWR, PLT1_PWR_AREA.pt1, PLT1_PWR_AREA.pt2, PLT1_PWR_AREA.pt3, PLT1_PWR_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(PLT1_SEL, PLT1_SEL_AREA.pt1, PLT1_SEL_AREA.pt2, PLT1_SEL_AREA.pt3, PLT1_SEL_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(PLT1_MNU, PLT1_MNU_AREA.pt1, PLT1_MNU_AREA.pt2, PLT1_MNU_AREA.pt3, PLT1_MNU_AREA.pt4); oapiVCRegisterArea(CNTR1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CNTR1_SEL, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CNTR1_MNU, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_PWR, CNTR1_PWR_AREA.pt1, CNTR1_PWR_AREA.pt2, CNTR1_PWR_AREA.pt3, CNTR1_PWR_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_SEL, CNTR1_SEL_AREA.pt1, CNTR1_SEL_AREA.pt2, CNTR1_SEL_AREA.pt3, CNTR1_SEL_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_MNU, CNTR1_MNU_AREA.pt1, CNTR1_MNU_AREA.pt2, CNTR1_MNU_AREA.pt3, CNTR1_MNU_AREA.pt4); oapiVCRegisterArea(CDR1_LBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CDR1_RBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CDR1_LBUTTONS, CDR1_LBUTTONS_AREA.pt1, CDR1_LBUTTONS_AREA.pt2, CDR1_LBUTTONS_AREA.pt3, CDR1_LBUTTONS_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CDR1_RBUTTONS, CDR1_RBUTTONS_AREA.pt1, CDR1_RBUTTONS_AREA.pt2, CDR1_RBUTTONS_AREA.pt3, CDR1_RBUTTONS_AREA.pt4); oapiVCRegisterArea(PLT1_LBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(PLT1_RBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(PLT1_LBUTTONS, PLT1_LBUTTONS_AREA.pt1, PLT1_LBUTTONS_AREA.pt2, PLT1_LBUTTONS_AREA.pt3, PLT1_LBUTTONS_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(PLT1_RBUTTONS, PLT1_RBUTTONS_AREA.pt1, PLT1_RBUTTONS_AREA.pt2, PLT1_RBUTTONS_AREA.pt3, PLT1_RBUTTONS_AREA.pt4); oapiVCRegisterArea(CNTR1_LBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CNTR1_RBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_LBUTTONS, CNTR1_LBUTTONS_AREA.pt1, CNTR1_LBUTTONS_AREA.pt2, CNTR1_LBUTTONS_AREA.pt3, CNTR1_LBUTTONS_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_RBUTTONS, CNTR1_RBUTTONS_AREA.pt1, CNTR1_RBUTTONS_AREA.pt2, CNTR1_RBUTTONS_AREA.pt3, CNTR1_RBUTTONS_AREA.pt4); oapiVCRegisterArea(ALL_MFD_BUTTONS, _R(0, 0, 1536, 384), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, mfd_buttons_surf); }
h:
bool clbkLoadVC(int id); bool clbkVCMouseEvent(int id, int event, VECTOR3& p); bool clbkVCRedrawEvent(int id, int event, SURFHANDLE surf); void clbkMFDMode(int mfd, int mode); VCMFDSPEC cdr1_mfd; VCMFDSPEC plt1_mfd; VCMFDSPEC cntr1_mfd; HINSTANCE hDLL; HFONT hFont,hFont1; HPEN hPen; HBRUSH hBrush; void PaintMFDButtons(SURFHANDLE surf); struct RECT_AREA { VECTOR3 pt1; VECTOR3 pt2; VECTOR3 pt3; VECTOR3 pt4; };
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
This is so weird.

When I just use cdr1 as cdr1_mfd = { 2,GRP_LeftMFDScreen }; the right mfd lits up. If I define it as the center it lights up. But not the left.


// ======================================================== // Mesh resource file for D:/Orbiter2016\Meshes\sps_vc.MSH // Generated with meshc on Fri Oct 28 19:03:10 2022 // ======================================================== // Number of mesh groups: #define NGRP 7 // Number of materials: #define NMAT 4 // Number of textures: #define NTEX 3 // Named mesh groups: #define GRP_CenterMFDScreen 0 #define GRP_RightMFDScreen 1 #define GRP_LeftMFDScreen 2 #define GRP_mesh04 3 #define GRP_mesh06 4 #define GRP_mesh02 5 #define GRP_allmfdbuttons 6
 

Attachments

  • rightmfdsps1.jpg
    rightmfdsps1.jpg
    48.9 KB · Views: 2
  • spsvcgroups.jpg
    spsvcgroups.jpg
    29.6 KB · Views: 2

Max-Q

99 40
Addon Developer
Joined
Jul 5, 2021
Messages
765
Reaction score
1,181
Points
108
Location
Cislunar Space
Website
www.orbiter-forum.com
Thanks. Yes. cdr1_mfd = { 2,GRP_LeftMFDScreen }; plt1_mfd = { 2,GRP_RightMFDScreen }; cntr1_mfd = { 2,GRP_CenterMFDScreen };
2 is the vc mesh

no this clbkVCMouseEvent is never called. I have the debug script and it is never seen. Also a break which it never hits
void SPS::clbkMFDMode(int mfd, int mode) { oapiVCTriggerRedrawArea(-1, ALL_MFD_BUTTONS); } //------------------------------------------------------------------------- bool SPS::clbkLoadVC(int id) { SetCameraOffset(_V(0, .595, 0)); SetCameraDefaultDirection(_V(0, -0.1908, 0.9816)); DefineMFDButtons(); oapiVCRegisterMFD(MFD_LEFT, &cdr1_mfd); oapiVCRegisterMFD(MFD_RIGHT, &plt1_mfd); oapiVCRegisterMFD(MFD_USER1, &cntr1_mfd); return true; } //------------------------------------------------------------------------- bool SPS::clbkVCMouseEvent(int id, int event, VECTOR3& p) { sprintf(oapiDebugString(), "Mouse position: X %f Y %f Z %f bt%d", p.x, p.y, p.z, id); if (id == CDR1_PWR) { oapiSendMFDKey(MFD_LEFT, OAPI_KEY_ESCAPE); } return true; if (id == CDR1_SEL) { oapiSendMFDKey(MFD_LEFT, OAPI_KEY_F1); return true; } if (id == CDR1_MNU) { oapiSendMFDKey(MFD_LEFT, OAPI_KEY_GRAVE); return true; } if (id == PLT1_PWR) { oapiSendMFDKey(MFD_RIGHT, OAPI_KEY_ESCAPE); } return true; if (id == PLT1_SEL) { oapiSendMFDKey(MFD_RIGHT, OAPI_KEY_F1); return true; } if (id == PLT1_MNU) { oapiSendMFDKey(MFD_RIGHT, OAPI_KEY_GRAVE); return true; } if (id == CNTR1_PWR) { oapiSendMFDKey(MFD_USER1, OAPI_KEY_ESCAPE); } return true; if (id == CNTR1_SEL) { oapiSendMFDKey(MFD_USER1, OAPI_KEY_F1); return true; } if (id == CNTR1_MNU) { oapiSendMFDKey(MFD_USER1, OAPI_KEY_GRAVE); return true; } if (id == CDR1_LBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_LEFT, button, event); return true; } if (id == CDR1_RBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_LEFT, button + 6, event); return true; } if (id == PLT1_LBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_RIGHT, button, event); return true; } if (id == PLT1_RBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_RIGHT, button + 6, event); return true; } if (id == CNTR1_LBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_USER1, button, event); return true; } if (id == CNTR1_RBUTTONS) { int button = p.y * 6; oapiProcessMFDButton(MFD_USER1, button + 6, event); return true; } return false; } bool SPS::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) { bool return_value = false; if (id == ALL_MFD_BUTTONS) { PaintMFDButtons(surf); return_value = true; } return return_value; } void SPS::PaintMFDButtons(SURFHANDLE surf) { HDC hDC = oapiGetDC(surf); for (int mfd = 0; mfd < 3; mfd++) { // D. Beachy: BUGFIX: if MFD powered off, do not paint buttons if (oapiGetMFDMode(mfd) == MFD_NONE) { } else { // MFD powered on sprintf(oapiDebugString(), "MFD MODE %d MFD %d ", oapiGetMFDMode(mfd), mfd); HFONT pFont = (HFONT)SelectObject(hDC, g_Param.font[0]); SetTextColor(hDC, RGB(255, 255, 255)); SetTextAlign(hDC, TA_CENTER); SetBkMode(hDC, TRANSPARENT); const char* label; int y = 16; for (int bt = 0; bt < 6; bt++) { if (label = oapiMFDButtonLabel(mfd, bt)) { TextOut(hDC, mfd_buttons_ypos[mfd], y, label, strlen(label)); y += 64; } else break; } int y2 = 16; for (int bt = 6; bt < 12; bt++) { if (label = oapiMFDButtonLabel(mfd, bt)) { TextOut(hDC, mfd_buttons_ypos[mfd] + 128, y2, label, strlen(label)); y2 += 64; } else break; } //TextOut (hDC, 234, 1, "PG", 2); SelectObject(hDC, pFont); } } oapiReleaseDC(surf, hDC); } void SPS::DefineMFDButtons() { SURFHANDLE mfd_buttons_surf; mfd_buttons_surf = oapiGetTextureHandle(hOrbiterVCMesh, 3); oapiVCRegisterArea(CDR1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CDR1_SEL, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CDR1_MNU, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CDR1_PWR, CDR1_PWR_AREA.pt1, CDR1_PWR_AREA.pt2, CDR1_PWR_AREA.pt3, CDR1_PWR_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CDR1_SEL, CDR1_SEL_AREA.pt1, CDR1_SEL_AREA.pt2, CDR1_SEL_AREA.pt3, CDR1_SEL_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CDR1_MNU, CDR1_MNU_AREA.pt1, CDR1_MNU_AREA.pt2, CDR1_MNU_AREA.pt3, CDR1_MNU_AREA.pt4); oapiVCRegisterArea(PLT1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(PLT1_SEL, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(PLT1_MNU, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(PLT1_PWR, PLT1_PWR_AREA.pt1, PLT1_PWR_AREA.pt2, PLT1_PWR_AREA.pt3, PLT1_PWR_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(PLT1_SEL, PLT1_SEL_AREA.pt1, PLT1_SEL_AREA.pt2, PLT1_SEL_AREA.pt3, PLT1_SEL_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(PLT1_MNU, PLT1_MNU_AREA.pt1, PLT1_MNU_AREA.pt2, PLT1_MNU_AREA.pt3, PLT1_MNU_AREA.pt4); oapiVCRegisterArea(CNTR1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CNTR1_SEL, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CNTR1_MNU, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_PWR, CNTR1_PWR_AREA.pt1, CNTR1_PWR_AREA.pt2, CNTR1_PWR_AREA.pt3, CNTR1_PWR_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_SEL, CNTR1_SEL_AREA.pt1, CNTR1_SEL_AREA.pt2, CNTR1_SEL_AREA.pt3, CNTR1_SEL_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_MNU, CNTR1_MNU_AREA.pt1, CNTR1_MNU_AREA.pt2, CNTR1_MNU_AREA.pt3, CNTR1_MNU_AREA.pt4); oapiVCRegisterArea(CDR1_LBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CDR1_RBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CDR1_LBUTTONS, CDR1_LBUTTONS_AREA.pt1, CDR1_LBUTTONS_AREA.pt2, CDR1_LBUTTONS_AREA.pt3, CDR1_LBUTTONS_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CDR1_RBUTTONS, CDR1_RBUTTONS_AREA.pt1, CDR1_RBUTTONS_AREA.pt2, CDR1_RBUTTONS_AREA.pt3, CDR1_RBUTTONS_AREA.pt4); oapiVCRegisterArea(PLT1_LBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(PLT1_RBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(PLT1_LBUTTONS, PLT1_LBUTTONS_AREA.pt1, PLT1_LBUTTONS_AREA.pt2, PLT1_LBUTTONS_AREA.pt3, PLT1_LBUTTONS_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(PLT1_RBUTTONS, PLT1_RBUTTONS_AREA.pt1, PLT1_RBUTTONS_AREA.pt2, PLT1_RBUTTONS_AREA.pt3, PLT1_RBUTTONS_AREA.pt4); oapiVCRegisterArea(CNTR1_LBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCRegisterArea(CNTR1_RBUTTONS, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_LBUTTONS, CNTR1_LBUTTONS_AREA.pt1, CNTR1_LBUTTONS_AREA.pt2, CNTR1_LBUTTONS_AREA.pt3, CNTR1_LBUTTONS_AREA.pt4); oapiVCSetAreaClickmode_Quadrilateral(CNTR1_RBUTTONS, CNTR1_RBUTTONS_AREA.pt1, CNTR1_RBUTTONS_AREA.pt2, CNTR1_RBUTTONS_AREA.pt3, CNTR1_RBUTTONS_AREA.pt4); oapiVCRegisterArea(ALL_MFD_BUTTONS, _R(0, 0, 1536, 384), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, mfd_buttons_surf); }
h:
bool clbkLoadVC(int id); bool clbkVCMouseEvent(int id, int event, VECTOR3& p); bool clbkVCRedrawEvent(int id, int event, SURFHANDLE surf); void clbkMFDMode(int mfd, int mode); VCMFDSPEC cdr1_mfd; VCMFDSPEC plt1_mfd; VCMFDSPEC cntr1_mfd; HINSTANCE hDLL; HFONT hFont,hFont1; HPEN hPen; HBRUSH hBrush; void PaintMFDButtons(SURFHANDLE surf); struct RECT_AREA { VECTOR3 pt1; VECTOR3 pt2; VECTOR3 pt3; VECTOR3 pt4; };
Well, if clbkVCMouseEvent() is never called, than there are bigger issues here than the MFDs.
If you want to PM me a copy of the project, I will see if I can get it sorted for you, but no promises!
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
@Max-Q I did pM'ed them

Looking at the interior. I redid the center gauge to max 10000 psi. I hope to have it reflect the RCS fuel level.

Add a mask to the pilot guy.

On the front panel. Maybe just a texture not moving displays.

The PDF also mentioned Auxiliary Lights? I am thinking a single in the front area?

I need to build a n adapter to allow the SPS to dock to the Orbital reef
 

Attachments

  • SPSPANEL.jpg
    SPSPANEL.jpg
    51.3 KB · Views: 0

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Thanks to @Max-Q . I got the HUD to work.
I might but the Auxiliary light in the center? In the cut out section
The round gauge in the center will reflect fuel level
 

Attachments

  • SPSVCSIDE1.jpg
    SPSVCSIDE1.jpg
    85 KB · Views: 7
  • SPSVCNEW1.jpg
    SPSVCNEW1.jpg
    60.8 KB · Views: 7
  • spsexterior1.jpg
    spsexterior1.jpg
    35.9 KB · Views: 7

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Better use pressure there, since this is more important for a gas thruster than the actual propellant mass. Once it reaches the regulator pressure, the thrust of the gas thruster will drop rapidly by reducing mass flow and exhaust velocity, but you would still be able to produce thrust until the tank is really vented to vacuum - it would just take an almost infinite time to reach zero propellant mass.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Thanks.

Better use pressure there, since this is more important for a gas thruster than the actual propellant mass. Once it reaches the regulator pressure, the thrust of the gas thruster will drop rapidly by reducing mass flow and exhaust velocity, but you would still be able to produce thrust until the tank is really vented to vacuum - it would just take an almost infinite time to reach zero propellant mass.


What would that look like?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
What would that look like?

Depends, on how much fidelity you want. Thanks to Nitrogen being a very simple diatomic gas, the ideal gas law works great.


Until you reach regulator pressure, the pressure should drop at linear rate until you have reached the pressure of the regulator. Then, the volume flow through the regulator drops with pressure. So, you can reduce the maximum thrust of the all thrusters by the pressure ratio OR reduce the efficiency of the propellant resource by the ratio of pressure to regulator pressure.

That is not 100% accurate (the perforance of the nozzles also drops with pressure), but should prevent that the real one can maneuver for a longer period of time in an emergency, compared to the Orbiter model. The real one would just become very sluggish at low propellant levels.

And if you want it MORE accurate (of course not!), this here is the data sheet of the pressure regulators used in the old MMU, which will likely also be used in the SPS:

 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. I guess what I was asking how how that look like in code?

I was wrong, lower efficiency increases propellant mass flow, you need to calculate the rated thrust of each thruster on the manifold pressure to get the expected effect.

So, it should be something like that.

Thrust = min(p/P_REG, 1.0) * THRUST0;

The pressure in the tank can be calculate by the volume and temperature of the tank, p = nRT/V.

Look especially at that form here:


where you can replace R/M by a constant R_SPECIFIC and further more assume a constant tank VOLUME, you can define a TANK_CONSTANT = R/(M * VOLUME) and have the actual calculation down to:

TankPressure = TANK_CONSTANT * GetPropellantMass(tank) * TEMPERATURE

TEMPERATURE can be constant at ISO 1 temperature: 293 Kelvin.

But you may of course simulate solar heating and cooling of the tanks, if you are bored. That will get really complicated and will involve some differential equations to solve.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Thanks. Tank pressure is: 20684 kpa prop mass is 10.4
Temperature 293 K

But we don't have a Volume. The regulator pressure Regulated Pressure .................................224 - 271 psig
R_SPECIFIC=0.2968
so would Tank Constant=
R_SPECIFIC(10.4*Volume?
Thrust=min(p?/P_REG(250),1.0)*THRUST0 what is the p and thrust0?

I have this now:

th_rcs[0] = CreateThruster(_V(6, 0, 10), _V(0, -1, 0), MAXRCSTH, ph_main, ISP_QUI);

const double MAXRCSTH = 7.56;

const double ISP_QUI = 105000.0;
const double MAX_MAIN_FUEL = 10.4;
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
V would need to be calculated, I have no such parameter for the SPS or the MMU, but the full charge for the tanks of the MMU had been 40 lbs of N2, at 4500 psi and 70°F. If we convert this to SI units and solve for the volume, we get:

M = 28.012 (g/mol)
m = 18.1437 (kg)
n = m/M = 647.712 (mol)
P = 3.1026E7 (Pa)
T = 294.2 K
R = 8.31446261815324

[math]V = \frac{nRT}{P} = 0.051[/math]
So,its V=0.051 m³ or 51 liters of tank volume.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Thanks. So the center gauge really max should be 51 liters? I am trying to think how to convert the volume 51 liters to use it drop as thrusters are fired
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. So the center gauge really max should be 51 liters? I am trying to think how to convert the volume 51 liters to use it drop as thrusters are fired

No, make it up to 5000 psi pressure. That includes enough room for thermal expension effects and should be still higher than the burst pressure for the overpressure protection.

Let Orbiter handle the change in mass. The pressure regulator only allows an inlet pressure of 350 psi, from that point on, it might only act as a orifice plate restricting the flow. (As I understand, there is not enough backpressure then for closing the valve in the regulator), so when the inlet pressure drops below 350 psi, the outlet pressure would scale down as well. You could approximate this linear, though the pressure drop through an orifice plate is actually not linear.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Ok. So 5000psi.

with thruster here:
th_rcs[0] = CreateThruster(_V(6, 0, 10), _V(0, -1, 0), MAXRCSTH, ph_main, ISP_QUI);

const double MAXRCSTH = 7.56;

const double ISP_QUI = 105000.0;
const double MAX_MAIN_FUEL = 10.4;

ph_main = CreatePropellantResource(MAX_MAIN_FUEL); // main tank

So as thruster fire the ph main will go down. BUt how to get the 5000 to drop with thruster fire?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
By the pressure function for the main tank?

something like

Code:
private:
inline double GetTankPressure() const {
    return TANK_CONSTANT * GetPropellantMass(tank) * TEMPERATURE;
}
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,624
Reaction score
2,590
Points
203
Location
Dallas, TX
Thanks.

I have this:
h:
const double TEMPERATURE = 273; private: inline double GetTankPressure() const { return TANK_CONSTANT * GetPropellantMass(tank) * TEMPERATURE; } };

cpp:
in the poststep TANK_CONSTANT = R_SPECIFIC(10.4 * Volume); ... tank = CreatePropellantResource(MAX_MAIN_FUEL); // main tank // // th_rcs[0] = CreateThruster(_V(6, 0, 10), _V(0, -1, 0), MAXRCSTH, tank, ISP_QUI); AddExhaust(th_rcs[0], .5, 0.01, _V(.552, 1.203, 0), _V(0, 1, 0), tex_rcs);


Severity Code Description Project Path File Line Suppression State
Error C2064 term does not evaluate to a function taking 1 arguments SPS D:\Orbiter2016\Orbitersdk\samples\SPS2 - Copy D:\Orbiter2016\Orbitersdk\samples\SPS2 - Copy\SPS.CPP 719
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,564
Reaction score
2,298
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Why do you calculate TANK_CONSTANT in the poststep. It is constant for your spacecraft, the result of gas constant, N2 as gas (molar mass in kg) and the volume of the tank (in cubic meters). Those things shouldn't change (much).
 
Top