Example #1
0
        public bool InitializeInternal()
        {
            _actionReceiver = new NodeAction("DynamicLoadManager");

            _actionReceiver.OnAction += ActionReceiver_OnAction;

            _zflipMatrix = new Matrix4x4(new Vector4(1, 0, 0), new Vector4(0, 1, 0), new Vector4(0, 0, -1), new Vector4(0, 0, 0, 1));

            GizmoSDK.GizmoBase.Message.Send("SceneManager", MessageLevel.DEBUG, "Loading Graph");

            NodeLock.WaitLockEdit();

            try // We are now locked in edit
            {
                _native_camera              = new PerspCamera("Test");
                _native_camera.RoiPosition  = true;
                MapControl.SystemMap.Camera = _native_camera;

                _native_scene = new Scene("TestScene");

                _native_context = new Context();

#if DEBUG_CAMERA
                _native_camera.Debug(_native_context);      // Enable to debug view
#endif // DEBUG_CAMERA

                _native_traverse_action = new CullTraverseAction();

                DynamicLoader.OnDynamicLoad += DynamicLoader_OnDynamicLoad;

                _native_camera.Scene = _native_scene;
            }
            finally
            {
                NodeLock.UnLock();
            }


            DynamicLoader.UsePreCache(true);                    // Enable use of mipmap creation on dynamic loading
            DynamicLoaderManager.SetNumberOfActiveLoaders(4);   // Lets start with 4 parallell threads
            DynamicLoaderManager.StartManager();

            return(true);
        }
        public bool InitializeInternal()
        {
            // Initialize streamer APIs
            if (!GizmoSDK.Gizmo3D.Platform.Initialize())
            {
                return(false);
            }

            // Initialize formats
            DbManager.Initialize();

            GizmoSDK.GizmoBase.Message.Send("SceneManager", MessageLevel.DEBUG, "Initialize Graph Streaming");

            // Add builder for registered types
            AddDefaultBuilders();

            // Setup internal subscription events
            _actionReceiver           = new NodeAction("DynamicLoadManager");
            _actionReceiver.OnAction += ActionReceiver_OnAction;

            DynamicLoader.OnDynamicLoad += DynamicLoader_OnDynamicLoad;


            NodeLock.WaitLockEdit();

            try // We are now locked in edit
            {
                // Camera setup
                _native_camera              = new PerspCamera("Test");
                _native_camera.RoiPosition  = true;
                MapControl.SystemMap.Camera = _native_camera;

                // Top scene
                _native_scene        = new Scene("Scene");
                _native_camera.Scene = _native_scene;

                // Top context
                _native_context = new Context();

#if DEBUG_CAMERA
                // If we want to visualize debug 3D
                _native_camera.Debug(_native_context);      // Enable to debug view
#endif // DEBUG_CAMERA

                // Default travrser
                _native_traverse_action = new CullTraverseAction();

                // _native_traverse_action.SetOmniTraverser(true);  // To skip camera cull and use LOD in omni directions
            }
            finally
            {
                NodeLock.UnLock();
            }

            // Set up dynamic loading
            DynamicLoader.UsePreCache(true);                                        // Enable use of mipmap creation on dynamic loading
            DynamicLoaderManager.SetNumberOfActiveLoaders(Settings.DynamicLoaders); // Lets start with 4 parallell threads
            DynamicLoaderManager.StartManager();

            // Start coroutines for asset loading
            StartCoroutine(AssetLoader());

            return(true);
        }