Project

General

Profile

« Previous | Next » 

Revision 1e438fc7

Added by Leszek Koltunski almost 8 years ago

Introduce ENUM EffectTypes

View differences:

src/main/java/org/distorted/library/EffectNames.java
6 6
  {
7 7
  // EFFECT NAME /////// EFFECT TYPE ////////////// UNITY /////////////////////////
8 8
   
9
  ROTATE           ( Distorted.TYPE_PRE ,   new float[] {0.0f}           ),
10
  QUATERNION       ( Distorted.TYPE_PRE ,   new float[] {0.0f,0.0f,0.0f} ),      // quaternion is a unity iff its axis (x,y,z) is (0,0,0)
11
  MOVE             ( Distorted.TYPE_PRE ,   new float[] {0.0f,0.0f,0.0f} ),
12
  SCALE            ( Distorted.TYPE_PRE ,   new float[] {1.0f,1.0f,1.0f} ),
13
  SHEAR            ( Distorted.TYPE_PRE ,   new float[] {0.0f,0.0f,0.0f} ),
14
  // add new PreShader effects here...
9
  ROTATE           ( EffectTypes.MATRIX  ,   new float[] {0.0f}           ),
10
  QUATERNION       ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} ),      // quaternion is a unity iff its axis (x,y,z) is (0,0,0)
11
  MOVE             ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} ),
12
  SCALE            ( EffectTypes.MATRIX  ,   new float[] {1.0f,1.0f,1.0f} ),
13
  SHEAR            ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} ),
14
  // add new Matrix effects here...
15 15
  
16
  DISTORT          ( Distorted.TYPE_VERT,   new float[] {0.0f,0.0f,0.0f} ),      // keep this the first VERT effect (reason: getType)
17
  DEFORM           ( Distorted.TYPE_VERT,   new float[] {0.0f,0.0f}      ),
18
  SINK             ( Distorted.TYPE_VERT,   new float[] {1.0f}           ),
19
  SWIRL            ( Distorted.TYPE_VERT,   new float[] {0.0f}           ),
20
  WAVE             ( Distorted.TYPE_VERT,   new float[] {0.0f}           ),
16
  DISTORT          ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f,0.0f} ),      // keep this the first VERT effect (reason: getType)
17
  DEFORM           ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f}      ),
18
  SINK             ( EffectTypes.VERTEX  ,   new float[] {1.0f}           ),
19
  SWIRL            ( EffectTypes.VERTEX  ,   new float[] {0.0f}           ),
20
  WAVE             ( EffectTypes.VERTEX  ,   new float[] {0.0f}           ),
21 21
  // add new Vertex Effects here...
22 22
  
23
  MACROBLOCK       ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),      // keep this the first FRAG effect (reason: getType)
24
  ALPHA            ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
25
  SMOOTH_ALPHA     ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
26
  CHROMA           ( Distorted.TYPE_FRAG,   new float[] {0.0f}           ),
27
  SMOOTH_CHROMA    ( Distorted.TYPE_FRAG,   new float[] {0.0f}           ),
28
  BRIGHTNESS       ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
29
  SMOOTH_BRIGHTNESS( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
30
  SATURATION       ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
31
  SMOOTH_SATURATION( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
32
  CONTRAST         ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
33
  SMOOTH_CONTRAST  ( Distorted.TYPE_FRAG,   new float[] {1.0f}           ),
34
  HUE              ( Distorted.TYPE_FRAG,   new float[] {0.0f}           ),
35
  SMOOTH_HUE       ( Distorted.TYPE_FRAG,   new float[] {0.0f}           ),
23
  MACROBLOCK       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),      // keep this the first FRAG effect (reason: getType)
24
  ALPHA            ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
25
  SMOOTH_ALPHA     ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
26
  CHROMA           ( EffectTypes.FRAGMENT,   new float[] {0.0f}           ),
27
  SMOOTH_CHROMA    ( EffectTypes.FRAGMENT,   new float[] {0.0f}           ),
28
  BRIGHTNESS       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
29
  SMOOTH_BRIGHTNESS( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
30
  SATURATION       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
31
  SMOOTH_SATURATION( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
32
  CONTRAST         ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
33
  SMOOTH_CONTRAST  ( EffectTypes.FRAGMENT,   new float[] {1.0f}           ),
34
  HUE              ( EffectTypes.FRAGMENT,   new float[] {0.0f}           ),
35
  SMOOTH_HUE       ( EffectTypes.FRAGMENT,   new float[] {0.0f}           ),
36 36
  // add new Fragment effects here...
37 37

  
38
  SAVE_PNG         ( Distorted.TYPE_POST,   null                         ),      // PostShader Effects don't have Unities.
39
  SAVE_MP4         ( Distorted.TYPE_POST,   null                         );      //
40
  // add new PostShader effects here...
38
  SAVE_PNG         ( EffectTypes.OTHER   ,   null                         ),      // OTHER Effects don't have Unities.
39
  SAVE_MP4         ( EffectTypes.OTHER   ,   null                         );      //
40
  // add new Other effects here...
41 41

  
42 42
///////////////////////////////////////////////////////////////////////////////////////////////////
43 43
  
44 44
  private static final int MAXDIM = 4;  // maximum supported dimension of an effect  
45 45
  
46
  private int type;
46
  private EffectTypes type;
47 47
  private float[] unity;
48 48
  
49 49
  static private float[] unities;
......
76 76
  
77 77
///////////////////////////////////////////////////////////////////////////////////////////////////
78 78
  
79
  private EffectNames(int type, float[] unity)
79
  EffectNames(EffectTypes type, float[] unity)
80 80
    {
81 81
    this.type = type;  
82 82
    this.unity= unity;
......
84 84

  
85 85
///////////////////////////////////////////////////////////////////////////////////////////////////
86 86
  
87
  public int getType()
87
  public EffectTypes getType()
88 88
    {
89 89
    return type;  
90 90
    }
91 91

  
92 92
///////////////////////////////////////////////////////////////////////////////////////////////////
93 93
  
94
  static int getType(int ordinal)
94
  static EffectTypes getType(int ordinal)
95 95
    {
96
    if( ordinal<DISTORT.ordinal()     ) return Distorted.TYPE_PRE;
97
    if( ordinal<MACROBLOCK.ordinal()  ) return Distorted.TYPE_VERT;
98
    if( ordinal<SAVE_PNG.ordinal()    ) return Distorted.TYPE_FRAG;
96
    if( ordinal<DISTORT.ordinal()     ) return EffectTypes.MATRIX;
97
    if( ordinal<MACROBLOCK.ordinal()  ) return EffectTypes.VERTEX;
98
    if( ordinal<SAVE_PNG.ordinal()    ) return EffectTypes.FRAGMENT;
99 99

  
100
    return Distorted.TYPE_POST;
100
    return EffectTypes.OTHER;
101 101
    }
102 102

  
103 103
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff