static OcclusionTextureInfo ExportOcclusionTextureInfo(
            UnityEngine.Texture texture,
            UnityEngine.Material material,
            IGltfWritable gltf
            )
        {
            var texture2d = texture as Texture2D;

            if (texture2d == null)
            {
                return(null);
            }
            var imageExport = new ImageExport(texture2d);

            if (AddImageExport(gltf, imageExport, out var textureId))
            {
                return(new OcclusionTextureInfo {
                    index = textureId
                });
            }
            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Export a Unity texture to a glTF.
        /// </summary>
        /// <param name="texture">Texture to export.</param>
        /// <param name="gltf">Context glTF to expor to</param>
        /// <param name="format">Desired image format</param>
        /// <returns>glTF texture info</returns>
        protected static TextureInfo ExportTextureInfo(
            UnityEngine.Texture texture,
            IGltfWritable gltf,
            ImageExportBase.Format format = ImageExportBase.Format.Unknown
            )
        {
            var texture2d = texture as Texture2D;

            if (texture2d == null)
            {
                return(null);
            }
            var imageExport = new ImageExport(texture2d, format);

            if (AddImageExport(gltf, imageExport, out var textureId))
            {
                return(new TextureInfo {
                    index = textureId,
                    // texCoord = 0 // TODO: figure out which UV set was used
                });
            }
            return(null);
        }
Esempio n. 3
0
 bool Equals(ImageExport other)
 {
     return(m_Texture == other.m_Texture);
 }