Project

General

Profile

« Previous | Next » 

Revision faa3ff56

Added by Leszek Koltunski over 7 years ago

Javadoc.

View differences:

src/main/java/org/distorted/library/effect/Effect.java
20 20
package org.distorted.library.effect;
21 21

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

  
23
/**
24
 * Abstract Effect of any type.
25
 */
24 26
public abstract class Effect
25 27
  {
26 28
  private final static int MAX_UNITY_DIM = 4;
......
47 49

  
48 50
///////////////////////////////////////////////////////////////////////////////////////////////////
49 51

  
50
  public abstract boolean compute(float[] uniforms, int index, long currentDuration, long step );
52
  Effect(EffectName name)
53
    {
54
    mName      = name;
55
    mType      = name.getType();
56
    mDimension = name.getDimension();
57
    mSupportsC = name.supportsCenter();
58
    mSupportsR = name.supportsRegion();
51 59

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
60
    int n = name.ordinal();
61
    float[] u = name.getUnity();
62
    int l = name.getUnity().length;
53 63

  
64
    for(int i=0; i<l; i++)
65
      {
66
      mUnity[n*MAX_UNITY_DIM+i] = u[i];
67
      }
68

  
69
    mUnityDim[n] = l;
70

  
71
    mID = ((mNextID++)<<EffectType.LENGTH) + mType.ordinal();
72
    }
73

  
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75
/**
76
 * Only for use by the library itself.
77
 *
78
 * @y.exclude
79
 */
54 80
  public static void onDestroy()
55 81
    {
56 82
    mNextID = 0;
......
59 85
    }
60 86

  
61 87
///////////////////////////////////////////////////////////////////////////////////////////////////
88
/**
89
 * Only for use by the library itself.
90
 *
91
 * @y.exclude
92
 */
93
  public abstract boolean compute(float[] uniforms, int index, long currentDuration, long step );
62 94

  
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96
// PUBLIC API
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98
/**
99
 * Do the set of Uniforms written in buffer[index], buffer[index+1], etc represent a Unity, i.e a
100
 * null Effect?
101
 */
63 102
  public boolean isUnity(float[] buffer, int index)
64 103
    {
65 104
    int name = mName.ordinal();
......
82 121
    return false;
83 122
    }
84 123
///////////////////////////////////////////////////////////////////////////////////////////////////
85

  
124
/**
125
 * Return the EffectType enum corresponding to this Effect.
126
 *
127
 * @see EffectType
128
 */
86 129
  public EffectType getType()
87 130
    {
88 131
    return mType;
89 132
    }
90 133

  
91 134
///////////////////////////////////////////////////////////////////////////////////////////////////
92

  
135
/**
136
 * Return the EffectName enum corresponding to this Effect.
137
 *
138
 * @see EffectName
139
 */
93 140
  public EffectName getName()
94 141
    {
95 142
    return mName;
96 143
    }
97 144

  
98 145
///////////////////////////////////////////////////////////////////////////////////////////////////
99

  
146
/**
147
 * Return the unique ID of this Effect.
148
 */
100 149
  public long getID()
101 150
    {
102 151
    return mID;
103 152
    }
104 153

  
105 154
///////////////////////////////////////////////////////////////////////////////////////////////////
106

  
155
/**
156
 * Return a printable name of this Effect.
157
 */
107 158
  public String getString()
108 159
    {
109 160
    return mName.name();
110 161
    }
111 162

  
112 163
///////////////////////////////////////////////////////////////////////////////////////////////////
113

  
164
/**
165
 * Does this effect have a Center?
166
 */
114 167
  public boolean supportsCenter()
115 168
    {
116 169
    return mSupportsC;
117 170
    }
118 171

  
119 172
///////////////////////////////////////////////////////////////////////////////////////////////////
120

  
173
/**
174
 * Does this effect support being masked by a Region?
175
 */
121 176
  public boolean supportsRegion()
122 177
    {
123 178
    return mSupportsR;
124 179
    }
125 180

  
126 181
///////////////////////////////////////////////////////////////////////////////////////////////////
127

  
182
/**
183
 * Return the number of Uniforms needed to describe this effect.
184
 */
128 185
  public int getDimension()
129 186
    {
130 187
    return mDimension;
131 188
    }
132

  
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

  
135
  Effect(EffectName name)
136
    {
137
    mName      = name;
138
    mType      = name.getType();
139
    mDimension = name.getDimension();
140
    mSupportsC = name.supportsCenter();
141
    mSupportsR = name.supportsRegion();
142

  
143
    int n = name.ordinal();
144
    float[] u = name.getUnity();
145
    int l = name.getUnity().length;
146

  
147
    for(int i=0; i<l; i++)
148
      {
149
      mUnity[n*MAX_UNITY_DIM+i] = u[i];
150
      }
151

  
152
    mUnityDim[n] = l;
153

  
154
    mID = ((mNextID++)<<EffectType.LENGTH) + mType.ordinal();
155
    }
156 189
  }
src/main/java/org/distorted/library/effect/EffectQuality.java
39 39
  LOW      ( 3 );
40 40

  
41 41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

  
43
  public static final float MULTIPLIER = 0.5f;      // each next Quality level renders into 1/0.5 smaller buffers
42
/**
43
 * Each next Quality level renders into 1/MULTIPLIER smaller buffers.
44
 */
45
  public static final float MULTIPLIER = 0.5f;
46
/**
47
 * Numof of possible qualities.
48
 */
44 49
  public static final int LENGTH = values().length;
45 50

  
46 51
  private final int level;
......
53 58
    }
54 59

  
55 60
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
61
/**
62
 * Only for use by the library itself.
63
 *
64
 * @y.exclude
65
 */
