Revision b3618cb5
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/library/Distorted.java | ||
---|---|---|
32 | 32 |
*/ |
33 | 33 |
public static final int CLONE_BITMAP = 0x1; |
34 | 34 |
/** |
35 |
* When creating an instance of a DistortedObject from another instance, clone the Matrix Effects.
|
|
35 |
* When creating an instance of a DistortedObject from another instance, clone the PreShader Effects.
|
|
36 | 36 |
* <p> |
37 | 37 |
* This way we can have two different DistortedObjects with different Bitmaps behind them, both |
38 | 38 |
* always displayed in exactly the same place on the screen. Applying any matrix-based effect to |
39 | 39 |
* one of them automatically applies the effect to the other. Used in the copy constructor. |
40 | 40 |
*/ |
41 |
public static final int CLONE_MATRIX = 0x2;
|
|
41 |
public static final int CLONE_PRESHADER = 0x2;
|
|
42 | 42 |
/** |
43 | 43 |
* When creating an instance of a DistortedObject from another instance, clone the Vertex Effects. |
44 | 44 |
* <p> |
... | ... | |
55 | 55 |
* applies the effect to the other. Used in the copy constructor. |
56 | 56 |
*/ |
57 | 57 |
public static final int CLONE_FRAGMENT= 0x8; |
58 |
|
|
59 |
// Note: why no 'CLONE_POSTSHADER' constant? The only Postshader effects are the 'save to PNG file' |
|
60 |
// 'save to MP4 file'. Sharing those effects across multiple DistortedObject objects does not make any |
|
61 |
// sense - multiple Objects would then fight to get saved all to the same file. |
|
62 |
|
|
58 | 63 |
/** |
59 | 64 |
* When creating an instance of a DistortedNode from another instance, clone the children Nodes. |
60 | 65 |
* <p> |
... | ... | |
63 | 68 |
*/ |
64 | 69 |
public static final int CLONE_CHILDREN= 0x10; |
65 | 70 |
/** |
66 |
* Constant used to represent a Matrix-based effect.
|
|
67 |
*/ |
|
68 |
public static final int TYPE_MATR = 0x1;
|
|
71 |
* Constant used to represent a PreShader-based effect.
|
|
72 |
*/
|
|
73 |
public static final int TYPE_PRE = 0x1;
|
|
69 | 74 |
/** |
70 | 75 |
* Constant used to represent a Vertex-based effect. |
71 | 76 |
*/ |
... | ... | |
74 | 79 |
* Constant used to represent a Fragment-based effect. |
75 | 80 |
*/ |
76 | 81 |
public static final int TYPE_FRAG = 0x4; |
77 |
|
|
82 |
/** |
|
83 |
* Constant used to represent a PostShader-based effect. |
|
84 |
*/ |
|
85 |
public static final int TYPE_POST = 0x8; |
|
86 |
|
|
78 | 87 |
private static final String TAG = Distorted.class.getSimpleName(); |
79 | 88 |
private static boolean mInitialized = false; |
80 | 89 |
|
... | ... | |
351 | 360 |
|
352 | 361 |
EffectListFragment.getUniforms(mProgramH); |
353 | 362 |
EffectListVertex.getUniforms(mProgramH); |
354 |
EffectListMatrix.getUniforms(mProgramH);
|
|
363 |
EffectListPreShader.getUniforms(mProgramH);
|
|
355 | 364 |
|
356 | 365 |
GLES20.glEnableVertexAttribArray(mPositionH); |
357 | 366 |
GLES20.glEnableVertexAttribArray(mColorH); |
... | ... | |
388 | 397 |
|
389 | 398 |
EffectListVertex.reset(); |
390 | 399 |
EffectListFragment.reset(); |
391 |
EffectListMatrix.reset(); |
|
400 |
EffectListPreShader.reset(); // no need to reset PostShader stuff |
|
401 |
|
|
392 | 402 |
EffectMessageSender.stopSending(); |
393 | 403 |
|
394 | 404 |
mInitialized = false; |
... | ... | |
408 | 418 |
|
409 | 419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
410 | 420 |
/** |
411 |
* Returns the maximum number of Matrix effects.
|
|
421 |
* Returns the maximum number of PreShader effects.
|
|
412 | 422 |
* |
413 |
* @return The maximum number of Matrix effects
|
|
423 |
* @return The maximum number of PreShader effects
|
|
414 | 424 |
*/ |
415 |
public static int getMaxMatrix()
|
|
425 |
public static int getMaxPreShader()
|
|
416 | 426 |
{ |
417 |
return EffectListMatrix.getMax();
|
|
427 |
return EffectListPreShader.getMax();
|
|
418 | 428 |
} |
419 | 429 |
|
420 | 430 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
441 | 451 |
|
442 | 452 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
443 | 453 |
/** |
444 |
* Sets the maximum number of Matrix effects that can be applied to a single DistortedBitmap at one time.
|
|
454 |
* Sets the maximum number of PreShader effects that can be applied to a single DistortedBitmap at one time.
|
|
445 | 455 |
* This can fail if the value of 'max' is outside permitted range. |
446 | 456 |
* |
447 |
* @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater
|
|
457 |
* @param max new maximum number of simultaneous PreShader Effects. Has to be a non-negative number not greater
|
|
448 | 458 |
* than Byte.MAX_VALUE |
449 | 459 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
450 | 460 |
*/ |
451 |
public static boolean setMaxMatrix(int max)
|
|
461 |
public static boolean setMaxPreShader(int max)
|
|
452 | 462 |
{ |
453 |
return EffectListMatrix.setMax(max);
|
|
463 |
return EffectListPreShader.setMax(max);
|
|
454 | 464 |
} |
455 | 465 |
|
456 | 466 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Beginnings of support for PostShader effects (SavePNG, SaveMP4)