Project

General

Profile

« Previous | Next » 

Revision d5b709df

Added by Leszek Koltunski about 5 years ago

Cut another interdependency between the Queues and the rest: it is no longer necessary to add DNodes to PostprocessQueue to rearrange the Nodes by buckets. The rearranging is now done on next render instead.

View differences:

src/main/java/org/distorted/library/main/EffectQueue.java
53 53
  private static long mNextID;
54 54
  private static HashMap<ArrayList<Long>,Long> mMapID = new HashMap<>(); // maps lists of Effect IDs (longs) to a
55 55
                                                                         // single long - the queue ID.
56
  private ArrayList<DistortedNode> mNodes = null;
57 56
  private long mID;
58 57
  private int mIndex;
59 58
  private boolean mCreated;
......
97 96
    }
98 97

  
99 98
///////////////////////////////////////////////////////////////////////////////////////////////////
100
// queues - guaranteed to be an array of EffectType.LENGTH length.
101
// Change this when creating a new ty[e of effect!
102 99

  
103 100
  static void allocateQueues(EffectQueue[] queues, EffectQueue[] from, int flags, long id)
104 101
    {
......
109 106
    }
110 107

  
111 108
///////////////////////////////////////////////////////////////////////////////////////////////////
112
// queues - guaranteed to be an array of EffectType.LENGTH length.
113
// Change this when creating a new ty[e of effect!
114 109

  
115 110
  static void compute(EffectQueue[] queues, long currTime, float halfW, float halfH, float halfZ )
116 111
    {
......
121 116
    }
122 117

  
123 118
///////////////////////////////////////////////////////////////////////////////////////////////////
124
// queues - guaranteed to be an array of EffectType.LENGTH length.
125
// Change this when creating a new ty[e of effect!
126 119

  
127 120
  static void send(EffectQueue[] queues, DistortedOutputSurface surface, float inflate, float halfW, float halfH, float halfZ, int variant )
128 121
    {
......
132 125
    }
133 126

  
134 127
///////////////////////////////////////////////////////////////////////////////////////////////////
135
// queues - guaranteed to be an array of EffectType.LENGTH length.
136
// Change this when creating a new ty[e of effect!
137 128

  
138 129
  static float[] getMVP(EffectQueue[] queues)
139 130
    {
140
    return ((EffectQueueMatrix  )queues[0]).getMVP();
131
    return ((EffectQueueMatrix)queues[0]).getMVP();
141 132
    }
142 133

  
143 134
///////////////////////////////////////////////////////////////////////////////////////////////////
144
// queues - guaranteed to be an array of EffectType.LENGTH length.
145
// Change this when creating a new ty[e of effect!
146

  
147
  static void newNode(EffectQueue[] queues, DistortedNode node)
148
    {
149
    queues[3].newNode(node);
150
    }
151

  
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153
// queues - guaranteed to be an array of EffectType.LENGTH length.
154
// Change this when creating a new ty[e of effect!
155

  
156
  static void removeNode(EffectQueue[] queues, DistortedNode node)
157
    {
158
    queues[3].removeNode(node);
159
    }
160

  
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162
// queues - guaranteed to be an array of EffectType.LENGTH length.
163
// Change this when creating a new ty[e of effect!
164 135

  
165 136
  static void getUniforms(int programH, int variant)
166 137
    {
......
174 145
// (this is a speedup: then both queues can be applied once, which seriously speeds up stuff -
175 146
// especially important in case of postprocessing)
176 147

  
177
  private void regenerateIDandSort()
148
  private void regenerateID()
178 149
    {
179 150
    if( mNumEffects>0 )
180 151
      {
......
196 167
      {
197 168
      mID = 0;
198 169
      }
199

  
200
    int numNodes = (mNodes==null ? 0: mNodes.size());
201
    for(int i=0; i<numNodes; i++) mNodes.get(i).sort();
202
    }
203

  
204
///////////////////////////////////////////////////////////////////////////////////////////////////
205

  
206
  private void newNode(DistortedNode node)
207
    {
208
    if( mNodes==null ) mNodes = new ArrayList<>();
209

  
210
    mNodes.add(node);
211
    }
212

  
213
///////////////////////////////////////////////////////////////////////////////////////////////////
214

  
215
  private void removeNode(DistortedNode node)
216
    {
217
    mNodes.remove(node);
218 170
    }
219 171

  
220 172
///////////////////////////////////////////////////////////////////////////////////////////////////
......
465 417
        }
466 418
      }
467 419

  
468
    if( changed && mIndex==EffectType.POSTPROCESS.ordinal() ) regenerateIDandSort();
420
    if( changed && mIndex==EffectType.POSTPROCESS.ordinal() ) regenerateID();
469 421
    }
470 422
  }

Also available in: Unified diff