Project

General

Profile

« Previous | Next » 

Revision dd89c7f4

Added by Leszek Koltunski over 5 years ago

Bugfix: default, MAX region cannot be of Float.MAX_VALUE radius - then in the shader we can have an overflow. Make it 1000000 in radius.

View differences:

src/main/java/org/distorted/library/effect/FragmentEffect.java
19 19

  
20 20
package org.distorted.library.effect;
21 21

  
22
import org.distorted.library.type.Static3D;
23

  
22 24
///////////////////////////////////////////////////////////////////////////////////////////////////
23 25
/**
24 26
 * Abstract class that represents an Effect that works by injecting certain code into the main Fragment shader.
......
35 37
  private static String mGLSL = "";
36 38
  private static int mNumEnabled = 0;
37 39

  
40
  final static Static3D MAX_REGION = new Static3D(1000000,1000000,1000000);
41

  
38 42
///////////////////////////////////////////////////////////////////////////////////////////////////
39 43

  
40 44
  FragmentEffect(EffectName name)
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java
63 63
    super(smooth? EffectName.SMOOTH_ALPHA:EffectName.ALPHA);
64 64
    mAlpha  = alpha;
65 65
    mCenter = center;
66
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
66
    mRegion = (region==null ? MAX_REGION : region);
67 67
    }
68 68

  
69 69
///////////////////////////////////////////////////////////////////////////////////////////////////
......
78 78
    super(EffectName.ALPHA);
79 79
    mAlpha  = alpha;
80 80
    mCenter = new Static3D(0,0,0);
81
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
81
    mRegion = MAX_REGION;
82 82
    }
83 83

  
84 84
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.java
62 62
    super(smooth?EffectName.SMOOTH_BRIGHTNESS:EffectName.BRIGHTNESS);
63 63
    mBrightness = brightness;
64 64
    mCenter = center;
65
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
65
    mRegion = (region==null ? MAX_REGION : region);
66 66
    }
67 67

  
68 68
///////////////////////////////////////////////////////////////////////////////////////////////////
......
76 76
    super(EffectName.BRIGHTNESS);
77 77
    mBrightness = brightness;
78 78
    mCenter = new Static3D(0,0,0);
79
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
79
    mRegion = MAX_REGION;
80 80
    }
81 81

  
82 82
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java
68 68
    mBlend  = blend;
69 69
    mColor  = color;
70 70
    mCenter = center;
71
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
71
    mRegion = (region==null ? MAX_REGION : region);
72 72
    }
73 73

  
74 74
///////////////////////////////////////////////////////////////////////////////////////////////////
......
86 86
    mBlend = blend;
87 87
    mColor = color;
88 88
    mCenter = new Static3D(0,0,0);
89
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
89
    mRegion = MAX_REGION;
90 90
    }
91 91

  
92 92
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java
62 62
    super(smooth?EffectName.SMOOTH_CONTRAST:EffectName.CONTRAST);
63 63
    mContrast = contrast;
64 64
    mCenter = center;
65
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
65
    mRegion = (region==null ? MAX_REGION : region);
66 66
    }
67 67

  
68 68
///////////////////////////////////////////////////////////////////////////////////////////////////
......
76 76
    super(EffectName.CONTRAST);
77 77
    mContrast = contrast;
78 78
    mCenter = new Static3D(0,0,0);
79
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
79
    mRegion = MAX_REGION;
80 80
    }
81 81

  
82 82
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.java
63 63

  
64 64
    mSaturation = saturation;
65 65
    mCenter = center;
66
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
66
    mRegion = (region==null ? MAX_REGION : region);
67 67
    }
68 68

  
69 69
///////////////////////////////////////////////////////////////////////////////////////////////////
......
78 78

  
79 79
    mSaturation = saturation;
80 80
    mCenter = new Static3D(0,0,0);
81
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
81
    mRegion = MAX_REGION;
82 82
    }
83 83

  
84 84
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/VertexEffect.java
19 19

  
20 20
package org.distorted.library.effect;
21 21

  
22
import org.distorted.library.type.Static4D;
23

  
22 24
///////////////////////////////////////////////////////////////////////////////////////////////////
23 25
/**
24 26
 * Abstract class that represents an Effect that works by injecting certain code into the main Vertex shader.
......
35 37
  private static String mGLSL = "";
36 38
  private static int mNumEnabled = 0;
37 39

  
40
  final static Static4D MAX_REGION = new Static4D(0,0,0,1000000);
41

  
38 42
///////////////////////////////////////////////////////////////////////////////////////////////////
39 43

  
40 44
  VertexEffect(EffectName name)
src/main/java/org/distorted/library/effect/VertexEffectDeform.java
158 158
    super(EffectName.DEFORM);
159 159
    mVector = vector;
160 160
    mCenter = center;
161
    mRegion = (region==null ? new Static4D(0,0,0, Float.MAX_VALUE) : region);
161
    mRegion = (region==null ? MAX_REGION : region);
162 162
    }
163 163

  
164 164
///////////////////////////////////////////////////////////////////////////////////////////////////
......
174 174
    super(EffectName.DEFORM);
175 175
    mVector = vector;
176 176
    mCenter = center;
177
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
177
    mRegion = MAX_REGION;
178 178
    }
179 179
  }
src/main/java/org/distorted/library/effect/VertexEffectDistort.java
171 171
    super(EffectName.DISTORT);
172 172
    mVector = vector;
173 173
    mCenter = center;
174
    mRegion = (region==null ? new Static4D(0,0,0, Float.MAX_VALUE) : region);
174
    mRegion = (region==null ? MAX_REGION : region);
175 175
    }
176 176

  
177 177
///////////////////////////////////////////////////////////////////////////////////////////////////
......
186 186
    super(EffectName.DISTORT);
187 187
    mVector = vector;
188 188
    mCenter = center;
189
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
189
    mRegion = MAX_REGION;
190 190
    }
191 191
  }
192 192

  
src/main/java/org/distorted/library/effect/VertexEffectPinch.java
97 97
    super(EffectName.PINCH);
98 98
    mPinch  = pinch;
99 99
    mCenter = center;
100
    mRegion = (region==null ? new Static4D(0,0,0, Float.MAX_VALUE) : region);
100
    mRegion = (region==null ? MAX_REGION : region);
101 101
    }
102 102

  
103 103
///////////////////////////////////////////////////////////////////////////////////////////////////
......
113 113
    super(EffectName.PINCH);
114 114
    mPinch  = pinch;
115 115
    mCenter = center;
116
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
116
    mRegion = MAX_REGION;
117 117
    }
118 118
  }
src/main/java/org/distorted/library/effect/VertexEffectSink.java
84 84
    super(EffectName.SINK);
85 85
    mSink   = sink;
86 86
    mCenter = center;
87
    mRegion = (region==null ? new Static4D(0,0,0, Float.MAX_VALUE) : region);
87
    mRegion = (region==null ? MAX_REGION : region);
88 88
    }
89 89

  
90 90
///////////////////////////////////////////////////////////////////////////////////////////////////
......
100 100
    super(EffectName.SINK);
101 101
    mSink   = sink;
102 102
    mCenter = center;
103
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
103
    mRegion = MAX_REGION;
104 104
    }
105 105
  }
src/main/java/org/distorted/library/effect/VertexEffectSwirl.java
100 100
    super(EffectName.SWIRL);
101 101
    mSwirl  = swirl;
102 102
    mCenter = center;
103
    mRegion = (region==null ? new Static4D(0,0,0, Float.MAX_VALUE) : region);
103
    mRegion = (region==null ? MAX_REGION : region);
104 104
    }
105 105

  
106 106
///////////////////////////////////////////////////////////////////////////////////////////////////
......
115 115
    super(EffectName.SWIRL);
116 116
    mSwirl  = swirl;
117 117
    mCenter = center;
118
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
118
    mRegion = MAX_REGION;
119 119
    }
120 120
  }
121 121

  
src/main/java/org/distorted/library/effect/VertexEffectWave.java
223 223
    super(EffectName.WAVE);
224 224
    mWave   = wave;
225 225
    mCenter = center;
226
    mRegion = (region==null ? new Static4D(0,0,0, Float.MAX_VALUE) : region);
226
    mRegion = (region==null ? MAX_REGION : region);
227 227
    }
228 228

  
229 229
///////////////////////////////////////////////////////////////////////////////////////////////////
......
238 238
    super(EffectName.WAVE);
239 239
    mWave   = wave;
240 240
    mCenter = center;
241
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
241
    mRegion = MAX_REGION;
242 242
    }
243 243
  }

Also available in: Unified diff