Beispiel #1
0
 private static (Vector2, Vector2) GetTextureOffsetAndScale(Vrm10TextureInfo textureInfo)
 {
     if (glTF_KHR_texture_transform.TryGet(textureInfo, out var textureTransform))
     {
         return(GltfMaterialImporter.GetTextureOffsetAndScale(textureTransform));
     }
     return(new Vector2(0, 0), new Vector2(1, 1));
 }
Beispiel #2
0
 private static bool TryGetLinearTexture(GltfParser parser, Vrm10TextureInfo info, out (SubAssetKey, TextureImportParam) pair)
 {
     try
     {
         var(offset, scale) = GetTextureOffsetAndScale(info);
         pair = GltfTextureImporter.CreateLinear(parser, info.index, offset, scale);
         return(true);
     }
     catch (NullReferenceException)
     {
         pair = default;
         return(false);
     }
     catch (ArgumentOutOfRangeException)
     {
         pair = default;
         return(false);
     }
 }
Beispiel #3
0
 private static bool TryGetSRGBTexture(GltfData data, Vrm10TextureInfo info, out (SubAssetKey, TextureDescriptor) pair)
 {
     try
     {
         var(offset, scale) = GetTextureOffsetAndScale(info);
         pair = GltfTextureImporter.CreateSrgb(data, info.index, offset, scale);
         return(true);
     }
     catch (NullReferenceException)
     {
         pair = default;
         return(false);
     }
     catch (ArgumentOutOfRangeException)
     {
         pair = default;
         return(false);
     }
 }