Project

General

Profile

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

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

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski  leszek@koltunski.pl                                          //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// 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
//                                                                                               //
11
// This library 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 GNU                             //
14
// Lesser General Public License for more details.                                               //
15
//                                                                                               //
16
// 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
///////////////////////////////////////////////////////////////////////////////////////////////////
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
/**
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

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68
/**
69
 * Only for use by the library itself.
70
 *
71
 * @y.exclude
72
 */
73
  public static void reset(int[] maxtable)
74
    {
75
    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
    maxtable[1] = 30;  // Max 30 VERTEX Effects
79
    maxtable[2] =  5;  // Max 5 FRAGMENT Effects
80
    maxtable[3] =  3;  // Max 3 POSTPROCESSING Effects
81
    }
82

    
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
  }
(4-4/34)