Revision 9becf30e
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
23 | 23 |
import org.distorted.library.effect.EffectName; |
24 | 24 |
import org.distorted.library.effectqueue.EffectQueue; |
25 | 25 |
import org.distorted.library.effect.EffectType; |
26 |
import org.distorted.library.effectqueue.EffectQueueVertex; |
|
27 |
|
|
28 |
import java.util.ArrayList; |
|
26 | 29 |
|
27 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 | 31 |
/** |
... | ... | |
32 | 35 |
*/ |
33 | 36 |
public class DistortedEffects |
34 | 37 |
{ |
38 |
private static ArrayList<DistortedEffects> mAllEffectQueues = new ArrayList<>(); |
|
35 | 39 |
private static long mNextID =0; |
36 | 40 |
private long mID; |
37 | 41 |
private EffectQueue[] mQueues; |
... | ... | |
50 | 54 |
static void onDestroy() |
51 | 55 |
{ |
52 | 56 |
mNextID = 0; |
57 |
mAllEffectQueues.clear(); |
|
58 |
} |
|
59 |
|
|
60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
61 |
/** |
|
62 |
* @y.exclude |
|
63 |
*/ |
|
64 |
public static void setAssociation(long effectID) |
|
65 |
{ |
|
66 |
EffectQueue[] queues; |
|
67 |
int numQueues = mAllEffectQueues.size(); |
|
68 |
|
|
69 |
for(int i=0; i<numQueues; i++) |
|
70 |
{ |
|
71 |
queues = mAllEffectQueues.get(i).getQueues(); |
|
72 |
((EffectQueueVertex)queues[1]).setAssociation(effectID); |
|
73 |
} |
|
53 | 74 |
} |
54 | 75 |
|
55 | 76 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
63 | 84 |
mID = ++mNextID; |
64 | 85 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
65 | 86 |
EffectQueue.allocateQueues(mQueues,null,0); |
87 |
mAllEffectQueues.add(this); |
|
66 | 88 |
} |
67 | 89 |
|
68 | 90 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
80 | 102 |
mID = ++mNextID; |
81 | 103 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
82 | 104 |
EffectQueue.allocateQueues(mQueues,dc.getQueues(),flags); |
105 |
mAllEffectQueues.add(this); |
|
83 | 106 |
} |
84 | 107 |
|
85 | 108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Speedup: remember the mesh associations of VertexEffects only once, when they actually change, and not every time we compute() a VertexQueue.