Exemple #1
0
        public void RequestTextureForMaterial(IIndoorMapMaterial material, string interiorName, string textureKey, string texturePath, bool isCubemap)
        {
            var request       = new StreamedTextureRequest(material, textureKey, m_textureObserver, this);
            var requestIntPtr = NativeInteropHelpers.AllocateNativeHandleForObject(request);

            NativeInteriorMaterials_IssueStreamedTextureRequest(NativePluginRunner.API, requestIntPtr, interiorName, material.MaterialInstance.name, texturePath, isCubemap);
        }
        public IndoorMapsApiInternal(IIndoorMapTextureStreamingService textureStreamingService, string indoorMapMaterialDirectory)
        {
            m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);

            IndoorMapTextureStreamingService = textureStreamingService;
            IndoorMapTextureFetcher          = new DefaultIndoorMapTextureFetcher(IndoorMapTextureStreamingService);
            IndoorMapMaterialFactory         = new DefaultIndoorMapMaterialFactory(indoorMapMaterialDirectory);
        }
Exemple #3
0
        internal IndoorMapScene(GameObjectStreamer indoorMapStreamer, MeshUploader meshUploader, IndoorMapMaterialService materialRepository, IndoorMapsApiInternal indoorMapsApiInternal)
        {
            m_indoorMapStreamer     = indoorMapStreamer;
            m_meshUploader          = meshUploader;
            m_materialRepository    = materialRepository;
            m_indoorMapsApiInternal = indoorMapsApiInternal;

            m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
        }
 internal MapGameObjectScene(GameObjectStreamer terrainStreamer, GameObjectStreamer roadStreamer, GameObjectStreamer buildingStreamer, GameObjectStreamer highlightStreamer, GameObjectStreamer indoorMapStreamer, MeshUploader meshUploader, IndoorMapScene indoorMapScene)
 {
     m_terrainStreamer   = terrainStreamer;
     m_roadStreamer      = roadStreamer;
     m_buildingStreamer  = buildingStreamer;
     m_highlightStreamer = highlightStreamer;
     m_indoorMapStreamer = indoorMapStreamer;
     m_meshUploader      = meshUploader;
     m_enabled           = true;
     m_handleToSelf      = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
Exemple #5
0
        private IntPtr CreateMaterialFromDescriptor(IndoorMaterialDescriptor descriptor)
        {
            var factory  = m_indoorMapsApiInternal.IndoorMapMaterialFactory;
            var material = factory.CreateMaterialFromDescriptor(descriptor);

            m_materialRepository.AddTemplateMaterial(material);

            var textureFetcher = m_indoorMapsApiInternal.IndoorMapTextureFetcher;

            textureFetcher.IssueTextureRequestsForMaterial(material, descriptor);

            return(NativeInteropHelpers.AllocateNativeHandleForObject(material));
        }
Exemple #6
0
        public LabelServiceInternal(GameObject unityCanvas, bool enabled)
        {
            if (unityCanvas == null)
            {
                if (enabled)
                {
                    Debug.LogWarning(
                        "No canvas was supplied to the label service.  Labels will not be displayed.\n" +
                        "If you require labels, please add a canvas called \"Canvas\" to the scene, using \n" +
                        "the \"Screen Space - Overlay\" render mode.");
                }
            }
            else
            {
                m_unityCanvas = unityCanvas.GetComponent <Canvas>();
            }

            m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
            m_enableLabels = enabled && m_unityCanvas != null;
        }
        public LabelServiceInternal(GameObject unityCanvas, bool enabled, TextureLoadHandler textureLoadHandler)
        {
            if (unityCanvas == null)
            {
                if (enabled)
                {
                    var newUnityCanvas = GameObject.Instantiate(UnityEngine.Resources.Load <GameObject>(CanvasPath));
                    newUnityCanvas.name = CanvasName;
                    newUnityCanvas.transform.SetAsFirstSibling();
                    m_unityCanvas   = newUnityCanvas.GetComponent <Canvas>();
                    m_spawnedCanvas = true;

                    ValidateFont();
                }
            }
            else
            {
                m_unityCanvas = unityCanvas.GetComponent <Canvas>();
            }

            m_handleToSelf       = NativeInteropHelpers.AllocateNativeHandleForObject(this);
            m_enableLabels       = enabled && m_unityCanvas != null;
            m_textureLoadHandler = textureLoadHandler;
        }
 internal PrecacheApiInternal()
 {
     m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
 internal ThreadService()
 {
     m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
Exemple #10
0
 internal PositionerApiInternal()
 {
     m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
Exemple #11
0
 public IndoorMapMaterialService(IndoorMapMaterialRepository materialRepository, IndoorMapsApiInternal indoorMapsApiInternal)
 {
     m_materialRepository    = materialRepository;
     m_indoorMapsApiInternal = indoorMapsApiInternal;
     m_handleToSelf          = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
Exemple #12
0
        public ApiImplementation(string apiKey, CoordinateSystem coordinateSystem, Transform parentTransformForStreamedObjects, ConfigParams configParams)
        {
            var textureLoadHandler = new TextureLoadHandler();
            var materialRepository = new MaterialRepository(configParams.MaterialsDirectory, configParams.OverrideLandmarkMaterial, textureLoadHandler);

            var terrainCollision  = (configParams.Collisions.TerrainCollision) ? CollisionStreamingType.SingleSidedCollision : CollisionStreamingType.NoCollision;
            var roadCollision     = (configParams.Collisions.RoadCollision) ? CollisionStreamingType.DoubleSidedCollision : CollisionStreamingType.NoCollision;
            var buildingCollision = (configParams.Collisions.BuildingCollision) ? CollisionStreamingType.SingleSidedCollision : CollisionStreamingType.NoCollision;

            m_root = CreateRootObject(parentTransformForStreamedObjects);

            m_interestPointProvider = new InterestPointProvider(m_root.transform);

            m_terrainStreamer   = new GameObjectStreamer("Terrain", materialRepository, m_root.transform, terrainCollision, true, configParams.UploadMeshesToGPU);
            m_roadStreamer      = new GameObjectStreamer("Roads", materialRepository, m_root.transform, roadCollision, true, configParams.UploadMeshesToGPU);
            m_buildingStreamer  = new GameObjectStreamer("Buildings", materialRepository, m_root.transform, buildingCollision, true, configParams.UploadMeshesToGPU);
            m_highlightStreamer = new GameObjectStreamer("Highlights", materialRepository, m_root.transform, CollisionStreamingType.NoCollision, false, configParams.UploadMeshesToGPU);
            m_indoorMapStreamer = new GameObjectStreamer("IndoorMaps", materialRepository, m_root.transform, CollisionStreamingType.NoCollision, false, configParams.UploadMeshesToGPU);

            var indoorMapMaterialRepository = new IndoorMapMaterialRepository();

            var indoorMapStreamedTextureObserver = new IndoorMapStreamedTextureObserver(indoorMapMaterialRepository);
            var indoorMapTextureStreamingService = new IndoorMapTextureStreamingService(textureLoadHandler, indoorMapStreamedTextureObserver);

            m_indoorMapsApiInternal = new IndoorMapsApiInternal(indoorMapTextureStreamingService, configParams.IndoorMapMaterialsDirectory);
            var indoorMapMaterialService = new IndoorMapMaterialService(indoorMapMaterialRepository, m_indoorMapsApiInternal);

            m_indoorMapsApi = new IndoorMapsApi(m_indoorMapsApiInternal);

            m_indoorMapEntityInformationApiInternal = new IndoorMapEntityInformationApiInternal();
            m_indoorMapEntityInformationApi         = new IndoorMapEntityInformationApi(m_indoorMapEntityInformationApiInternal);

            var meshUploader   = new MeshUploader();
            var indoorMapScene = new IndoorMapScene(m_indoorMapStreamer, meshUploader, indoorMapMaterialService, m_indoorMapsApiInternal);

            m_mapGameObjectScene   = new MapGameObjectScene(m_terrainStreamer, m_roadStreamer, m_buildingStreamer, m_highlightStreamer, m_indoorMapStreamer, meshUploader, indoorMapScene);
            m_labelServiceInternal = new LabelServiceInternal(configParams.LabelCanvas, configParams.EnableLabels, textureLoadHandler);

            m_positionerApiInternal = new PositionerApiInternal();
            m_positionerApi         = new PositionerApi(m_positionerApiInternal);

            m_cameraApiInternal = new CameraApiInternal();

            m_buildingsApiInternal = new BuildingsApiInternal(materialRepository);
            m_buildingsApi         = new BuildingsApi(m_buildingsApiInternal);

            m_precacheApiInternal = new PrecacheApiInternal();
            m_precacheApi         = new PrecacheApi(m_precacheApiInternal);

            m_propsApiInternal = new PropsApiInternal();
            m_propsApi         = new PropsApi(m_propsApiInternal);

            m_transportApiInternal = new TransportApiInternal();
            m_transportApi         = new TransportApi(m_transportApiInternal);

            m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);

            m_nativePluginRunner = new NativePluginRunner(
                apiKey,
                textureLoadHandler,
                materialRepository,
                m_mapGameObjectScene,
                configParams,
                indoorMapScene,
                m_indoorMapsApiInternal,
                indoorMapMaterialService,
                m_labelServiceInternal,
                m_positionerApiInternal,
                m_cameraApiInternal,
                m_buildingsApiInternal,
                m_precacheApiInternal,
                m_transportApiInternal,
                m_indoorMapEntityInformationApiInternal,
                m_handleToSelf
                );

            m_cameraApi = new CameraApi(this, m_cameraApiInternal);

            m_coordinateSystem = coordinateSystem;
            var defaultStartingLocation = LatLongAltitude.FromDegrees(
                configParams.LatitudeDegrees,
                configParams.LongitudeDegrees,
                coordinateSystem == CoordinateSystem.ECEF ? configParams.DistanceToInterest : 0.0);

            m_originECEF = defaultStartingLocation.ToECEF();

            if (coordinateSystem == CoordinateSystem.UnityWorld)
            {
                m_frame = new UnityWorldSpaceCoordinateFrame(defaultStartingLocation);
            }

            m_geographicApi = new GeographicApi(m_root.transform);

            m_environmentFlatteningApiInternal = new EnvironmentFlatteningApiInternal();
            m_environmentFlatteningApi         = new EnvironmentFlatteningApi(m_environmentFlatteningApiInternal);

            m_pathApiInternal = new PathApiInternal();
            m_pathApi         = new PathApi(m_pathApiInternal);

            m_spacesApi = new SpacesApi(this);

            if (m_coordinateSystem == CoordinateSystem.UnityWorld)
            {
                m_transformUpdateStrategy = new UnityWorldSpaceTransformUpdateStrategy(m_frame, m_environmentFlatteningApi.GetCurrentScale());
            }
            else
            {
                var cameraPosition = m_originECEF;
                m_transformUpdateStrategy = new ECEFTransformUpdateStrategy(
                    cameraPosition,
                    cameraPosition.normalized.ToSingleVector(),
                    m_environmentFlatteningApi.GetCurrentScale());
            }
        }
 internal IndoorMapEntityInformationApiInternal()
 {
     m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
 internal BuildingsApiInternal(MaterialRepository materialRepository)
 {
     m_materialRepository = materialRepository;
     m_handleToSelf       = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
Exemple #15
0
 public TextureLoadHandler()
 {
     m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }
 internal TransportApiInternal()
 {
     m_handleToSelf = NativeInteropHelpers.AllocateNativeHandleForObject(this);
 }