Example #1
0
void dCloseODE()
{
	dIASSERT(g_bODEInitialized); // dCloseODE must not be called without dInitODEEx or if dInitODEEx fails

	g_bODEInitialized = false;

	dClearPosrCache();
	dFinitUserClasses();
	dFinitColliders();

#if dTRIMESH_ENABLED && dTRIMESH_GIMPACT
	gimpact_terminate();
#endif

#if dTRIMESH_ENABLED && dTRIMESH_OPCODE
	extern void opcode_collider_cleanup();
	// Free up static allocations in opcode
	opcode_collider_cleanup();

	Opcode::CloseOpcode();
#endif

#if dTLS_ENABLED
	COdeTls::Finalize();
#endif

#if dATOMICS_ENABLED
	COdeOu::FinalizeAtomics();
#endif

#if dOU_ENABLED
	COdeOu::UndoOUCustomizations();
#endif
}
Example #2
0
static void CloseODEForMode(EODEINITMODE imInitMode)
{
    bool bAnyModeStillInitialized = IsODEAnyModeInitialized();

    if (!bAnyModeStillInitialized)
    {
        dClearPosrCache();
        dFinitUserClasses();
        dFinitColliders();

#if dTRIMESH_ENABLED && dTRIMESH_GIMPACT
        gimpact_terminate();
#endif

#if dTRIMESH_ENABLED && dTRIMESH_OPCODE
        extern void opcode_collider_cleanup();
        // Free up static allocations in opcode
        opcode_collider_cleanup();

        Opcode::CloseOpcode();
#endif

        dxWorld::FinalizeDefaultThreading();
    }

#if dTLS_ENABLED
    EODETLSKIND tkTLSKindToFinalize = g_atkTLSKindsByInitMode[imInitMode];
    COdeTls::Finalize(tkTLSKindToFinalize);
#else
    (void)imInitMode; // unused
#endif

    if (!bAnyModeStillInitialized)
    {
#if dATOMICS_ENABLED
        COdeOu::FinalizeAtomics();
#endif

#if dOU_ENABLED
        COdeOu::UndoOUCustomizations();
#endif
    }
}