Project

General

Profile

Download (1.97 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / EffectTypes.java @ c6e1c219

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