Project

General

Profile

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

library / src / main / java / org / distorted / library / EffectTypes.java @ 50642a86

1 d333eb6b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20 1e438fc7 Leszek Koltunski
package org.distorted.library;
21
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23 e1e275c1 Leszek Koltunski
/**
24 cacc63de Leszek Koltunski
 * Types of Effects one can add to the DistortedEffects queues.
25 e1e275c1 Leszek Koltunski
 * <p>
26
 * Each effect type goes to an independent queue; the queues get executed one-by-one
27
 * and are each a class descendant from EffectQueue.
28
 */
29 1e438fc7 Leszek Koltunski
public enum EffectTypes
30
  {
31 e1e275c1 Leszek Koltunski
  /**
32 c6e1c219 Leszek Koltunski
   * Effects that change the ModelView matrix: Rotations, Moves, Shears, Scales.
33 e1e275c1 Leszek Koltunski
   */
34 4c1dd6e9 Leszek Koltunski
  MATRIX      ( 0x1 ),  // we will need to perform bitwise operations on those - so keep the values 1,2,4,8...
35 e1e275c1 Leszek Koltunski
  /**
36 c6e1c219 Leszek Koltunski
   * Effects that get executed in the Vertex shader: various distortions of the vertices.
37 e1e275c1 Leszek Koltunski
   */
38 4c1dd6e9 Leszek Koltunski
  VERTEX      ( 0x2 ),
39 e1e275c1 Leszek Koltunski
  /**
40 c6e1c219 Leszek Koltunski
   * Effects executed in the Fragment shader: changes of color, hue, transparency levels, etc.
41 e1e275c1 Leszek Koltunski
   */
42 4c1dd6e9 Leszek Koltunski
  FRAGMENT    ( 0x4 ),
43
  /**
44
   * Postprocessing done to the texture the first stage fragment shader created (if this queue is
45
   * empty, the first stage skips this intermediate texture)
46
   */
47
  POSTPROCESS ( 0x8 );
48 1e438fc7 Leszek Koltunski
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50
51
  final static int LENGTH = values().length;  // The number of effect types.
52
  final static int MASK= (1<<LENGTH)-1;       // Needed when we do bitwise operations on Effect Types.
53
54 e1e275c1 Leszek Koltunski
  final int type;
55 1e438fc7 Leszek Koltunski
56
  EffectTypes(int type)
57
    {
58
    this.type = type;
59
    }
60
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62 d07f2950 Leszek Koltunski
// called from EffectQueue
63 1e438fc7 Leszek Koltunski
64
  static void reset(int[] maxtable)
65
    {
66 7b8086eb Leszek Koltunski
    maxtable[0] =10;  // By default, there can be a maximum 10 MATRIX effects in a single
67
                      // EffectQueueMatrix at any given time. This can be changed with a call
68
                      // to EffectQueueMatrix.setMax(int)
69 1e438fc7 Leszek Koltunski
70
    maxtable[1] = 5;  // Max 5 VERTEX Effects
71 4c1dd6e9 Leszek Koltunski
    maxtable[2] = 5;  // Max 5 FRAGMENT Effects
72
    maxtable[3] = 5;  // Max 5 POSTPROCESSING Effects
73 1e438fc7 Leszek Koltunski
    }
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75 d333eb6b Leszek Koltunski
  }