Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc.

Reply
 
Thread Tools
Old 03-20-2018, 10:36 PM   #61
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So How to change the mesh based off the scn?

I have the default mesh set to Atlantis.

OV=104;
void Atlantis::LoadMeshes()
{
// Retrieve mesh handles
//hOrbiterMesh = oapiLoadMeshGlobal ("2016SPACESHUTTLE\\Columbia\\Columbia2016A");
//hOrbiterCockpitMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Co lumbiaCockpit");
//hOrbiterVCMesh = oapiLoadMeshGlobal ("2016SPACESHUTTLE\\Columbia\\ColumbiaVC");
if (OV==104)hOrbiterMesh = oapiLoadMeshGlobal("Atlantis\\Atlantis");
hOrbiterCockpitMesh = oapiLoadMeshGlobal("Atlantis\\AtlantisCockpit");
hOrbiterVCMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\ShuttleVC5B" );
hOrbiterODSMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\ODS");
hOrbiterRMS1Mesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\RMS1");

// Load meshes
mesh_cockpit = AddMesh(hOrbiterCockpitMesh);
SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);

mesh_orbiter = AddMesh(hOrbiterMesh);
SetMeshVisibilityMode(mesh_orbiter, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);

mesh_vc = AddMesh(hOrbiterVCMesh);
SetMeshVisibilityMode(mesh_vc, MESHVIS_VC) ;

mesh_ODS = AddMesh(hOrbiterODSMesh);
SetMeshVisibilityMode(mesh_ODS, MESHVIS_NEVER);

mesh_RMS1 = AddMesh(hOrbiterRMS1Mesh);
SetMeshVisibilityMode(mesh_RMS1, MESHVIS_NEVER);


//ShiftMesh(2, _V(0.01, -0.0380, -.4125));

// Optonal meshes
mesh_cargo = NULL;
mesh_platform = NULL;

// Visual handle
vis = NULL;
}
[/CODE]

Then change the mesh handle based on OV;

Code:
void Atlantis::clbkLoadStateEx (FILEHANDLE scn, void *vs)
{

			if (!_strnicmp(line, "OV", 2)) {
				sscanf(line + 2, "%d", &OV);

				if (OV == 102)	hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Columbia2016C");
				if (OV == 104)	hOrbiterMesh = oapiLoadMeshGlobal("Atlantis\\Atlantis");

				//SetMeshVisibilityMode(mesh_orbiter, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
				LoadMeshes();
			}

i GET A CTD WITH

============================ ERROR: ===========================
Mesh not found: .\Meshes\.msh
[LoadMesh | .\Mesh.cpp | 1269]
================================================== =============

---------- Post added at 05:36 PM ---------- Previous post was at 06:09 AM ----------

So I have this:
Code:
void Atlantis::LoadMeshes()
{
	// Retrieve mesh handles
	if (OV == 102)	hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Columbia2016C");
	else if (OV == 104)	hOrbiterMesh = oapiLoadMeshGlobal("Atlantis\\Atlantis");
	else hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Constellation\\Constellation2016C");
As I understand it. If the value is 102 then load Columbia or 104 then load Atlantis else load Constellation.
In the scn
Code:
STS-1:Shuttle2016A
  STATUS Landed Earth
  POS -80.6208630 28.6270927
  HEADING 180.57
  ALT 0.000
  AROT 99.922 -54.902 51.216
  ATTACHED 0:0,ET-1
  PRPLEVEL 0:1.000000
  NAVFREQ 0 0
  CONFIGURATION 3
  GEAR 0 0.0000
  HATCH 0 0.0000
  Armtilt 0 0.0000
  ODS 0 
  EVA 0 
  OV 102
In the h:
Code:
int OV;

Animation because I am loading more meshes the index is bad.
Code:
void Atlantis::DefineAnimations (void)
{

	UINT midx = mesh_orbiter; // mesh index for all external animations
	UINT vidx = mesh_vc; // mesh index for all VC animations
	UINT ridx = mesh_RMS1; // mesh index for all rms animations
Code:
Atlantis::Atlantis (OBJHANDLE hObj, int fmodel)
: VESSEL4 (hObj, fmodel)
{
#ifdef _DEBUG
        // D. Beachy: for BoundsChecker debugging
        GrowStack();
#endif
	int i;

	plop            = new PayloadBayOp (this);
//	ascap           = new AscentAP (this);
//	ascapMfdId      = RegisterAscentApMfd ();
	status          = 3;
	gear_status     = AnimState::CLOSED;
	gear_proc       = 0.0;
	ldoor_drag      = rdoor_drag = 0.0;
	spdb_status     = AnimState::CLOSED;
	spdb_proc       = 0.0;
	//light
	light_status = 0;
	aft_light_status = 0;
	rmslight_status = 0;
	//
	engine_light_level = 0.0;
	COLOUR4 col_diff = {1,0.8,0.8,0};
	COLOUR4 col_zero = {0,0,0,0};
	engine_light = AddPointLight (_V(0,0,-25), 300, 2e-4, 0, 4e-4, col_diff, col_zero, col_zero);
	engine_light->SetIntensityRef (&engine_light_level);
	ARM_OPERATING_SPEED = .005;
	OV = 104;
	LoadMeshes();
	reset_sat       = false;
	render_cockpit  = false;

	for (i = 0; i < 10; i++)
		mfdbright[i] = 1.0;
So now it shows the mesh for Ov=104.. Not sure how to reload with the correct mesh

Fixed

I cleared the mesh and reload the correct one and the end of the load state:
Code:
	ClearMeshes();//clear meshes
	LoadMeshes();//load correct meshes
}

Last edited by gattispilot; 03-20-2018 at 11:48 PM.
gattispilot is offline   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 05:48 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.