Project

General

Profile

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

library / src / main / java / org / distorted / library / effect / Effect.java @ fe82a979

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 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
package org.distorted.library.effect;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

    
24
public abstract class Effect
25
  {
26
  private final long mID;
27
  private final int mType;
28
  private final int mName;
29
  private final int mDimension;
30
  private final boolean mSupportsR;
31
  private final boolean mSupportsC;
32

    
33
  private static long mNextID = 0;
34

    
35
  public static final int MATRIX      = 0;
36
  public static final int VERTEX      = 1;
37
  public static final int FRAGMENT    = 2;
38
  public static final int POSTPROCESS = 3;
39

    
40
  public static final int LENGTH = 4;           // The number of effect types above.
41
  public static final int MASK= (1<<LENGTH)-1;  // Needed when we do bitwise operations on Effect Types.
42

    
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

    
45
  public static void onDestroy()
46
    {
47
    mNextID = 0;
48
    }
49

    
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

    
52
  public static void reset(int[] maxtable)
53
    {
54
    maxtable[0] = MatrixEffect.MAX;
55
    maxtable[1] = VertexEffect.MAX;
56
    maxtable[2] = FragmentEffect.MAX;
57
    maxtable[3] = PostprocessEffect.MAX;
58
    }
59

    
60
///////////////////////////////////////////////////////////////////////////////////////////////////
61

    
62
  public int getType()
63
    {
64
    return mType;
65
    }
66

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

    
69
  public int getName()
70
    {
71
    return mName;
72
    }
73

    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75

    
76
  public long getID()
77
    {
78
    return mID;
79
    }
80

    
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

    
83
  public boolean supportsCenter()
84
    {
85
    return mSupportsC;
86
    }
87

    
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89

    
90
  public boolean supportsRegion()
91
    {
92
    return mSupportsR;
93
    }
94

    
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96

    
97
  public int getDimension()
98
    {
99
    return mDimension;
100
    }
101

    
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

    
104
  Effect(int type, int name, int dimension, boolean center, boolean region)
105
    {
106
    mID        = mNextID++;
107

    
108
    mName      = name;
109
    mType      = type;
110
    mDimension = dimension;
111
    mSupportsC = center;
112
    mSupportsR = region;
113
    }
114
  }
(1-1/23)