MG

Description

sealed class Tinman.AddOns.OpenFlight.MG

Derived from

NativeLibrary abstract

Full source code is included in the Tinman 3D SDK download.

Wraps the native libraries of the OpenFlight API.

Using the OpenFlight API in stand-alone mode requires that an application calls the mgInit / mgExit functions properly. These functions may only be called once per process. Consequently, the calls to these functions cannot be embedded in the initialization / shutdown scheme of Tinman 3D, which explicitly allows re-initialization after shutdown.

If an application wishes to use the OpenFlight API via OpenFlightModelFormat or OpenFlightSceneDataFormat, it must call the Begin and End methods accordingly. Calls to Begin and End must be balanced and may be nested. The OpenFlight API will only be available between the first call to Begin and the matching call to End. Subsequent calls to Begin can no longer enable the use of the OpenFlight API, as the mgInit / mgExit will already have been called by then.

Public / Methods

Add​Search​Path​Open​Flight


public static method AddSearchPathOpenFlight → (3)

openFlightApi opt : string = null

Path to the installation directory of the OpenFlight API. If null, the value of the environment variable PRESAGIS_OPENFLIGHT_API will be used instead.

path32 opt : string = "bin\\release"

Relative path to 32-bit release binaries.

path64 opt : string = "bin_x64\\release"

Relative path to 64-bit release binaries.

returns → bool

true if the resulting path is an existing directory and has been added to the search path with NativeLibrary.AddSearchPath,
false if not and the search path has not been updated.

Adds the default native library search path for the OpenFlight API.

This method uses LowLevel.Is64Bit to choose one of the given relative paths.

Begin


[ThreadSafe]
public static method Begin → ()

returns → bool

true if the OpenFlight API may be used and End must be called,
false if the API is unavailable and End does not need to be called.

The current process is going to use the OpenFlight API.

End


[ThreadSafe]
public static method End → ()

The current process is no longer using the OpenFlight API.

Calling this method when there is no matching call to Begin is allowed but has no effect. During shutdown (see TinmanModule.Shutdown), this method is called exactly once.

See also

MG.Begin

Public / Attributes

Debug​System​Messages


[DebugHelper] [ShutdownClear]
public static attribute DebugSystemMessages → (bool)

Allow the OpenFlight API to output error and warning messages?

The OpenFlight API outputs system messages to the standard output stream by default. This behaviour can be disabled. However, when doing so, the API sometimes does not return a message for the error of the most recent API call. As a result, the MG class will only be able to provide rudimentary details when throwing exceptions. Set this flag to true to get system messages and additional exception detail. Defaults to false.

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.