Revision 24804c15
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/effectqueue/EffectQueue.java | ||
---|---|---|
265 | 265 |
} |
266 | 266 |
|
267 | 267 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
268 |
// this assumes 0<=effect<mNumEffects
|
|
268 |
// this assumes 0<=effect |
|
269 | 269 |
|
270 | 270 |
protected void remove(int effect) |
271 | 271 |
{ |
272 |
mNumEffects--; |
|
273 |
|
|
274 |
int max = mMax[mIndex]; |
|
275 |
|
|
276 |
for(int i=effect; i<mNumEffects; i++ ) |
|
272 |
if( mNumEffects>effect ) |
|
277 | 273 |
{ |
278 |
mEffects[i]= mEffects[i+1]; |
|
279 |
|
|
280 |
for(int j=0; j<mNumIntUniforms; j++) |
|
281 |
{ |
|
282 |
mIntUniforms[j*max + i] = mIntUniforms[j*max + i+1]; |
|
283 |
} |
|
274 |
mNumEffects--; |
|
275 |
System.arraycopy(mEffects, effect+1, mEffects, effect, mNumEffects-effect); |
|
276 |
System.arraycopy(mIntUniforms, mNumIntUniforms*(effect+1), mIntUniforms, mNumIntUniforms*effect, mNumIntUniforms*(mNumEffects-effect) ); |
|
277 |
mEffects[mNumEffects] = null; |
|
284 | 278 |
} |
285 |
|
|
286 |
mEffects[mNumEffects] = null; |
|
287 | 279 |
} |
288 | 280 |
|
289 | 281 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
447 | 439 |
|
448 | 440 |
if( position==-1 ) |
449 | 441 |
{ |
450 |
mEffects[mNumEffects] = job.effect; |
|
451 |
mIntUniforms[mNumEffects] = job.effect.getName().ordinal(); |
|
442 |
mEffects[mNumEffects] = job.effect;
|
|
443 |
mIntUniforms[mNumIntUniforms*mNumEffects] = job.effect.getName().ordinal();
|
|
452 | 444 |
|
453 | 445 |
mNumEffects++; |
454 | 446 |
changed = true; |
455 | 447 |
} |
456 | 448 |
else if( position>=0 && position<=mNumEffects ) |
457 | 449 |
{ |
458 |
for(int j=mNumEffects; j>position; j--) |
|
459 |
{ |
|
460 |
mEffects[j] = mEffects[j-1]; |
|
461 |
mIntUniforms[j] = mIntUniforms[j-1]; |
|
462 |
} |
|
463 |
|
|
464 |
mEffects[position] = job.effect; |
|
465 |
mIntUniforms[position] = job.effect.getName().ordinal(); |
|
450 |
System.arraycopy(mEffects , position, mEffects , position+1, mNumEffects-position); |
|
451 |
System.arraycopy(mIntUniforms, mNumIntUniforms*position, mIntUniforms, mNumIntUniforms*(position+1), mNumIntUniforms*(mNumEffects-position) ); |
|
452 |
|
|
453 |
mEffects[position] = job.effect; |
|
454 |
mIntUniforms[mNumIntUniforms*position] = job.effect.getName().ordinal(); |
|
466 | 455 |
|
467 | 456 |
mNumEffects++; |
468 | 457 |
changed = true; |
Also available in: Unified diff
Turn the vName, vEffAnd and vEffEqu integer array uniforms into a one ivec4.
The point: ivec4s are always packed tightly in UBOs (which is going to be the next step)