//IOpsCommand public void Run(OpsContext context, OpsStatement statement) { TexLoaderArgs texArgs = statement.Arguments as TexLoaderArgs; string[] paths = OpsHelpers.ResolvePathToMany(texArgs.Path as string); foreach (string path in paths) { OpsConsole.WriteLine("Loading texture from file: \"{0}\"", path); OpsTexture result = new OpsTexture(); ImageInformation Info = TextureLoader.ImageInformationFromFile(path); result.SRGB = texArgs.SRGB; if (Info.ResourceType == ResourceType.Textures) { result.Texture = TextureLoader.FromFile(context.Device, path); } else if (Info.ResourceType == ResourceType.VolumeTexture) { result.Texture = TextureLoader.FromVolumeFile(context.Device, path); } else if (Info.ResourceType == ResourceType.CubeTexture) { result.Texture = TextureLoader.FromCubeFile(context.Device, path); } result.Name = System.IO.Path.GetFileNameWithoutExtension(path); context.AddTexture(result); } }
//IOpsCommand public void Run(OpsContext context, OpsStatement statement) { string[] paths = OpsHelpers.ResolvePathToMany(statement.Arguments as string); foreach (string path in paths) { OpsConsole.WriteLine("Loading model from file: \"{0}\"", path); OpsModel model = OpsModel.FromFile(context.Device, path); context.AddModel(model); } }