private Texture GetOrAddTexture(Dictionary <string, Texture> absolutePathTextureLookup, string importedGeometryDirectory, string texturePath) { if (string.IsNullOrEmpty(texturePath)) { return(null); } string absolutePath = Path.GetFullPath(Path.Combine(importedGeometryDirectory, texturePath)); // Is this texture already loaded? { Texture texture; if (absolutePathTextureLookup.TryGetValue(absolutePath, out texture)) { // Make sure the texture is already listed under this object var importedGeometryTexture = texture as ImportedGeometryTexture; if (importedGeometryTexture != null && !Textures.Contains(importedGeometryTexture)) { Textures.Add(importedGeometryTexture); } // Use texture return(texture); } } // Add a new imported geometry texture var newTexture = new ImportedGeometryTexture(absolutePath); Textures.Add(newTexture); absolutePathTextureLookup.Add(absolutePath, newTexture); return(newTexture); }
public void Assign(ImportedGeometryTexture other) { AbsolutePath = other.AbsolutePath; Image = other.Image; DirectXTexture = other.DirectXTexture; }
private ImportedGeometryTexture(ImportedGeometryTexture other) { DirectXTexture = other.DirectXTexture; AbsolutePath = other.AbsolutePath; Image = other.Image; }