Project

General

Profile

« Previous | Next » 

Revision 1e438fc7

Added by Leszek Koltunski almost 8 years ago

Introduce ENUM EffectTypes

View differences:

src/main/java/org/distorted/library/EffectList.java
6 6

  
7 7
abstract class EffectList
8 8
  {
9
  protected static final int DEFAULT_NUM_EFFECTS = 5;
10
  
11
  protected static final int PRESHADER =0;
12
  protected static final int VERTEX    =1;
13
  protected static final int FRAGMENT  =2;
14

  
15 9
  protected byte mNumEffects;   // number of effects at the moment
16 10
  protected long mTotalEffects; // total number of effects ever created
17 11
  
......
27 21
  protected long mTime=0;
28 22
  protected float mObjHalfX, mObjHalfY, mObjHalfZ;
29 23
  
30
  protected static int[] mMax = new int[3];
24
  protected static int[] mMax = new int[EffectTypes.LENGTH];
31 25
  protected int mMaxIndex;
32
  protected static boolean mCreated = false;
26
  protected static boolean mCreated;
33 27
 
34 28
  protected Vector<EffectListener> mListeners =null;
35 29
  protected int mNumListeners=0;  // ==mListeners.length(), but we only create mListeners if the first one gets added
......
37 31
  
38 32
  static
39 33
    {
40
    mMax[PRESHADER]= DEFAULT_NUM_EFFECTS;
41
    mMax[VERTEX]   = DEFAULT_NUM_EFFECTS;
42
    mMax[FRAGMENT] = DEFAULT_NUM_EFFECTS;
34
    reset();
43 35
    }
44 36
  
45 37
///////////////////////////////////////////////////////////////////////////////////////////////////
......
49 41
    mNumEffects   = 0;
50 42
    mTotalEffects = 0;
51 43
    mMaxIndex     = index;
52
    
53
    mObjHalfX = obj.getWidth() /2.0f;
54
    mObjHalfY = obj.getHeight()/2.0f;
55
    mObjHalfZ = obj.getDepth() /2.0f;
56 44

  
57
    mBitmapID = obj.getID();
58
    
45
    if( obj!=null )
46
      {
47
      mObjHalfX = obj.getWidth() / 2.0f;
48
      mObjHalfY = obj.getHeight() / 2.0f;
49
      mObjHalfZ = obj.getDepth() / 2.0f;
50

  
51
      mBitmapID = obj.getID();
52
      }
53

  
59 54
    if( mMax[mMaxIndex]>0 )
60 55
      {
61 56
      mType            = new int[mMax[mMaxIndex]];
......
105 100

  
106 101
  static void reset()
107 102
    {
108
    mMax[PRESHADER]= DEFAULT_NUM_EFFECTS;
109
    mMax[VERTEX]   = DEFAULT_NUM_EFFECTS;
110
    mMax[FRAGMENT] = DEFAULT_NUM_EFFECTS;
111
   
103
    EffectTypes.reset(mMax);
112 104
    mCreated = false;  
113 105
    }
114 106
 
......
203 195
    for(int i=0; i<mNumListeners; i++) 
204 196
      EffectMessageSender.newMessage( mListeners.elementAt(i),
205 197
                                      EffectMessage.EFFECT_REMOVED, 
206
                                      (removedID<<DistortedObject.TYPE_NUM)+EffectNames.getType(removedType), 
198
                                      (removedID<<EffectTypes.LENGTH)+EffectNames.getType(removedType).type,
207 199
                                      removedType,
208 200
                                      mBitmapID);  
209 201
    }
......
223 215
    mNumEffects++; 
224 216
    mTotalEffects++;
225 217
   
226
    return (id<<DistortedObject.TYPE_NUM)+eln.getType();
218
    return (id<<EffectTypes.LENGTH)+eln.getType().type;
227 219
    }
228 220
    
229 221
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff