1
|
package org.distorted.library;
|
2
|
|
3
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
4
|
/**
|
5
|
* Types of Effects one can apply to DistortedObjects.
|
6
|
* <p>
|
7
|
* Each effect type goes to an independent queue; the queues get executed one-by-one
|
8
|
* and are each a class descendant from EffectQueue.
|
9
|
*/
|
10
|
public enum EffectTypes
|
11
|
{
|
12
|
/**
|
13
|
* Matrix effects - i.e. effect that change the ModelView matrix. Rotations, Moves, Shears, Scales.
|
14
|
*/
|
15
|
MATRIX ( 0x1 ), // we will need to perform bitwise operations on those - so keep the values 1,2,4,8...
|
16
|
/**
|
17
|
* Vertex Effects - i.e. those that get executed in the Vertex shader. Generally various distortions
|
18
|
* of the vertices.
|
19
|
*/
|
20
|
VERTEX ( 0x2 ),
|
21
|
/**
|
22
|
* Fragment Effects - executed in the Fragment shader. Changes of color, hue, transparency levels, etc.
|
23
|
*/
|
24
|
FRAGMENT ( 0x4 ),
|
25
|
/**
|
26
|
* effects that did not belong to anywhere else - currently saving the contents of underlying Surface
|
27
|
* to a PNG or a MP4 file.
|
28
|
*/
|
29
|
OTHER ( 0x8 );
|
30
|
|
31
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32
|
|
33
|
final static int LENGTH = values().length; // The number of effect types.
|
34
|
final static int MASK= (1<<LENGTH)-1; // Needed when we do bitwise operations on Effect Types.
|
35
|
|
36
|
final int type;
|
37
|
|
38
|
EffectTypes(int type)
|
39
|
{
|
40
|
this.type = type;
|
41
|
}
|
42
|
|
43
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
44
|
// called from EffectQueue
|
45
|
|
46
|
static void reset(int[] maxtable)
|
47
|
{
|
48
|
maxtable[0] = 5; // By default, there can be a maximum 5 MATRIX effects acting on a single
|
49
|
// DistortedObject at any given time. This can be changed with a call to
|
50
|
// EffectQueueMatrix.setMax(int)
|
51
|
|
52
|
maxtable[1] = 5; // Max 5 VERTEX Effects
|
53
|
maxtable[2] = 5; // Max 5 FRAGMENT Effects
|
54
|
maxtable[3] = 5; // Max 5 OTHER Effects
|
55
|
}
|
56
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
57
|
}
|
58
|
|