public static ImageTexture FromGltf(this VrmProtobuf.Texture x, VrmProtobuf.Sampler sampler, List <Image> images, Texture.ColorSpaceTypes colorSpace, Texture.TextureTypes textureType) { var image = images[x.Source.Value]; var name = !string.IsNullOrEmpty(x.Name) ? x.Name : image.Name; return(new ImageTexture(x.Name, sampler.FromGltf(), image, colorSpace, textureType)); }
public static TextureSampler FromGltf(this VrmProtobuf.Sampler sampler) { return(new TextureSampler { WrapS = (TextureWrapType)sampler.WrapS.GetValueOrDefault(), WrapT = (TextureWrapType)sampler.WrapT.GetValueOrDefault(), MinFilter = (TextureMinFilterType)sampler.MinFilter.GetValueOrDefault(), MagFilter = (TextureMagFilterType)sampler.MagFilter.GetValueOrDefault(), }); }