コード例 #1
0
        private void AddRenderableInternal(string id, string indoorMapName, IntPtr nativeRenderablePtr)
        {
            Mesh[]        meshes;
            DoubleVector3 originECEF;
            string        materialName;

            if (m_meshUploader.TryGetUnityMeshesForID(id, out meshes, out originECEF, out materialName))
            {
                var gameObjects = m_indoorMapStreamer.AddObjectsForMeshes(id, meshes, originECEF, Vector3.zero, Quaternion.identity, materialName);
                var descriptor  = new IndoorMaterialDescriptor(indoorMapName, materialName);
                var material    = m_indoorMapsApiInternal.IndoorMapMaterialFactory.CreateMaterialFromDescriptor(descriptor);

                foreach (var gameObject in gameObjects)
                {
                    gameObject.AddComponent <IndoorMapRenderable>().Init(nativeRenderablePtr, material, m_indoorMapsApiInternal);
                }
            }
            else
            {
                Debug.LogErrorFormat("ERROR: Could not get mesh for ID {0}.", id);
            }
        }
コード例 #2
0
        internal static void OnHighlightMeshUpload(IntPtr highlightIdPtr, ulong meshId, int highlightRequestId, IntPtr highlightPtr)
        {
            string highlightIdString = Marshal.PtrToStringAnsi(highlightIdPtr);

            HighlightInterop highlight       = MarshalHighlightInterop(highlightPtr);
            string           highlightMeshId = GetHighlightGameObjectId(highlightIdString, meshId);
            Mesh             mesh            = CreateHighlightMesh(highlightMeshId, highlight);

            var originEcef = new DoubleVector3(highlight.OriginEcefX, highlight.OriginEcefY, highlight.OriginEcefZ);

            HighlightStreamer.AddObjectsForMeshes(new Mesh[] { mesh }, originEcef, "highlight");

            var request = HighlightRequests[highlightRequestId];

            HighlightIdsToAdd.Add(highlightMeshId);
            var gameObject = HighlightStreamer.GetObjects(highlightMeshId)[0];

            gameObject.GetComponent <MeshRenderer>().sharedMaterial = request.material;
        }