Skip to content

Commit

Permalink
expose mesh cache and GetMeshId
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Nov 1, 2023
1 parent 3571f02 commit 6e751b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Runtime/Scripts/GLTFSceneExporter.cs
Expand Up @@ -1146,6 +1146,20 @@ public TextureId GetTextureId(GLTFRoot root, UniqueTexture textureObj)
}
return null;
}

public MeshId GetMeshId(Mesh meshObj)
{
foreach (var primOwner in _primOwner)
{
// Not sure if this is entirely accurate – we're returning the first instance here.
if (primOwner.Key.Mesh == meshObj)
{
return primOwner.Value;
}
}

return null;
}

public ImageId GetImageId(GLTFRoot root, Texture imageObj, TextureExportSettings textureMapType)
{
Expand Down
1 change: 1 addition & 0 deletions Runtime/Scripts/GLTFSceneImporter.cs
Expand Up @@ -223,6 +223,7 @@ public GameObject LastLoadedScene
public MaterialCacheData[] MaterialCache => _assetCache.MaterialCache;
public AnimationCacheData[] AnimationCache => _assetCache.AnimationCache;
public GameObject[] NodeCache => _assetCache.NodeCache;
public MeshCacheData[] MeshCache => _assetCache.MeshCache;

/// <summary>
/// Whether to keep a CPU-side copy of the mesh after upload to GPU (for example, in case normals/tangents need recalculation)
Expand Down

0 comments on commit 6e751b7

Please sign in to comment.