Skip to content

Commit

Permalink
always ignore meshes in transparent layer
Browse files Browse the repository at this point in the history
  • Loading branch information
dkavolis committed Nov 24, 2020
1 parent 9e67b32 commit f6a005d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,18 @@ internal void RebuildAllMeshData()

private bool IgnoredPredicate(Transform t)
{
return ignoredTransforms.Contains(t.name);
if (ignoredTransforms.Contains(t.name))
return true;

if (t.gameObject.layer != ignoreLayer0)
{
Transform prefabTransform = part.partInfo.partPrefab.FindModelTransform(t.gameObject.name);
if (prefabTransform is null || prefabTransform.gameObject.layer != ignoreLayer0)
return false;
}

FARLogger.DebugFormat("Ignoring {0}.{1} for voxelization: layer is ignored", part.name, t.gameObject.name);
return true;
}

private Bounds SetBoundsFromMeshes()
Expand Down Expand Up @@ -735,9 +746,6 @@ private MeshData GetVisibleMeshData(Transform t, bool skipIfNoRenderer, bool onl

if (part.Modules.Contains<ModuleProceduralFairing>() || part.Modules.Contains<ModuleAsteroid>())
return new MeshData(m.vertices, m.triangles, m.bounds);
Transform prefabTransform = part.partInfo.partPrefab.FindModelTransform(t.gameObject.name);
if (!(prefabTransform is null) && prefabTransform.gameObject.layer == ignoreLayer0)
return null;

return new MeshData(m.vertices, m.triangles, m.bounds);
}
Expand Down

0 comments on commit f6a005d

Please sign in to comment.