Project

General

Profile

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

library / src / main / java / org / distorted / library / effect / EffectType.java @ c0255951

1 da9b3f07 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2 cc62b34a Leszek Koltunski
// Copyright 2016 Leszek Koltunski  leszek@koltunski.pl                                          //
3 da9b3f07 Leszek Koltunski
//                                                                                               //
4 46b572b5 Leszek Koltunski
// This file is part of Distorted.                                                               //
5 da9b3f07 Leszek Koltunski
//                                                                                               //
6 cc62b34a Leszek Koltunski
// This library is free software; you can redistribute it and/or                                 //
7
// modify it under the terms of the GNU Lesser General Public                                    //
8
// License as published by the Free Software Foundation; either                                  //
9
// version 2.1 of the License, or (at your option) any later version.                            //
10 da9b3f07 Leszek Koltunski
//                                                                                               //
11 cc62b34a Leszek Koltunski
// This library is distributed in the hope that it will be useful,                               //
12 da9b3f07 Leszek Koltunski
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13 cc62b34a Leszek Koltunski
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                             //
14
// Lesser General Public License for more details.                                               //
15 da9b3f07 Leszek Koltunski
//                                                                                               //
16 cc62b34a Leszek Koltunski
// You should have received a copy of the GNU Lesser General Public                              //
17
// License along with this library; if not, write to the Free Software                           //
18
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA                //
19 da9b3f07 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
20
21
package org.distorted.library.effect;
22
23
///////////////////////////////////////////////////////////////////////////////////////////////////
24
25
/**
26
 * Types of Effects one can add to the DistortedEffects queues.
27
 * <p>
28
 * Each effect type goes to an independent queue; the queues get executed one-by-one
29
 * and are each a class descendant from EffectQueue.
30
 */
31
32
public enum EffectType
33
  {
34
  /**
35
   * Effects that change the ModelView matrix: Rotations, Moves, Shears, Scales.
36
   */
37
  MATRIX,
38
  /**
39
   * Effects that get executed in the Vertex shader: various distortions of the vertices.
40
   */
41
  VERTEX,
42
  /**
43
   * Effects executed in the Fragment shader: changes of color, hue, transparency levels, etc.
44
   */
45
  FRAGMENT,
46
  /**
47
   * Postprocessing effects done to the texture the first stage fragment shader created
48
   */
49
  POSTPROCESS;
50
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52 faa3ff56 Leszek Koltunski
/**
53
 * Number of effect types.
54
 * Only for use by the library itself.
55
 *
56
 * @y.exclude
57
 */
58
  public static final int LENGTH = values().length;
59
/**
60
 * Needed when we do bitwise operations on Effect Types.
61
 * Only for use by the library itself.
62
 *
63
 * @y.exclude
64
 */
65
  public static final int MASK= (1<<LENGTH)-1;
66 da9b3f07 Leszek Koltunski
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68 faa3ff56 Leszek Koltunski
/**
69
 * Only for use by the library itself.
70
 *
71
 * @y.exclude
72
 */
73 da9b3f07 Leszek Koltunski
  public static void reset(int[] maxtable)
74
    {
75 de77a6c5 Leszek Koltunski
    maxtable[0] =100;  // By default, there can be a maximum 100 MATRIX effects in a single
76
                       // EffectQueueMatrix at any given time. This can be changed with a call
77
                       // to EffectQueueMatrix.setMax(int)
78 97b6c85e Leszek Koltunski
    maxtable[1] = 30;  // Max 30 VERTEX Effects
79 2b7d2abb Leszek Koltunski
    maxtable[2] =  5;  // Max 5 FRAGMENT Effects
80 de77a6c5 Leszek Koltunski
    maxtable[3] =  3;  // Max 3 POSTPROCESSING Effects
81 da9b3f07 Leszek Koltunski
    }
82 4af5bbe6 Leszek Koltunski
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84
/**
85
 * Returns the i-th EffectType.
86
 * <p>
87
 * If you want to loop over all possible effect types, you need this.
88
 */
89
  public static EffectType getType(int ordinal)
90
    {
91
    return values()[ordinal];
92
    }
93
94 da9b3f07 Leszek Koltunski
  }