API Question oapiLoadMesh or oapiLoadMeshGlobal?

eveningsky339

Resident Orbiter Slave
Addon Developer
Donator
Joined
May 3, 2008
Messages
1,062
Reaction score
1
Points
0
Location
Western Maine
This goes back to my question regarding how I could go about jettisoning a resource module from a command module (think Apollo or CEV). I looked over francisdrake's CEV2 source code and I've been reading through the API, and I believe I know enough to build a function in order to do what I want.

I would like to use AddMesh to load a preloaded mesh (say, the resource module upon jettison). In order to load a preloaded mesh I obviously need to load it. My question is, should I use oapiLoadMesh or oapiLoadMeshGlobal?

I'm thinking about using oapiLoadMesh, because I can clean up a mesh with oapiDeleteMesh when I no longer need it.

Any suggestions?
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
The difference is this:

  • oapiLoadMeshGlobal loads the mesh from file and stores it as a "template" in memory. Each time the mesh is required (e.g. when the vessel using it enters into visual range of the camera) it is copied from this template.
  • oapiLoadMesh doesn't actually load anything. It just tells orbiter the file name for the mesh. Each time the mesh is required, it is reloaded from the file.
In other words, oapiLoadMeshGlobal caches the mesh file in memory, while oapiLoadMesh doesn't.

Generally, oapiLoadMeshGlobal is recommended for anything that has a reasonable chance of being created at least once during a simulation run (e.g. vessel meshes), because it avoids unnecessary file IO during the session.

oapiLoadMesh is better in situations where there is a good chance that the mesh may not be required at all for a large number of scenarios (e.g. for structures of a remote base), because it avoids initial loading and storage of the mesh template.
 

eveningsky339

Resident Orbiter Slave
Addon Developer
Donator
Joined
May 3, 2008
Messages
1,062
Reaction score
1
Points
0
Location
Western Maine
Heaven have mercy! I do believe the good doctor has stooped down and spoken to me. This calls for much feasting and celebration!

:10::stirpot::jawdrops::happybday::OMG:
















And I will give oapiLoadMeshGlobal a shot. Thank you for the advice.
 
Top