Revision 2a8ee748
Added by Leszek Koltunski almost 6 years ago
src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
class MovingGlowRenderer implements GLSurfaceView.Renderer,EffectListener |
56 | 56 |
{ |
57 |
private static final int[] colors = new int[] {0,0,1, 0,0,0, 1,0,0, 1,1,0, 0,1,0, 1,1,1}; // blue, black, red, yellow, green, white |
|
57 |
private static final int[] colors = new int[] {0,0,1, 1,0,1, 1,0,0, 1,1,0, 0,1,0, 1,1,1}; // blue, pink, red, yellow, green, white |
|
58 |
private static final int FLASH_TIME = 2000; |
|
58 | 59 |
private static final int LEAF_SIZE = 100; |
59 | 60 |
private static final int NUM_LEAVES= colors.length/3; |
60 | 61 |
|
... | ... | |
73 | 74 |
{ |
74 | 75 |
mView = v; |
75 | 76 |
|
76 |
mRootW = 4*LEAF_SIZE;
|
|
77 |
mRootH = 4*LEAF_SIZE;
|
|
77 |
mRootW = 5*LEAF_SIZE;
|
|
78 |
mRootH = 5*LEAF_SIZE;
|
|
78 | 79 |
|
79 | 80 |
mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE); |
80 | 81 |
DistortedTexture surface = new DistortedTexture(mRootW,mRootH); |
... | ... | |
82 | 83 |
|
83 | 84 |
DistortedNode root = new DistortedNode(surface, new DistortedEffects(), mesh); |
84 | 85 |
|
85 |
Static3D moveVector = new Static3D(0.25f*LEAF_SIZE, (mRootH-LEAF_SIZE)/2, 0);
|
|
86 |
Static3D moveVector = new Static3D(0.55f*LEAF_SIZE, (mRootH-LEAF_SIZE)/2, 0);
|
|
86 | 87 |
Static1D chromaLevel= new Static1D(0.5f); |
87 | 88 |
Static3D center = new Static3D(mRootW/2, mRootH/2, 0); |
88 | 89 |
Static3D axis = new Static3D(0,0,1); |
... | ... | |
113 | 114 |
effects.apply(new MatrixEffectScale(mScale)); |
114 | 115 |
effects.apply( new MatrixEffectRotate(rot, axis, center) ); |
115 | 116 |
|
116 |
Dynamic1D radiusDyn = new Dynamic1D(3000,1.0f);
|
|
117 |
Dynamic1D radiusDyn = new Dynamic1D(FLASH_TIME,1.0f);
|
|
117 | 118 |
radiusDyn.add(new Static1D( 0)); |
118 | 119 |
radiusDyn.add(new Static1D(50)); |
119 | 120 |
|
120 | 121 |
for(int leaf=0; leaf<NUM_LEAVES; leaf++) |
121 | 122 |
{ |
122 |
Dynamic4D color= new Dynamic4D(3000,0.5f);
|
|
123 |
Static4D P1 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1);
|
|
124 |
Static4D P2 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1); |
|
123 |
Dynamic4D color= new Dynamic4D(FLASH_TIME,1.0f);
|
|
124 |
Static4D P1 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 0.0f);
|
|
125 |
Static4D P2 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1.0f);
|
|
125 | 126 |
color.add(P1); |
126 | 127 |
color.add(P2); |
127 | 128 |
|
Also available in: Unified diff
Progress with thr Glow effect - moving glow app looks ok now.