57 66
  public int getLevel()
58 67
    {
59 68
    return level;
src/main/java/org/distorted/library/effect/EffectType.java
48 48
  POSTPROCESS;
49 49

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

  
52
  public static final int LENGTH = values().length;  // The number of effect types.
53
  public static final int MASK= (1<<LENGTH)-1;       // Needed when we do bitwise operations on Effect Types.
51
/**
52
 * Number of effect types.
53
 * Only for use by the library itself.
54
 *
55
 * @y.exclude
56
 */
57
  public static final int LENGTH = values().length;
58
/**
59
 * Needed when we do bitwise operations on Effect Types.
60
 * Only for use by the library itself.
61
 *
62
 * @y.exclude
63
 */
64
  public static final int MASK= (1<<LENGTH)-1;
54 65

  
55 66
///////////////////////////////////////////////////////////////////////////////////////////////////
56
// called from EffectQueue
57

  
67
/**
68
 * Only for use by the library itself.
69
 *
70
 * @y.exclude
71
 */
58 72
  public static void reset(int[] maxtable)
59 73
    {
60 74
    maxtable[0] =10;  // By default, there can be a maximum 10 MATRIX effects in a single
src/main/java/org/distorted/library/effect/FragmentEffect.java
20 20
package org.distorted.library.effect;
21 21

  
22 22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
// FRAGMENT EFFECTS
24

  
25

  
23
/**
24
 * Fragment Effect - an Effect that works by injecting certain code into the main Fragment shader.
25
 */
26 26
public abstract class FragmentEffect extends Effect
27 27
  {
28
  public static final int NUM_UNIFORMS = 8; // 4-per effect interpolated values, 4 dimensional Region.
28
/**
29
 * 8: 4-per effect interpolated values, 4 dimensional Region.
30
 */
31
  public static final int NUM_UNIFORMS = 8;
29 32
  private static String mGLSL = "";
30 33
  private static int mNumEnabled = 0;
31 34

  
......
37 40
    }
38 41

  
39 42
///////////////////////////////////////////////////////////////////////////////////////////////////
43
// prepare code to be injected into the 'main_fragment_shader' main() function.
40 44

  
41 45
  static void addEffect(EffectName not_smooth, EffectName yes_smooth, String code)
42 46
    {
......
64 68
    }
65 69

  
66 70
///////////////////////////////////////////////////////////////////////////////////////////////////
67

  
71
/**
72
 * Only for use by the library itself.
73
 *
74
 * @y.exclude
75
 */
68 76
  public static String getGLSL()
69 77
    {
70 78
    return mGLSL + "{}";
71 79
    }
72 80

  
73 81
///////////////////////////////////////////////////////////////////////////////////////////////////
74

  
75
  public static int getNumEnabled()
82
/**
83
 * Only for use by the library itself.
84
 *
85
 * @y.exclude
86
 */
87
  public static void onDestroy()
76 88
    {
77
    return mNumEnabled;
89
    mNumEnabled = 0;
90
    mGLSL = "";
78 91
    }
79 92

  
80 93
///////////////////////////////////////////////////////////////////////////////////////////////////
81

  
82
  public static void onDestroy()
94
// PUBLIC API
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96
/**
97
 * Return the number of Fragment effects enabled.
98
 */
99
  public static int getNumEnabled()
83 100
    {
84
    mNumEnabled = 0;
85
    mGLSL = "";
101
    return mNumEnabled;
86 102
    }
87 103
  }
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java
24 24
import org.distorted.library.type.Static4D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Make a certain Region change its transparency level.
29
 */
28 30
public class FragmentEffectAlpha extends FragmentEffect
29 31
  {
30 32
  private Data1D mAlpha;
31 33
  private Data4D mRegion;
32 34

  
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36
/**
37
 * Only for use by the library itself.
38
 *
39
 * @y.exclude
40
 */
41
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
42
    {
43
    mRegion.get(uniforms, index+4, currentDuration, step);
44
    return mAlpha.get(uniforms,index, currentDuration, step);
45
    }
46

  
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48
// PUBLIC API
33 49
///////////////////////////////////////////////////////////////////////////////////////////////////
34 50
/**
35 51
 * Makes a certain sub-region of the Object smoothly change its transparency level.
......
61 77
    }
62 78

  
63 79
///////////////////////////////////////////////////////////////////////////////////////////////////
64

  
65
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
66
    {
67
    mRegion.get(uniforms, index+4, currentDuration, step);
68
    return mAlpha.get(uniforms,index, currentDuration, step);
69
    }
70

  
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

  
80
/**
81
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
82
 */
73 83
  public static void enable()
74 84
    {
75 85
    addEffect( EffectName.ALPHA,EffectName.SMOOTH_ALPHA,
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.java
24 24
import org.distorted.library.type.Static4D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Make a certain Region change its brightness level.
29
 */
28 30
public class FragmentEffectBrightness extends FragmentEffect
29 31
  {
30 32
  private Data1D mBrightness;
31 33
  private Data4D mRegion;
32 34

  
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37
/**
38
 * Only for use by the library itself.
39
 *
40
 * @y.exclude
41
 */
42
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
43
    {
44
    mRegion.get(uniforms,index+4,currentDuration,step);
45
    return mBrightness.get(uniforms,index,currentDuration,step);
46
    }
47

  
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49
// PUBLIC API
33 50
///////////////////////////////////////////////////////////////////////////////////////////////////
34 51
/**
35 52
 * Makes a certain sub-region of the Object smoothly change its brightness level.
......
59 76
    }
60 77

  
61 78
///////////////////////////////////////////////////////////////////////////////////////////////////
62

  
63
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
64
    {
65
    mRegion.get(uniforms,index+4,currentDuration,step);
66
    return mBrightness.get(uniforms,index,currentDuration,step);
67
    }
68

  
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

  
79
/**
80
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
81
 */
71 82
  public static void enable()
72 83
    {
73 84
    addEffect( EffectName.BRIGHTNESS,EffectName.SMOOTH_BRIGHTNESS,
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java
25 25
import org.distorted.library.type.Static4D;
26 26

  
27 27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
28
/**
29
 * Make a certain Region change its color.
30
 */
29 31
public class FragmentEffectChroma extends FragmentEffect
30 32
  {
31 33
  private Data1D mBlend;
32 34
  private Data3D mColor;
33 35
  private Data4D mRegion;
34 36

  
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38
/**
39
 * Only for use by the library itself.
40
 *
41
 * @y.exclude
42
 */
43
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
44
    {
45
    mRegion.get(uniforms,index+4,currentDuration,step);
46
    mColor.get(uniforms,index+1,currentDuration,step);
47
    return mBlend.get(uniforms,index,currentDuration,step);
48
    }
49

  
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51
// PUBLIC API
35 52
///////////////////////////////////////////////////////////////////////////////////////////////////
36 53
/**
37 54
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
......
69 86
    }
70 87

  
71 88
///////////////////////////////////////////////////////////////////////////////////////////////////
72

  
73
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
74
    {
75
    mRegion.get(uniforms,index+4,currentDuration,step);
76
    mColor.get(uniforms,index+1,currentDuration,step);
77
    return mBlend.get(uniforms,index,currentDuration,step);
78
    }
79

  
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81

  
89
/**
90
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
91
 */
82 92
  public static void enable()
83 93
    {
84 94
    addEffect( EffectName.CHROMA,EffectName.SMOOTH_CHROMA,
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java
24 24
import org.distorted.library.type.Static4D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Make a certain Region change its contrast level.
29
 */
28 30
public class FragmentEffectContrast extends FragmentEffect
29 31
  {
30 32
  private Data1D mContrast;
31 33
  private Data4D mRegion;
32 34

  
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36
/**
37
 * Only for use by the library itself.
38
 *
39
 * @y.exclude
40
 */
41
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
42
    {
43
    mRegion.get(uniforms,index+4,currentDuration,step);
44
    return mContrast.get(uniforms,index,currentDuration,step);
45
    }
46

  
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48
// PUBLIC API
33 49
///////////////////////////////////////////////////////////////////////////////////////////////////
34 50
/**
35 51
 * Makes a certain sub-region of the Object smoothly change its contrast level.
......
59 75
    }
60 76

  
61 77
///////////////////////////////////////////////////////////////////////////////////////////////////
62

  
63
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
64
    {
65
    mRegion.get(uniforms,index+4,currentDuration,step);
66
    return mContrast.get(uniforms,index,currentDuration,step);
67
    }
68

  
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

  
78
/**
79
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
80
 */
71 81
  public static void enable()
72 82
    {
73 83
    addEffect( EffectName.CONTRAST,EffectName.SMOOTH_CONTRAST,
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.java
24 24
import org.distorted.library.type.Static4D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Make a certain Region change its color saturation.
29
 */
28 30
public class FragmentEffectSaturation extends FragmentEffect
29 31
  {
30 32
  private Data1D mSaturation;
31 33
  private Data4D mRegion;
32 34

  
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36
/**
37
 * Only for use by the library itself.
38
 *
39
 * @y.exclude
40
 */
41
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
42
    {
43
    mRegion.get(uniforms,index+4,currentDuration,step);
44
    return mSaturation.get(uniforms,index,currentDuration,step);
45
    }
46

  
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48
// PUBLIC API
33 49
///////////////////////////////////////////////////////////////////////////////////////////////////
34 50
/**
35 51
 * Makes a certain sub-region of the Object smoothly change its saturation level.
......
61 77
    }
62 78

  
63 79
///////////////////////////////////////////////////////////////////////////////////////////////////
64

  
65
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
66
    {
67
    mRegion.get(uniforms,index+4,currentDuration,step);
68
    return mSaturation.get(uniforms,index,currentDuration,step);
69
    }
70

  
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

  
80
/**
81
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
82
 */
73 83
  public static void enable()
74 84
    {
75 85
    addEffect( EffectName.SATURATION,EffectName.SMOOTH_SATURATION,
src/main/java/org/distorted/library/effect/MatrixEffect.java
20 20
package org.distorted.library.effect;
21 21

  
22 22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
// MATRIX EFFECTS.
24

  
23
/**
24
 * Matrix Effect - an Effect that works by modifying the ModelView matrix.
25
 */
25 26
public abstract class MatrixEffect extends Effect
26 27
  {
27
  public static final int NUM_UNIFORMS = 7; // 4 per-effect interpolated values + 3 dimensional center.
28
/**
29
 * 7: 4 per-effect interpolated values + 3 dimensional center.
30
 */
31
  public static final int NUM_UNIFORMS = 7;
28 32

  
29 33
///////////////////////////////////////////////////////////////////////////////////////////////////
30

  
34
/**
35
 * Only for use by the library itself.
36
 *
37
 * @y.exclude
38
 */
31 39
  public abstract void apply(float[] matrix, float[] uniforms, int index);
32 40

  
33 41
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/MatrixEffectMove.java
24 24
import org.distorted.library.type.Data3D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Move the Mesh by a 3D vector.
29
 */
28 30
public class MatrixEffectMove extends MatrixEffect
29 31
  {
30 32
  private Data3D mVector;
31 33

  
32 34
///////////////////////////////////////////////////////////////////////////////////////////////////
33 35
/**
34
 * Moves the Object by a (possibly changing in time) vector.
36
 * Only for use by the library itself.
35 37
 *
36
 * @param vector current coordinates of the vector we want to move the Object with.
38
 * @y.exclude
37 39
 */
38
  public MatrixEffectMove(Data3D vector)
39
    {
40
    super(EffectName.MOVE);
41
    mVector = vector;
42
    }
43

  
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

  
46 40
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
47 41
    {
48 42
    return mVector.get(uniforms,index,currentDuration,step);
49 43
    }
50 44

  
51 45
///////////////////////////////////////////////////////////////////////////////////////////////////
52

  
46
/**
47
 * Only for use by the library itself.
48
 *
49
 * @y.exclude
50
 */
53 51
  public void apply(float[] matrix, float[] uniforms, int index)
54 52
    {
55 53
    float sx = uniforms[NUM_UNIFORMS*index  ];
......
58 56

  
59 57
    Matrix.translateM(matrix, 0, sx,-sy, sz);
60 58
    }
59

  
60
///////////////////////////////////////////////////////////////////////////////////////////////////
61
// PUBLIC API
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63
/**
64
 * Move the Mesh by a 3D vector.
65
 *
66
 * @param vector current coordinates of the vector we want to move the Mesh with.
67
 */
68
  public MatrixEffectMove(Data3D vector)
69
    {
70
    super(EffectName.MOVE);
71
    mVector = vector;
72
    }
61 73
  }
src/main/java/org/distorted/library/effect/MatrixEffectQuaternion.java
25 25
import org.distorted.library.type.Data4D;
26 26

  
27 27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
28
/**
29
 * Rotate the Mesh by a quaternion.
30
 */
29 31
public class MatrixEffectQuaternion extends MatrixEffect
30 32
  {
31 33
  private Data4D mQuaternion;
......
36 38

  
37 39
///////////////////////////////////////////////////////////////////////////////////////////////////
38 40
/**
39
 * Rotates the Object by quaternion.
41
 * Only for use by the library itself.
40 42
 *
41
 * @param quaternion Quaternion describing the rotation.
42
 * @param center     Coordinates of the Point we are rotating around.
43
 * @y.exclude
43 44
 */
44
  public MatrixEffectQuaternion(Data4D quaternion, Data3D center )
45
    {
46
    super(EffectName.QUATERNION);
47
    mQuaternion = quaternion;
48
    mCenter = center;
49
    }
50

  
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

  
53 45
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
54 46
    {
55 47
    mCenter.get(uniforms,index+4,currentDuration,step);
......
57 49
    }
58 50

  
59 51
///////////////////////////////////////////////////////////////////////////////////////////////////
60

  
52
/**
53
 * Only for use by the library itself.
54
 *
55
 * @y.exclude
56
 */
61 57
  public void apply(float[] matrix, float[] uniforms, int index)
62 58
    {
63 59
    float qX = uniforms[NUM_UNIFORMS*index  ];
......
119 115
    matrix[14] = mTmpMatrix2[14];
120 116
    matrix[15] = mTmpMatrix2[15];
121 117
    }
118

  
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120
// PUBLIC API
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122
/**
123
 * Rotate the Mesh by a quaternion.
124
 *
125
 * @param quaternion Quaternion describing the rotation.
126
 * @param center     Coordinates of the Point we are rotating around.
127
 */
128
  public MatrixEffectQuaternion(Data4D quaternion, Data3D center )
129
    {
130
    super(EffectName.QUATERNION);
131
    mQuaternion = quaternion;
132
    mCenter = center;
133
    }
122 134
  }
src/main/java/org/distorted/library/effect/MatrixEffectRotate.java
25 25
import org.distorted.library.type.Data3D;
26 26

  
27 27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
28
/**
29
 * Rotate the Mesh by 'angle' degrees around the center, along an axis.
30
 */
29 31
public class MatrixEffectRotate extends MatrixEffect
30 32
  {
31 33
  private Data1D mAngle;
......
33 35

  
34 36
///////////////////////////////////////////////////////////////////////////////////////////////////
35 37
/**
36
 * Rotates the Object by 'angle' degrees around the center.
37
 * Static axis of rotation is given by the last parameter.
38
 * Only for use by the library itself.
38 39
 *
39
 * @param angle  Angle that we want to rotate the Object to. Unit: degrees
40
 * @param axis   Axis of rotation
41
 * @param center Coordinates of the Point we are rotating around.
40
 * @y.exclude
42 41
 */
43
  public MatrixEffectRotate(Data1D angle, Data3D axis, Data3D center)
44
    {
45
    super(EffectName.ROTATE);
46
    mAngle = angle;
47
    mAxis = axis;
48
    mCenter = center;
49
    }
50

  
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

  
53 42
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
54 43
    {
55 44
    mCenter.get(uniforms,index+4,currentDuration,step);
......
58 47
    }
59 48

  
60 49
///////////////////////////////////////////////////////////////////////////////////////////////////
61

  
50
/**
51
 * Only for use by the library itself.
52
 *
53
 * @y.exclude
54
 */
62 55
  public void apply(float[] matrix, float[] uniforms, int index)
63 56
    {
64 57
    float alpha = uniforms[NUM_UNIFORMS*index  ];
......
74 67
    Matrix.rotateM( matrix, 0, alpha, axisX, axisY, axisZ);
75 68
    Matrix.translateM(matrix, 0,-x, y,-z);
76 69
    }
70

  
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72
// PUBLIC API
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74
/**
75
 * Rotate the Mesh by 'angle' degrees around the center, along an axis.
76
 *
77
 * @param angle  Angle that we want to rotate the Object to. Unit: degrees
78
 * @param axis   Axis of rotation
79
 * @param center Coordinates of the Point we are rotating around.
80
 */
81
  public MatrixEffectRotate(Data1D angle, Data3D axis, Data3D center)
82
    {
83
    super(EffectName.ROTATE);
84
    mAngle = angle;
85
    mAxis = axis;
86
    mCenter = center;
87
    }
77 88
  }
src/main/java/org/distorted/library/effect/MatrixEffectScale.java
25 25
import org.distorted.library.type.Static3D;
26 26

  
27 27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
28
/**
29
 * Scale the Mesh by 3D scale factors.
30
 */
29 31
public class MatrixEffectScale extends MatrixEffect
30 32
  {
31 33
  private Data3D mScale;
32 34

  
33 35
///////////////////////////////////////////////////////////////////////////////////////////////////
34 36
/**
35
 * Scales the Object by (possibly changing in time) 3D scale factors.
37
 * Only for use by the library itself.
36 38
 *
37
 * @param scale current x- , y- and z- scale factors.
39
 * @y.exclude
38 40
 */
39
  public MatrixEffectScale(Data3D scale)
41
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
40 42
    {
41
    super(EffectName.SCALE);
42
    mScale = scale;
43
    return mScale.get(uniforms,index,currentDuration,step);
43 44
    }
44 45

  
45 46
///////////////////////////////////////////////////////////////////////////////////////////////////
46 47
/**
47
 * Scales the Object by (possibly changing in time) 3D scale factors.
48
 * Only for use by the library itself.
48 49
 *
49
 * @param scale Common x,y, and z scale factor.
50
 * @y.exclude
50 51
 */
51
  public MatrixEffectScale(float scale)
52
  public void apply(float[] matrix, float[] uniforms, int index)
52 53
    {
53
    super(EffectName.SCALE);
54
    mScale = new Static3D(scale,scale,scale);
54
    float sx = uniforms[NUM_UNIFORMS*index  ];
55
    float sy = uniforms[NUM_UNIFORMS*index+1];
56
    float sz = uniforms[NUM_UNIFORMS*index+2];
57

  
58
    Matrix.scaleM(matrix, 0, sx, sy, sz);
55 59
    }
56 60

  
57 61
///////////////////////////////////////////////////////////////////////////////////////////////////
58

  
59
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
62
// PUBLIC API
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64
/**
65
 * Scale the Mesh by 3D scale factors.
66
 *
67
 * @param scale current x- , y- and z- scale factors.
68
 */
69
  public MatrixEffectScale(Data3D scale)
60 70
    {
61
    return mScale.get(uniforms,index,currentDuration,step);
71
    super(EffectName.SCALE);
72
    mScale = scale;
62 73
    }
63 74

  
64 75
///////////////////////////////////////////////////////////////////////////////////////////////////
65

  
66
  public void apply(float[] matrix, float[] uniforms, int index)
76
/**
77
 * Scale the Mesh by 3D scale factors.
78
 *
79
 * @param scale Common x,y, and z scale factor.
80
 */
81
  public MatrixEffectScale(float scale)
67 82
    {
68
    float sx = uniforms[NUM_UNIFORMS*index  ];
69
    float sy = uniforms[NUM_UNIFORMS*index+1];
70
    float sz = uniforms[NUM_UNIFORMS*index+2];
71

  
72
    Matrix.scaleM(matrix, 0, sx, sy, sz);
83
    super(EffectName.SCALE);
84
    mScale = new Static3D(scale,scale,scale);
73 85
    }
74 86
  }
src/main/java/org/distorted/library/effect/MatrixEffectShear.java
24 24
import org.distorted.library.type.Data3D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Shear the Mesh.
29
 */
28 30
public class MatrixEffectShear extends MatrixEffect
29 31
  {
30 32
  private Data3D mShear, mCenter;
31 33

  
32 34
///////////////////////////////////////////////////////////////////////////////////////////////////
33 35
/**
34
 * Shears the Object.
36
 * Only for use by the library itself.
35 37
 *
36
 * @param shear   The 3-tuple of shear factors. The first controls level
37
 *                of shearing in the X-axis, second - Y-axis and the third -
38
 *                Z-axis. Each is the tangens of the shear angle, i.e 0 -
39
 *                no shear, 1 - shear by 45 degrees (tan(45deg)=1) etc.
40
 * @param center  Center of shearing, i.e. the point which stays unmoved.
38
 * @y.exclude
41 39
 */
42
  public MatrixEffectShear(Data3D shear, Data3D center)
43
    {
44
    super(EffectName.SHEAR);
45
    mShear = shear;
46
    mCenter = center;
47
    }
48

  
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

  
51 40
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
52 41
    {
53 42
    mCenter.get(uniforms,index+4,currentDuration,step);
......
55 44
    }
56 45

  
57 46
///////////////////////////////////////////////////////////////////////////////////////////////////
58

  
47
/**
48
 * Only for use by the library itself.
49
 *
50
 * @y.exclude
51
 */
59 52
  public void apply(float[] matrix, float[] uniforms, int index)
60 53
    {
61 54
    float sx = uniforms[NUM_UNIFORMS*index  ];
......
85 78

  
86 79
    Matrix.translateM(matrix, 0,-x, y, -z);
87 80
    }
81

  
82
///////////////////////////////////////////////////////////////////////////////////////////////////
83
// PUBLIC API
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85
/**
86
 * Shear the Mesh.
87
 *
88
 * @param shear   The 3-tuple of shear factors. The first controls level
89
 *                of shearing in the X-axis, second - Y-axis and the third -
90
 *                Z-axis. Each is the tangens of the shear angle, i.e 0 -
91
 *                no shear, 1 - shear by 45 degrees (tan(45deg)=1) etc.
92
 * @param center  Center of shearing, i.e. the point which stays unmoved.
93
 */
94
  public MatrixEffectShear(Data3D shear, Data3D center)
95
    {
96
    super(EffectName.SHEAR);
97
    mShear = shear;
98
    mCenter = center;
99
    }
88 100
  }
src/main/java/org/distorted/library/effect/PostprocessEffect.java
28 28
import java.util.ArrayList;
29 29

  
30 30
///////////////////////////////////////////////////////////////////////////////////////////////////
31
// POSTPROCESSING EFFECTS.
32

  
31
/**
32
 * Postprocessing Effect - an Effect that works by running a certain Shader Program(s) on a Framebuffer.
33
 */
33 34
public abstract class PostprocessEffect extends Effect
34 35
  {
35
  public static final int NUM_UNIFORMS = 5; // 5 per-effect interpolated values.
36
/**
37
 * 5: 5 per-effect interpolated values.
38
 */
39
  public static final int NUM_UNIFORMS = 5;
36 40

  
37
  static final int POS_DATA_SIZE= 2; // Blur Program: size of the position data in elements
38
  static final int TEX_DATA_SIZE= 2; // Blur Program: size of the texture coordinate data in elements.
41
  static final int POS_DATA_SIZE= 2;
42
  static final int TEX_DATA_SIZE= 2;
39 43

  
40 44
  static final FloatBuffer mQuadPositions, mQuadTexture, mQuadTextureInv;
41 45

  
......
82 86
    }
83 87

  
84 88
///////////////////////////////////////////////////////////////////////////////////////////////////
85

  
89
/**
90
 * Only for use by the library itself.
91
 *
92
 * @y.exclude
93
 */
86 94
  public static void createPrograms()
87 95
    {
88 96
    Source source;
......
92 100
      {
93 101
      source = mSources.remove(0);
94 102

  
95
      //android.util.Log.d("postprocess", "compilaing: "+source.mName);
103
      //android.util.Log.d("postprocess", "compiling: "+source.mName);
96 104

  
97 105
      try
98 106
        {
......
107 115
    }
108 116

  
109 117
///////////////////////////////////////////////////////////////////////////////////////////////////
110

  
118
/**
119
 * Only for use by the library itself.
120
 *
121
 * @y.exclude
122
 */
111 123
  public abstract int apply(float[] uniforms, int index, float qualityScale, DistortedFramebuffer buffer);
112 124

  
113 125
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
26 26
import org.distorted.library.type.Data1D;
27 27

  
28 28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

  
29
/**
30
 * Blur the Framebuffer.
31
 */
30 32
public class PostprocessEffectBlur extends PostprocessEffect
31 33
  {
32 34
  private static final int MAX_HALO = 50;
......
62 64
  private static int mIndex1, mIndex2;
63 65

  
64 66
///////////////////////////////////////////////////////////////////////////////////////////////////
65
/**
66
 * Blur the object.
67
 *
68
 * @param blurRadius The 'strength' if the effect, in pixels. 0 = no blur, 10 = when blurring a given pixel,
69
 *                   take into account 10 pixels in each direction.
70
 */
71
  public PostprocessEffectBlur(Data1D blurRadius)
67
// This implements the 'Better separable implementation using GPU fixed function sampling' from
68
// https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
69

  
70
  private void computeGaussianKernel(int radius)
72 71
    {
73
    super(EffectName.BLUR);
74
    mBlurRadius = blurRadius;
72
    int offset = radius + radius*radius/4;
73

  
74
    if( weightsCache[offset]==0.0f )
75
      {
76
      float z, x= 0.0f, P= (float)NUM_GAUSSIAN / (radius>3 ? radius:3);
77
      mWeights[0] = GAUSSIAN[0];
78
      float sum   = GAUSSIAN[0];
79
      int j;
80

  
81
      for(int i=1; i<=radius; i++)
82
        {
83
        x += P;
84
        j = (int)x;
85
        z = x-j;
86

  
87
        mWeights[i] = (1-z)*GAUSSIAN[j] + z*GAUSSIAN[j+1];
88
        sum += 2*mWeights[i];
89
        }
90

  
91
      for(int i=0; i<=radius; i++) mWeights[i] /= sum;
92

  
93
      int numloops = radius/2;
94
      weightsCache[offset] = mWeights[0];
95
      offsetsCache[offset] = 0.0f;
96

  
97
      for(int i=0; i<numloops; i++)
98
        {
99
        offsetsCache[offset+i+1] = mWeights[2*i+1]*(2*i+1) + mWeights[2*i+2]*(2*i+2);
100
        weightsCache[offset+i+1] = mWeights[2*i+1] + mWeights[2*i+2];
101
        offsetsCache[offset+i+1]/= weightsCache[offset+i+1];
102
        }
103

  
104
      if( radius%2 == 1 )
105
        {
106
        int index = offset + radius/2 +1;
107
        offsetsCache[index]=radius;
108
        weightsCache[index]=mWeights[radius];
109
        }
110
      }
75 111
    }
76 112

  
77 113
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
114
/**
115
 * Only for use by the library itself.
116
 *
117
 * @y.exclude
118
 */
79 119
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
80 120
    {
81 121
    return mBlurRadius.get(uniforms,index,currentDuration,step);
82 122
    }
83 123

  
84 124
///////////////////////////////////////////////////////////////////////////////////////////////////
85

  
125
/**
126
 * Only for use by the library itself.
127
 *
128
 * @y.exclude
129
 */
86 130
  public int apply(float[] uniforms, int index, float qualityScale, DistortedFramebuffer buffer)
87 131
    {
88 132
    if( mProgram1 ==null)
......
145 189
    }
146 190

  
147 191
///////////////////////////////////////////////////////////////////////////////////////////////////
148

  
192
// PUBLIC API
193
///////////////////////////////////////////////////////////////////////////////////////////////////
194
/**
195
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
196
 */
149 197
  public static void enable()
150 198
    {
151 199
    final String blurVertex =
......
214 262
    }
215 263

  
216 264
///////////////////////////////////////////////////////////////////////////////////////////////////
217
// This implements the 'Better separable implementation using GPU fixed function sampling' from
218
// https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
219

  
220
  private void computeGaussianKernel(int radius)
265
/**
266
 * Blur the Framebuffer.
267
 *
268
 * @param blurRadius The 'strength' if the effect, in pixels. 0 = no blur, 10 = when blurring a given pixel,
269
 *                   take into account 10 pixels in each direction.
270
 */
271
  public PostprocessEffectBlur(Data1D blurRadius)
221 272
    {
222
    int offset = radius + radius*radius/4;
223

  
224
    if( weightsCache[offset]==0.0f )
225
      {
226
      float z, x= 0.0f, P= (float)NUM_GAUSSIAN / (radius>3 ? radius:3);
227
      mWeights[0] = GAUSSIAN[0];
228
      float sum   = GAUSSIAN[0];
229
      int j;
230

  
231
      for(int i=1; i<=radius; i++)
232
        {
233
        x += P;
234
        j = (int)x;
235
        z = x-j;
236

  
237
        mWeights[i] = (1-z)*GAUSSIAN[j] + z*GAUSSIAN[j+1];
238
        sum += 2*mWeights[i];
239
        }
240

  
241
      for(int i=0; i<=radius; i++) mWeights[i] /= sum;
242

  
243
      int numloops = radius/2;
244
      weightsCache[offset] = mWeights[0];
245
      offsetsCache[offset] = 0.0f;
246

  
247
      for(int i=0; i<numloops; i++)
248
        {
249
        offsetsCache[offset+i+1] = mWeights[2*i+1]*(2*i+1) + mWeights[2*i+2]*(2*i+2);
250
        weightsCache[offset+i+1] = mWeights[2*i+1] + mWeights[2*i+2];
251
        offsetsCache[offset+i+1]/= weightsCache[offset+i+1];
252
        }
253

  
254
      if( radius%2 == 1 )
255
        {
256
        int index = offset + radius/2 +1;
257
        offsetsCache[index]=radius;
258
        weightsCache[index]=mWeights[radius];
259
        }
260
      }
273
    super(EffectName.BLUR);
274
    mBlurRadius = blurRadius;
261 275
    }
262 276
  }
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
64 64
  private static int mIndex1, mIndex2;
65 65

  
66 66
///////////////////////////////////////////////////////////////////////////////////////////////////
67
// This implements the 'Better separable implementation using GPU fixed function sampling' from
68
// https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
67 69

  
68
/**
69
 * Make the object glow with a specific color and a halo of specific radius.
70
 *
71
 * @param glowRadius The 'strength' if the effect, in pixels. 0 = no halo, 10 = halo of roughly 10 pixels
72
 *                   around the whole object.
73
 * @param color      RGBA of the color with which to draw the glow.
74
 */
75
  public PostprocessEffectGlow(Data1D glowRadius, Data4D color)
70
  private void computeGaussianKernel(int radius)
76 71
    {
77
    super(EffectName.GLOW);
78
    mGlowRadius = glowRadius;
79
    mColor      = color;
72
    int offset = radius + radius*radius/4;
73

  
74
    if( weightsCache[offset]==0.0f )
75
      {
76
      float z, x= 0.0f, P= (float)NUM_GAUSSIAN / (radius>3 ? radius:3);
77
      mWeights[0] = GAUSSIAN[0];
78
      float sum   = GAUSSIAN[0];
79
      int j;
80

  
81
      for(int i=1; i<=radius; i++)
82
        {
83
        x += P;
84
        j = (int)x;
85
        z = x-j;
86

  
87
        mWeights[i] = (1-z)*GAUSSIAN[j] + z*GAUSSIAN[j+1];
88
        sum += 2*mWeights[i];
89
        }
90

  
91
      for(int i=0; i<=radius; i++) mWeights[i] /= sum;
92

  
93
      int numloops = radius/2;
94
      weightsCache[offset] = mWeights[0];
95
      offsetsCache[offset] = 0.0f;
96

  
97
      for(int i=0; i<numloops; i++)
98
        {
99
        offsetsCache[offset+i+1] = mWeights[2*i+1]*(2*i+1) + mWeights[2*i+2]*(2*i+2);
100
        weightsCache[offset+i+1] = mWeights[2*i+1] + mWeights[2*i+2];
101
        offsetsCache[offset+i+1]/= weightsCache[offset+i+1];
102
        }
103

  
104
      if( radius%2 == 1 )
105
        {
106
        int index = offset + radius/2 +1;
107
        offsetsCache[index]=radius;
108
        weightsCache[index]=mWeights[radius];
109
        }
110
      }
80 111
    }
81 112

  
82 113
///////////////////////////////////////////////////////////////////////////////////////////////////
83

  
114
/**
115
 * Only for use by the library itself.
116
 *
117
 * @y.exclude
118
 */
84 119
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
85 120
    {
86 121
    mColor.get(uniforms,index+1,currentDuration,step);
......
88 123
    }
89 124

  
90 125
///////////////////////////////////////////////////////////////////////////////////////////////////
91

  
126
/**
127
 * Only for use by the library itself.
128
 *
129
 * @y.exclude
130
 */
92 131
  public int apply(float[] uniforms, int index, float qualityScale, DistortedFramebuffer buffer)
93 132
    {
94 133
    if( mProgram1 ==null)
......
151 190
    }
152 191

  
153 192
///////////////////////////////////////////////////////////////////////////////////////////////////
154

  
193
// PUBLIC API
194
///////////////////////////////////////////////////////////////////////////////////////////////////
195
/**
196
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
197
 */
155 198
  public static void enable()
156 199
    {
157 200
    final String glowVertex =
......
220 263
    }
221 264

  
222 265
///////////////////////////////////////////////////////////////////////////////////////////////////
223
// This implements the 'Better separable implementation using GPU fixed function sampling' from
224
// https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
225 266

  
226
  private void computeGaussianKernel(int radius)
267
/**
268
 * Make the object glow with a specific color and a halo of specific radius.
269
 *
270
 * @param glowRadius The 'strength' if the effect, in pixels. 0 = no halo, 10 = halo of roughly 10 pixels
271
 *                   around the whole object.
272
 * @param color      RGBA of the color with which to draw the glow.
273
 */
274
  public PostprocessEffectGlow(Data1D glowRadius, Data4D color)
227 275
    {
228
    int offset = radius + radius*radius/4;
229

  
230
    if( weightsCache[offset]==0.0f )
231
      {
232
      float z, x= 0.0f, P= (float)NUM_GAUSSIAN / (radius>3 ? radius:3);
233
      mWeights[0] = GAUSSIAN[0];
234
      float sum   = GAUSSIAN[0];
235
      int j;
236

  
237
      for(int i=1; i<=radius; i++)
238
        {
239
        x += P;
240
        j = (int)x;
241
        z = x-j;
242

  
243
        mWeights[i] = (1-z)*GAUSSIAN[j] + z*GAUSSIAN[j+1];
244
        sum += 2*mWeights[i];
245
        }
246

  
247
      for(int i=0; i<=radius; i++) mWeights[i] /= sum;
248

  
249
      int numloops = radius/2;
250
      weightsCache[offset] = mWeights[0];
251
      offsetsCache[offset] = 0.0f;
252

  
253
      for(int i=0; i<numloops; i++)
254
        {
255
        offsetsCache[offset+i+1] = mWeights[2*i+1]*(2*i+1) + mWeights[2*i+2]*(2*i+2);
256
        weightsCache[offset+i+1] = mWeights[2*i+1] + mWeights[2*i+2];
257
        offsetsCache[offset+i+1]/= weightsCache[offset+i+1];
258
        }
259

  
260
      if( radius%2 == 1 )
261
        {
262
        int index = offset + radius/2 +1;
263
        offsetsCache[index]=radius;
264
        weightsCache[index]=mWeights[radius];
265
        }
266
      }
276
    super(EffectName.GLOW);
277
    mGlowRadius = glowRadius;
278
    mColor      = color;
267 279
    }
268 280
  }
src/main/java/org/distorted/library/effect/VertexEffect.java
20 20
package org.distorted.library.effect;
21 21

  
22 22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
// VERTEX EFFECTS
24

  
23
/**
24
 * Vertex Effect - an Effect that works by injecting certain code into the main Vertex shader.
25
 */
25 26
public abstract class VertexEffect extends Effect
26 27
  {
27
  public static final int NUM_UNIFORMS = 12; // 5 per-effect interpolated values, 3-dimensional center, 4-dimensional Region
28
/**
29
 * 12: 5 per-effect interpolated values, 3-dimensional center, 4-dimensional Region
30
 */
31
  public static final int NUM_UNIFORMS = 12;
28 32
  private static String mGLSL = "";
29 33
  private static int mNumEnabled = 0;
30 34

  
......
36 40
    }
37 41

  
38 42
///////////////////////////////////////////////////////////////////////////////////////////////////
43
// prepare code to be injected into the 'main_vertex_shader' main() function.
39 44

  
40 45
  static void addEffect(EffectName name, String code)
41 46
    {
......
56 61
    }
57 62

  
58 63
///////////////////////////////////////////////////////////////////////////////////////////////////
59

  
64
/**
65
 * Only for use by the library itself.
66
 *
67
 * @y.exclude
68
 */
60 69
  public static String getGLSL()
61 70
    {
62 71
    return mGLSL + "{}";
63 72
    }
64 73

  
65 74
///////////////////////////////////////////////////////////////////////////////////////////////////
66

  
67
  public static int getNumEnabled()
75
/**
76
 * Only for use by the library itself.
77
 *
78
 * @y.exclude
79
 */
80
  public static void onDestroy()
68 81
    {
69
    return mNumEnabled;
82
    mNumEnabled = 0;
83
    mGLSL = "";
70 84
    }
71 85

  
72 86
///////////////////////////////////////////////////////////////////////////////////////////////////
73

  
74
  public static void onDestroy()
87
// PUBLIC API
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89
/**
90
 * Return the number of Fragment effects enabled.
91
 */
92
  public static int getNumEnabled()
75 93
    {
76
    mNumEnabled = 0;
77
    mGLSL = "";
94
    return mNumEnabled;
78 95
    }
79 96
  }
src/main/java/org/distorted/library/effect/VertexEffectDeform.java
24 24
import org.distorted.library.type.Static4D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Deform the Mesh by applying a 3D vector of force.
29
 */
28 30
public class VertexEffectDeform extends VertexEffect
29 31
  {
30 32
  private Data3D mVector, mCenter;
......
32 34

  
33 35
///////////////////////////////////////////////////////////////////////////////////////////////////
34 36
/**
35
 * Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
36
 * a (possibly changing in time) point on the Object.
37
 *
38
 * @param vector Vector of force that deforms the shape of the whole Object.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff