Esempio n. 1
0
        /// <summary>
        /// Creates an instance of <see cref="ReconstructionOnlyEnvironmentReset"/> class.
        /// </summary>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        public ReconstructionOnlyEnvironmentReset(IMetaReconstruction metaReconstruction)
        {
            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }

            _metaReconstruction = metaReconstruction;
        }
Esempio n. 2
0
        /// <summary>
        /// Starts the environment reconstruction scanning process.
        /// </summary>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        public void StartScanning(IMetaReconstruction metaReconstruction)
        {
            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }

            _metaReconstruction = metaReconstruction;
            Initialize();
        }
Esempio n. 3
0
        private IEnvironmentInitializer CreateRelocalizationInactiveInitializer(bool surfaceReconstructionActive)
        {
            if (!surfaceReconstructionActive)
            {
                return(CreateDefaultInitializer());
            }

            IMetaReconstruction        metaReconstruction = _metaContext.Get <IMetaReconstruction>();
            IEnvironmentInitialization initialization     = new ReconstructionOnlyEnvironmentInitialization(_slamLocalizer, metaReconstruction, _environmentScanControllerPrefab);
            IEnvironmentReset          environmentReset   = new ReconstructionOnlyEnvironmentReset(metaReconstruction);

            return(new EnvironmentInitializer(initialization, environmentReset, _metaLocalization));
        }
        /// <summary>
        /// Creates an instance of <see cref="EnvironmentReconstructionSaverStep"/> class.
        /// </summary>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        /// <param name="environmentProfileRepository">Repository to access to the environment profiles.</param>
        public EnvironmentReconstructionSaverStep(IMetaReconstruction metaReconstruction, IEnvironmentProfileRepository environmentProfileRepository)
        {
            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }
            if (environmentProfileRepository == null)
            {
                throw new ArgumentNullException("environmentProfileRepository");
            }

            _environmentProfileRepository = environmentProfileRepository;
            _metaReconstruction           = metaReconstruction;
        }
        /// <summary>
        /// Creates an instance of <see cref="EnvironmentReconstructionInitializerStep"/> class.
        /// </summary>
        /// <param name="scanSelectorProxy">Accessor to the the environment reconstruction scanning process.</param>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        public EnvironmentReconstructionInitializerStep(IMonoBehaviourProxy <BaseEnvironmentScanController> scanSelectorProxy, IMetaReconstruction metaReconstruction)
        {
            if (scanSelectorProxy == null)
            {
                throw new ArgumentNullException("scanSelectorProxy");
            }

            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }

            _metaReconstruction = metaReconstruction;
            _scanSelectorProxy  = scanSelectorProxy;
        }
        /// <summary>
        /// Creates an instance of <see cref="DefaultEnvironmentReset"/> class.
        /// </summary>
        /// <param name="environmentProfileRepository">Repository to access to the environment profiles.</param>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        public DefaultEnvironmentReset(IEnvironmentProfileRepository environmentProfileRepository, IMetaReconstruction metaReconstruction)
        {
            if (environmentProfileRepository == null)
            {
                throw new ArgumentNullException("environmentProfileRepository");
            }

            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }

            _environmentProfileRepository = environmentProfileRepository;
            _metaReconstruction           = metaReconstruction;
        }
        private void FixMetaReconstructionPrefab(EnvironmentConfiguration environmentConfiguration, Transform previousMetaReconstructionPrefab)
        {
            if (!Application.isPlaying)
            {
                Transform currentMetaReconstructionPrefab = environmentConfiguration.MetaReconstructionPrefab;

                if (currentMetaReconstructionPrefab != null)
                {
                    IMetaReconstruction metaReconstruction = environmentConfiguration.MetaReconstructionPrefab.GetComponent <IMetaReconstruction>();
                    if (metaReconstruction == null)
                    {
                        environmentConfiguration.MetaReconstructionPrefab = previousMetaReconstructionPrefab;
                    }
                }
            }
        }
        /// <summary>
        /// Creates an instance of <see cref="NewDefaultEnvironmentWithReconstructionInitialization"/> class.
        /// </summary>
        /// <param name="slamLocalizer">Slam type localizer.</param>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        /// <param name="scanControllerPrefab">Triggerer of the the environment reconstruction scanning process.</param>
        public ReconstructionOnlyEnvironmentInitialization(ISlamLocalizer slamLocalizer, IMetaReconstruction metaReconstruction, BaseEnvironmentScanController scanControllerPrefab)
        {
            if (scanControllerPrefab == null)
            {
                throw new ArgumentNullException("scanControllerPrefab");
            }
            if (slamLocalizer == null)
            {
                throw new ArgumentNullException("slamLocalizer");
            }
            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }

            _metaReconstruction   = metaReconstruction;
            _slamLocalizer        = slamLocalizer;
            _scanControllerPrefab = scanControllerPrefab;
        }
Esempio n. 9
0
        /// <summary>
        /// Creates an instance of <see cref="SelectedEnvironmentWithReconstructionInitialization"/> class.
        /// </summary>
        /// <param name="environmentProfileRepository">Repository to access to the environment profiles.</param>
        /// <param name="slamLocalizer">Slam type localizer.</param>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        public SelectedEnvironmentWithReconstructionInitialization(IEnvironmentProfileRepository environmentProfileRepository, ISlamLocalizer slamLocalizer, IMetaReconstruction metaMetaReconstruction)
        {
            if (metaMetaReconstruction == null)
            {
                throw new ArgumentNullException("metaMetaReconstruction");
            }
            if (slamLocalizer == null)
            {
                throw new ArgumentNullException("slamLocalizer");
            }
            if (environmentProfileRepository == null)
            {
                throw new ArgumentNullException("environmentProfileRepository");
            }

            _environmentProfileRepository = environmentProfileRepository;
            _slamLocalizer      = slamLocalizer;
            _metaReconstruction = metaMetaReconstruction;
        }
Esempio n. 10
0
        private IEnvironmentInitializer CreateDefaultProfileInitializer(bool surfaceReconstructionActive)
        {
            ISlamChecker slamChecker = new SlamChecker(_slamLocalizer);
            IEnvironmentProfileSelector       environmentProfileSelector = new DefaultEnvironmentProfileSelector(_environmentProfileRepository, slamChecker);
            IEnvironmentInitializationFactory environmentInitializationFactory;
            IEnvironmentReset environmentReset;

            if (surfaceReconstructionActive)
            {
                IMetaReconstruction metaReconstruction = _metaContext.Get <IMetaReconstruction>();
                environmentInitializationFactory = new DefaultEnvironmentWithReconstructionInitializationFactory(_environmentProfileRepository, _slamLocalizer, metaReconstruction, _environmentScanControllerPrefab);
                environmentReset = new DefaultEnvironmentReset(_environmentProfileRepository, metaReconstruction);
            }
            else
            {
                environmentInitializationFactory = new DefaultEnvironmentInitializationFactory(_environmentProfileRepository, _slamLocalizer);
                environmentReset = new DefaultEnvironmentReset(_environmentProfileRepository);
            }
            return(new EnvironmentProfileInitializer(environmentProfileSelector, environmentInitializationFactory, environmentReset, _metaLocalization));
        }
Esempio n. 11
0
        /// <summary>
        /// Creates an <see cref="IEnvironmentInitializer"/> for the given environment selection result.
        /// </summary>
        /// <param name="environmentInitializaterType">The environment initializer type.</param>
        /// <returns>The environment initializer for the given environment initializer type.</returns>
        public IMetaReconstruction Create(Transform parent)
        {
            Transform metaReconstructionTransform = MonoBehaviour.Instantiate(_metaReconstructionPrefab);

            metaReconstructionTransform.parent   = parent;
            metaReconstructionTransform.position = Vector3.zero;

            IMetaReconstruction metaReconstruction = metaReconstructionTransform.GetComponent <IMetaReconstruction>();

            if (metaReconstruction != null)
            {
                if (!_metaContext.ContainsModule <IMetaReconstruction>())
                {
                    _metaContext.Add(metaReconstruction);
                }
                _metaContext.Add <IMeshGenerator>(new MeshGenerator(true, EnvironmentConstants.MaxTriangles));
                _metaContext.Add <IModelFileManipulator>(new OBJFileManipulator());
            }

            return(metaReconstruction);
        }
        /// <summary>
        /// Creates an instance of <see cref="DefaultEnvironmentWithReconstructionInitializationFactory"/> class.
        /// </summary>
        /// <param name="environmentProfileRepository">Repository to access to the environment profiles.</param>
        /// <param name="slamLocalizer">Slam type localizer. If null, means that other localizer was selected.</param>
        /// <param name="metaReconstruction">Object that manages the environment reconstruction.</param>
        /// <param name="scanControllerPrefab">Triggerer of the the environment reconstruction scanning process.</param>
        public DefaultEnvironmentWithReconstructionInitializationFactory(IEnvironmentProfileRepository environmentProfileRepository, ISlamLocalizer slamLocalizer, IMetaReconstruction metaReconstruction, BaseEnvironmentScanController scanControllerPrefab)
        {
            if (environmentProfileRepository == null)
            {
                throw new ArgumentNullException("environmentProfileRepository");
            }

            if (scanControllerPrefab == null)
            {
                throw new ArgumentNullException("scanControllerPrefab");
            }

            if (metaReconstruction == null)
            {
                throw new ArgumentNullException("metaReconstruction");
            }

            _environmentProfileRepository = environmentProfileRepository;
            _slamLocalizer        = slamLocalizer;
            _scanControllerPrefab = scanControllerPrefab;
            _metaReconstruction   = metaReconstruction;
        }