Skip to content

Commit

Permalink
Use MeshCycler in MeshDeleteSyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Klara committed Dec 9, 2024
1 parent 46f2252 commit c70231c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Assets/Scripts/tools/utils/HighlightStyles/MeshDeleteStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ public static void RenderMeshes(Model model,
int matId = pair.Key;
MeshGenContext meshGenContext = pair.Value;

Mesh curMesh = new Mesh();
Mesh curMesh = MeshCycler.GetTempMeshForMeshMatId(key, matId, out bool needToPopulateMesh);
Material curMaterial = animPct >= .99f ? matDict[MaterialRegistry.GetMaterialType(matId)].GetFixedMaterial() :
matDict[MaterialRegistry.GetMaterialType(matId)].GetInstanceOfMaterial();
curMaterial.SetFloat("_OverrideAmount", emissiveAmount);
curMaterial.SetColor("_OverrideColor", ERASE_COLOR);
curMaterial.renderQueue = 3000;
curMesh.SetVertices(meshGenContext.verts);
curMesh.SetColors(meshGenContext.colors);
curMesh.SetTriangles(meshGenContext.triangles, /* subMesh */ 0);
curMesh.RecalculateNormals();
if (needToPopulateMesh)
{
curMesh.SetVertices(meshGenContext.verts);
curMesh.SetColors(meshGenContext.colors);
curMesh.SetTriangles(meshGenContext.triangles, /* subMesh */ 0);
curMesh.RecalculateNormals();
}

Graphics.DrawMesh(curMesh, worldSpace.modelToWorld, curMaterial, 0);
}
Expand Down

0 comments on commit c70231c

Please sign in to comment.