Project

General

Profile

« Previous | Next » 

Revision 43814a57

Added by Leszek Koltunski over 3 years ago

Fix the fact that the static DistortedEffects.mAllQueues was global, shared between all Activities.
Completely replace this mechanism with a non-static list of links from a VertexEffect to all VertexEffectQueues this effect is a member of.

View differences:

src/main/java/org/distorted/library/effect/VertexEffect.java
19 19

  
20 20
package org.distorted.library.effect;
21 21

  
22
import org.distorted.library.main.DistortedEffects;
22
import org.distorted.library.effectqueue.EffectQueue;
23 23
import org.distorted.library.type.Static4D;
24 24

  
25 25
import java.lang.reflect.Method;
26
import java.util.ArrayList;
26 27

  
27 28
///////////////////////////////////////////////////////////////////////////////////////////////////
28 29
/**
......
51 52

  
52 53
  final static Static4D MAX_REGION = new Static4D(0,0,0,1000000);
53 54

  
55
  ArrayList<EffectQueue> mQueues;
56

  
54 57
///////////////////////////////////////////////////////////////////////////////////////////////////
55 58

  
56 59
  VertexEffect(EffectName name)
......
194 197
    return mNumEnabled;
195 198
    }
196 199

  
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201
/**
202
 * Only for use by the library itself.
203
 *
204
 * @y.exclude
205
 */
206
  public void addQueue(EffectQueue queue)
207
    {
208
    if( mQueues==null ) mQueues = new ArrayList<>();
209

  
210
    mQueues.add(queue);
211
    }
212

  
213
///////////////////////////////////////////////////////////////////////////////////////////////////
214
/**
215
 * Only for use by the library itself.
216
 *
217
 * @y.exclude
218
 */
219
  public void remQueue(EffectQueue queue)
220
    {
221
    if( mQueues==null ) mQueues = new ArrayList<>();
222

  
223
    mQueues.remove(queue);
224
    }
225

  
197 226
///////////////////////////////////////////////////////////////////////////////////////////////////
198 227
/**
199 228
 * Set Mesh association.
......
214 243
    mAndAssociation = andAssociation;
215 244
    mEquAssociation = equAssociation;
216 245

  
217
    DistortedEffects.setAssociation(getID());
246
    long id = getID();
247
    int numQueues = mQueues==null ? 0: mQueues.size();
248

  
249
    for(int i=0; i<numQueues; i++)
250
      {
251
      EffectQueue queue = mQueues.get(i);
252
      queue.setAssociation(id);
253
      }
218 254
    }
219 255
  }

Also available in: Unified diff