private void AddInstancedRenderableInternal(string id, string interiorName, int transformCount, Vector3[] positionOffsets, Quaternion[] orientations, IntPtr nativeRenderablePtr) { Mesh[] meshes; DoubleVector3 originECEF; string materialName; if (m_meshUploader.TryGetUnityMeshesForID(id, out meshes, out originECEF, out materialName)) { var descriptor = new IndoorMaterialDescriptor(interiorName, materialName); for (int transformIndex = 0; transformIndex < transformCount; ++transformIndex) { string instanceId = id + string.Format("_instance_{0}", transformIndex); var gameObjects = m_indoorMapStreamer.AddObjectsForMeshes(instanceId, meshes, originECEF, positionOffsets[transformIndex], orientations[transformIndex], materialName); var material = m_indoorMapsApiInternal.IndoorMapMaterialFactory.CreateMaterialFromDescriptor(descriptor); foreach (var gameObject in gameObjects) { gameObject.AddComponent <InstancedIndoorMapRenderable>().Init(transformIndex, nativeRenderablePtr, material, m_indoorMapsApiInternal); } } } else { Debug.LogErrorFormat("ERROR: Could not get mesh for ID {0}.", id); } }
public void IssueTextureRequestsForMaterial(IIndoorMapMaterial material, IndoorMaterialDescriptor descriptor) { string texturePath; var key = "DiffuseTexturePath"; if (descriptor.Strings.TryGetValue(key, out texturePath)) { m_textureStreamingService.RequestTextureForMaterial(material, descriptor.IndoorMapName, key, texturePath, false); } var cubeMapKey = "CubeMapTexturePath"; string cubeMapTexturePath; if (descriptor.Strings.TryGetValue(cubeMapKey, out cubeMapTexturePath)) { if (!string.IsNullOrEmpty(cubeMapTexturePath)) { m_textureStreamingService.RequestTextureForMaterial(material, descriptor.IndoorMapName, cubeMapKey, cubeMapTexturePath, true); } } }
private void AddHighlightRenderableInternal(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 <IndoorMapHighlightRenderable>().Init(nativeRenderablePtr, material, m_indoorMapsApiInternal); } } else { Debug.LogErrorFormat("ERROR: Could not get mesh for ID {0}.", id); } }
public void IssueTextureRequestsForMaterial(IIndoorMapMaterial material, IndoorMaterialDescriptor descriptor) { // do nothing, we won't bother with a texture for these materials - see DefaultIndoorMaterialFactory for an example where textures do get loaded }
public IIndoorMapMaterial CreateMaterialFromDescriptor(IndoorMaterialDescriptor descriptor) { var material = new Material(m_sourceMaterial); return(new CustomIndoorMapMaterial(material)); }