You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
3.0.0-preview.19
# [3.0.0-preview.19](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.18...v3.0.0-preview.19) (2020-08-28) ### Bug Fixes * baking camera settings for camera space ([436c5e4](436c5e47f7)) * fix local simulation ([7add9de](7add9defb7)) ### Features * add menu to create UIParticle ([2fa1843](2fa18431f0)) * add play/pause/stop api ([f09a386](f09a386bc5)) * support for changing rendering orders ([745d4a5](745d4a5988)) * Support for child ParticleSystem rendering ([4ee90be](4ee90be17c)) * UIParticle for trail is no longer needed ([466e43c](466e43cf93)) ### BREAKING CHANGES * The child UIParticle is no longer needed.
This commit is contained in:
@@ -6,14 +6,17 @@ namespace Coffee.UIExtensions
|
||||
internal static class MeshHelper
|
||||
{
|
||||
private static CombineInstance[] s_CombineInstances;
|
||||
private static int s_TempIndex;
|
||||
private static int s_CurrentIndex;
|
||||
static readonly List<Color32> s_Colors = new List<Color32>();
|
||||
private static int s_RefCount;
|
||||
private static Matrix4x4 s_Transform;
|
||||
public static uint activeMeshIndices { get; private set; }
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
if (0 < s_RefCount++) return;
|
||||
s_CombineInstances = new CombineInstance[2];
|
||||
s_CombineInstances = new CombineInstance[8];
|
||||
}
|
||||
|
||||
public static void Unregister()
|
||||
@@ -37,14 +40,33 @@ namespace Coffee.UIExtensions
|
||||
s_CombineInstances = null;
|
||||
}
|
||||
|
||||
public static Mesh GetTemporaryMesh()
|
||||
public static Mesh GetTemporaryMesh(int index)
|
||||
{
|
||||
return s_CombineInstances[s_CurrentIndex++].mesh;
|
||||
if (s_CombineInstances.Length <= s_TempIndex) s_TempIndex = s_CombineInstances.Length - 1;
|
||||
s_CurrentIndex = index;
|
||||
activeMeshIndices += (uint)(1 << s_CurrentIndex);
|
||||
s_CombineInstances[s_TempIndex].transform = s_Transform;
|
||||
return s_CombineInstances[s_TempIndex++].mesh;
|
||||
}
|
||||
|
||||
public static void DiscardTemporaryMesh()
|
||||
{
|
||||
if (s_TempIndex == 0) return;
|
||||
s_TempIndex--;
|
||||
activeMeshIndices -= (uint)(1 << s_CurrentIndex);
|
||||
}
|
||||
|
||||
public static void SetTransform(Matrix4x4 transform)
|
||||
{
|
||||
s_Transform = transform;
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
if (s_CombineInstances == null) return;
|
||||
s_CurrentIndex = 0;
|
||||
activeMeshIndices = 0;
|
||||
s_TempIndex = 0;
|
||||
for (var i = 0; i < s_CombineInstances.Length; i++)
|
||||
{
|
||||
if (!s_CombineInstances[i].mesh)
|
||||
@@ -60,12 +82,9 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
}
|
||||
|
||||
public static void CombineMesh(Mesh result, Matrix4x4 transform)
|
||||
public static void CombineMesh(Mesh result)
|
||||
{
|
||||
if (!result || s_CurrentIndex == 0) return;
|
||||
|
||||
for (var i = 0; i < 2; i++)
|
||||
s_CombineInstances[i].transform = transform;
|
||||
if (!result || s_TempIndex == 0) return;
|
||||
|
||||
result.CombineMeshes(s_CombineInstances, false, true);
|
||||
result.RecalculateBounds();
|
||||
|
||||
Reference in New Issue
Block a user