public static TextureAsset LoadTexture(string fullpath) { if (fullpath == null) { return(GetDefault()); } if (!File.Exists(fullpath)) { Log.Core.Error("texture not found: " + fullpath); return(GetDefault()); } Bitmap image = new Bitmap(fullpath); image.RotateFlip(RotateFlipType.RotateNoneFlipY); TextureAsset textureAsset = new TextureAsset(); textureAsset.Path = fullpath; textureAsset.Name = Path.GetFileNameWithoutExtension(fullpath); textureAsset.Texture = new Texture(image); image.Dispose(); return(textureAsset); }
private static TextureAsset GetDefault() { if (defaultTextureAsset == null) { defaultTextureAsset = new TextureAsset(); defaultTextureAsset.Texture = new Texture(0xff00ff); } return(defaultTextureAsset); }