Revision f1b8b412
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/examples/triblur/TriblurRenderer.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
class TriblurRenderer implements GLSurfaceView.Renderer |
52 | 52 |
{ |
53 |
private static final int NUM = 6; // 6 ints (x,y,z,R,G,B) each describe 1 object below |
|
54 |
|
|
53 | 55 |
private static final int[] OBJECTS = |
54 | 56 |
{ |
55 | 57 |
-1, 0, 0, 255, 0, 0, // x,y,z, R,G,B |
... | ... | |
57 | 59 |
+1, 0, 0, 0, 255, 0, // |
58 | 60 |
}; |
59 | 61 |
|
60 |
private static final int NUM_OBJECTS = OBJECTS.length/6;
|
|
62 |
private static final int NUM_OBJECTS = OBJECTS.length/NUM;
|
|
61 | 63 |
private static final int OBJ_SIZE = 100; |
62 | 64 |
|
63 | 65 |
private GLSurfaceView mView; |
... | ... | |
115 | 117 |
for(int i=0; i<NUM_OBJECTS; i++) |
116 | 118 |
{ |
117 | 119 |
mMoveVector[i] = new Static3D(0,0,0); |
118 |
mChromaVector[i] = new Static3D(OBJECTS[6*i+3],OBJECTS[6*i+4],OBJECTS[6*i+5]);
|
|
120 |
mChromaVector[i] = new Static3D(OBJECTS[NUM*i+3],OBJECTS[NUM*i+4],OBJECTS[NUM*i+5]);
|
|
119 | 121 |
mBlurVector[i] = new Static1D(10); |
120 | 122 |
mBlur[i] = new PostprocessEffectBlur(mBlurVector[i]); |
121 | 123 |
mChroma[i] = new FragmentEffectChroma( new Static1D(0.3f), mChromaVector[i]); |
... | ... | |
147 | 149 |
} |
148 | 150 |
} |
149 | 151 |
|
152 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
153 |
|
|
154 |
void setBackground(float r, float g, float b, float a) |
|
155 |
{ |
|
156 |
mScreen.glClearColor(r,g,b,a); |
|
157 |
} |
|
158 |
|
|
150 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
151 | 160 |
|
152 | 161 |
public void onDrawFrame(GL10 glUnused) |
... | ... | |
211 | 220 |
|
212 | 221 |
for(int i=0; i<NUM_OBJECTS; i++) |
213 | 222 |
{ |
214 |
mMoveVector[i].set(size*OBJECTS[6*i], size*OBJECTS[6*i+1], size*OBJECTS[6*i+2]);
|
|
223 |
mMoveVector[i].set(size*OBJECTS[NUM*i], size*OBJECTS[NUM*i+1], size*OBJECTS[NUM*i+2]);
|
|
215 | 224 |
} |
216 | 225 |
} |
217 | 226 |
|
Also available in: Unified diff
Improve the Triblur app.