Revision 1e438fc7
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/library/Distorted.java | ||
---|---|---|
67 | 67 |
* on the screen, with (optionally) different effects of the top-level root Bitmap. |
68 | 68 |
*/ |
69 | 69 |
public static final int CLONE_CHILDREN= 0x10; |
70 |
/** |
|
71 |
* Constant used to represent a PreShader-based effect. |
|
72 |
*/ |
|
73 |
public static final int TYPE_PRE = 0x1; |
|
74 |
/** |
|
75 |
* Constant used to represent a Vertex-based effect. |
|
76 |
*/ |
|
77 |
public static final int TYPE_VERT = 0x2; |
|
78 |
/** |
|
79 |
* Constant used to represent a Fragment-based effect. |
|
80 |
*/ |
|
81 |
public static final int TYPE_FRAG = 0x4; |
|
82 |
/** |
|
83 |
* Constant used to represent a PostShader-based effect. |
|
84 |
*/ |
|
85 |
public static final int TYPE_POST = 0x8; |
|
86 | 70 |
|
87 | 71 |
private static final String TAG = Distorted.class.getSimpleName(); |
88 | 72 |
private static boolean mInitialized = false; |
... | ... | |
224 | 208 |
|
225 | 209 |
for(EffectNames name: EffectNames.values() ) |
226 | 210 |
{ |
227 |
if( name.getType()==TYPE_VERT )
|
|
211 |
if( name.getType()==EffectTypes.VERTEX)
|
|
228 | 212 |
header += ("#define "+name.name()+" "+name.ordinal()+"\n"); |
229 | 213 |
} |
230 | 214 |
break; |
... | ... | |
232 | 216 |
|
233 | 217 |
for(EffectNames name: EffectNames.values() ) |
234 | 218 |
{ |
235 |
if( name.getType()==TYPE_FRAG )
|
|
219 |
if( name.getType()==EffectTypes.FRAGMENT)
|
|
236 | 220 |
header += ("#define "+name.name()+" "+name.ordinal()+"\n"); |
237 | 221 |
} |
238 | 222 |
break; |
... | ... | |
360 | 344 |
|
361 | 345 |
EffectListFragment.getUniforms(mProgramH); |
362 | 346 |
EffectListVertex.getUniforms(mProgramH); |
363 |
EffectListPreShader.getUniforms(mProgramH);
|
|
347 |
EffectListMatrix.getUniforms(mProgramH);
|
|
364 | 348 |
|
365 | 349 |
GLES20.glEnableVertexAttribArray(mPositionH); |
366 | 350 |
GLES20.glEnableVertexAttribArray(mColorH); |
... | ... | |
397 | 381 |
|
398 | 382 |
EffectListVertex.reset(); |
399 | 383 |
EffectListFragment.reset(); |
400 |
EffectListPreShader.reset(); // no need to reset PostShader stuff
|
|
384 |
EffectListMatrix.reset(); // no need to reset Other EffectList
|
|
401 | 385 |
|
402 | 386 |
EffectMessageSender.stopSending(); |
403 | 387 |
|
... | ... | |
418 | 402 |
|
419 | 403 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
420 | 404 |
/** |
421 |
* Returns the maximum number of PreShader effects.
|
|
405 |
* Returns the maximum number of Matrix effects.
|
|
422 | 406 |
* |
423 |
* @return The maximum number of PreShader effects
|
|
407 |
* @return The maximum number of Matrix effects
|
|
424 | 408 |
*/ |
425 |
public static int getMaxPreShader()
|
|
409 |
public static int getMaxMatrix()
|
|
426 | 410 |
{ |
427 |
return EffectListPreShader.getMax();
|
|
411 |
return EffectListMatrix.getMax();
|
|
428 | 412 |
} |
429 | 413 |
|
430 | 414 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
451 | 435 |
|
452 | 436 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
453 | 437 |
/** |
454 |
* Sets the maximum number of PreShader effects that can be applied to a single DistortedBitmap at one time.
|
|
438 |
* Sets the maximum number of Matrix effects that can be applied to a single DistortedBitmap at one time.
|
|
455 | 439 |
* This can fail if the value of 'max' is outside permitted range. |
456 | 440 |
* |
457 |
* @param max new maximum number of simultaneous PreShader Effects. Has to be a non-negative number not greater
|
|
441 |
* @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater
|
|
458 | 442 |
* than Byte.MAX_VALUE |
459 | 443 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
460 | 444 |
*/ |
461 |
public static boolean setMaxPreShader(int max)
|
|
445 |
public static boolean setMaxMatrix(int max)
|
|
462 | 446 |
{ |
463 |
return EffectListPreShader.setMax(max);
|
|
447 |
return EffectListMatrix.setMax(max);
|
|
464 | 448 |
} |
465 | 449 |
|
466 | 450 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Introduce ENUM EffectTypes