本文整理汇总了C#中ParticlePlayground.PlaygroundParticlesC.RefreshMaskSorting方法的典型用法代码示例。如果您正苦于以下问题:C# PlaygroundParticlesC.RefreshMaskSorting方法的具体用法?C# PlaygroundParticlesC.RefreshMaskSorting怎么用?C# PlaygroundParticlesC.RefreshMaskSorting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticlePlayground.PlaygroundParticlesC
的用法示例。
在下文中一共展示了PlaygroundParticlesC.RefreshMaskSorting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThreadedCalculations
public static void ThreadedCalculations(PlaygroundParticlesC playgroundParticles)
{
// Refresh delta time
if (!playgroundParticles.isPrewarming) {
playgroundParticles.localDeltaTime = (PlaygroundC.globalTime-playgroundParticles.lastTimeUpdated)*playgroundParticles.particleTimescale;
playgroundParticles.localTime += playgroundParticles.localDeltaTime;
playgroundParticles.lastTimeUpdated = PlaygroundC.globalTime;
}
// Set delta time
playgroundParticles.t = playgroundParticles.localDeltaTime;
if (playgroundParticles.particleCount<=0 ||
playgroundParticles.playgroundCache.color.Length!=playgroundParticles.particleCount ||
playgroundParticles.playgroundCache.targetPosition.Length!=playgroundParticles.particleCount ||
playgroundParticles.playgroundCache.targetDirection.Length!=playgroundParticles.particleCount ||
playgroundParticles.source==SOURCEC.State && playgroundParticles.states[playgroundParticles.activeState].IsInitializing() ||
playgroundParticles.isYieldRefreshing || !PlaygroundC.IsReady() || playgroundParticles.isSettingParticleTime) {
playgroundParticles.isDoneThread = true;
playgroundParticles.threadHadNoActiveParticles = false;
return;
}
if (PlaygroundC.reference.calculate && playgroundParticles.calculate && !playgroundParticles.inTransition && playgroundParticles.hasActiveParticles) {}
else if (playgroundParticles.source!=SOURCEC.Script) {
playgroundParticles.isDoneThread = true;
playgroundParticles.cameFromNonCalculatedFrame = true;
return;
} else {
playgroundParticles.isDoneThread = true;
return;
}
// Check that simplex turbulence is available (will be next frame in case not)
if (!playgroundParticles.onlySourcePositioning && !playgroundParticles.onlyLifetimePositioning && playgroundParticles.turbulenceStrength>0 && playgroundParticles.turbulenceType!=TURBULENCETYPE.None) {
if (playgroundParticles.turbulenceType==TURBULENCETYPE.Simplex && playgroundParticles.turbulenceSimplex==null) {
playgroundParticles.isDoneThread = true;
playgroundParticles.threadHadNoActiveParticles = false;
return;
}
}
float t = playgroundParticles.t;
// Prepare variables for particle source positions
Matrix4x4 fMx = new Matrix4x4();
if (playgroundParticles.source==SOURCEC.State || playgroundParticles.source==SOURCEC.WorldObject || playgroundParticles.source==SOURCEC.SkinnedWorldObject) {
fMx.SetTRS(Vector3.zero, playgroundParticles.stRot, new Vector3(1f,1f,1f));
}
bool noActiveParticles = true;
if (playgroundParticles.source==SOURCEC.Transform)
for (int i = 0; i<playgroundParticles.sourceTransforms.Count; i++)
playgroundParticles.sourceTransforms[i].UpdateMatrix();
// Update skinned mesh vertices
if (playgroundParticles.source==SOURCEC.SkinnedWorldObject && playgroundParticles.skinnedWorldObjectReady && !playgroundParticles.forceSkinnedMeshUpdateOnMainThread && PlaygroundC.reference.skinnedMeshThreadMethod==ThreadMethodComponent.InsideParticleCalculation) {
playgroundParticles.skinnedWorldObject.Update();
}
// Misc
int pCount = playgroundParticles.particleCache.Length;
// Check that cache is correct
if (playgroundParticles.playgroundCache.lifetimeSubtraction.Length!=pCount)
SetLifetimeSubtraction(playgroundParticles);
if (playgroundParticles.playgroundCache.maskAlpha.Length!=pCount) {
playgroundParticles.playgroundCache.maskAlpha = new float[pCount];
playgroundParticles.playgroundCache.isMasked = new bool[pCount];
}
if (playgroundParticles.playgroundCache.manipulatorId.Length!=pCount)
playgroundParticles.playgroundCache.manipulatorId = new int[pCount];
if (playgroundParticles.playgroundCache.excludeFromManipulatorId.Length!=pCount)
playgroundParticles.playgroundCache.excludeFromManipulatorId = new int[pCount];
if (playgroundParticles.playgroundCache.noForce.Length!=pCount)
playgroundParticles.playgroundCache.noForce = new bool[pCount];
if (playgroundParticles.playgroundCache.isNonBirthed.Length!=pCount)
playgroundParticles.playgroundCache.isNonBirthed = new bool[pCount];
if (playgroundParticles.playgroundCache.isFirstLoop.Length!=pCount)
playgroundParticles.playgroundCache.isFirstLoop = new bool[pCount];
if (playgroundParticles.playgroundCache.isCalculatedThisFrame.Length!=pCount)
playgroundParticles.playgroundCache.isCalculatedThisFrame = new bool[pCount];
if (playgroundParticles.playgroundCache.simulate.Length!=pCount) {
playgroundParticles.playgroundCache.simulate = new bool[pCount];
for (int p = 0; p<pCount; p++)
playgroundParticles.playgroundCache.simulate[p] = true;
}
if (playgroundParticles.applyParticleMask && (playgroundParticles.playgroundCache.maskSorting==null || playgroundParticles.playgroundCache.maskSorting.Length!=pCount || playgroundParticles.particleMaskSorting!=playgroundParticles.previousMaskSorting))
playgroundParticles.RefreshMaskSorting();
Vector3 zero = Vector3.zero;
Vector3 up = Vector3.up;
float initYpos = PlaygroundC.initialTargetPosition.y;
// Calculation loop
for (int p = 0; p<playgroundParticles.particleCount; p++) {
// Check that particle count is correct
if (pCount != playgroundParticles.particleCache.Length || playgroundParticles.isYieldRefreshing || playgroundParticles.isSettingParticleTime || playgroundParticles.isSettingParticleCount) {
playgroundParticles.cameFromNonEmissionFrame = false;
playgroundParticles.isDoneThread = true;
//.........这里部分代码省略.........