Revision 3bbe4d67
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/effectqueue/EffectQueue.java | ||
---|---|---|
53 | 53 |
float[] mFloatUniforms; |
54 | 54 |
int[] mIntUniforms; |
55 | 55 |
|
56 |
private static long mNextID = 1; |
|
57 |
private static HashMap<ArrayList<Long>,Long> mMapID = new HashMap<>(); // maps lists of Effect IDs (longs) to a |
|
58 |
// single long - the queue ID. |
|
59 | 56 |
private long mID; |
60 | 57 |
private int mIndex; |
61 | 58 |
private boolean mCreated; |
... | ... | |
203 | 200 |
{ |
204 | 201 |
if( mNumEffects>0 ) |
205 | 202 |
{ |
203 |
HashMap<ArrayList<Long>,Long> map = InternalStackFrameList.getMap(); |
|
206 | 204 |
ArrayList<Long> list = new ArrayList<>(); |
207 |
for (int i = 0; i < mNumEffects; i++) list.add(mEffects[i].getID());
|
|
208 |
Long id = mMapID.get(list);
|
|
205 |
for (int i=0; i<mNumEffects; i++) list.add(mEffects[i].getID());
|
|
206 |
Long id = map.get(list);
|
|
209 | 207 |
|
210 | 208 |
if( id!=null ) |
211 | 209 |
{ |
... | ... | |
213 | 211 |
} |
214 | 212 |
else |
215 | 213 |
{ |
216 |
mMapID.put(list,mNextID);
|
|
217 |
mID = mNextID++;
|
|
214 |
mID = InternalStackFrameList.getNextQueueID();
|
|
215 |
map.put(list,mID);
|
|
218 | 216 |
} |
219 | 217 |
} |
220 | 218 |
else |
... | ... | |
244 | 242 |
return InternalStackFrameList.getMax(index); |
245 | 243 |
} |
246 | 244 |
|
247 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
248 |
|
|
249 |
public static void onDestroy() |
|
250 |
{ |
|
251 |
mNextID = 1; |
|
252 |
mMapID.clear(); |
|
253 |
} |
|
254 |
|
|
255 | 245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
256 | 246 |
// this assumes 0<=effect |
257 | 247 |
|
Also available in: Unified diff
Put new things to the StackFrame.