diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index c4dc97655..017a2b6dc 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -109,10 +109,6 @@ void UDriver::purgeMemory() // *************************************************************************** -// *************************************************************************** -bool CDriverUser::_StaticInit= false; - - // *************************************************************************** CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFunc) { @@ -122,16 +118,7 @@ CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFu nlassert((uint)IDriver::iconCount == (uint)UDriver::iconCount); - // Static Initialisation. - if(!_StaticInit) - { - _StaticInit= true; - // Register basic serial. - NL3D::registerSerial3d(); - - // Register basic csene. - CScene::registerBasics(); - } + NL3D::init3d(); _Driver = NULL; diff --git a/code/nel/src/3d/init_3d.cpp b/code/nel/src/3d/init_3d.cpp index bd8dffdfd..4ba439b73 100644 --- a/code/nel/src/3d/init_3d.cpp +++ b/code/nel/src/3d/init_3d.cpp @@ -19,18 +19,36 @@ #include "nel/3d/init_3d.h" #include +#include "nel/3d/scene.h" +#include "nel/3d/register_3d.h" + +namespace +{ +static bool _Initialized = false; +} namespace NL3D { void init3d () { + + if( _Initialized ) + return; + // Init for windows #ifdef NL_OS_WINDOWS // Enable FPU exceptions // Enable divid by zero and overflow exception - _control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM); + //_control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM); + + NL3D::registerSerial3d(); + CScene::registerBasics(); + + _Initialized = true; + + #endif // NL_OS_WINDOWS } diff --git a/code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp b/code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp index dce7ad08f..a4c948140 100644 --- a/code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp +++ b/code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp @@ -8,6 +8,7 @@ // NeL includes #include "nel/misc/debug.h" +#include "nel/3d/init_3d.h" // Qt includes #include @@ -32,6 +33,8 @@ bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManag { Q_UNUSED(errorString); _plugMan = pluginManager; + + NL3D::init3d(); Modules::init(); addAutoReleasedObject(new CObjectViewerContext()); addAutoReleasedObject(new GraphicsSettingsPage());