Revision 7589635e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/listener/ListenerRenderer.java | ||
---|---|---|
31 | 31 |
import org.distorted.library.Distorted; |
32 | 32 |
import org.distorted.library.DistortedBitmap; |
33 | 33 |
import org.distorted.library.EffectTypes; |
34 |
import org.distorted.library.type.Float2D;
|
|
35 |
import org.distorted.library.type.Float3D;
|
|
36 |
import org.distorted.library.type.Float4D;
|
|
34 |
import org.distorted.library.type.Static2D;
|
|
35 |
import org.distorted.library.type.Static3D;
|
|
36 |
import org.distorted.library.type.Static4D;
|
|
37 | 37 |
import org.distorted.library.message.EffectListener; |
38 | 38 |
import org.distorted.library.message.EffectMessage; |
39 | 39 |
|
... | ... | |
71 | 71 |
int pointy = mRnd.nextInt( (int)(0.8f*bmpHeight))+ (int)(0.1f*bmpHeight); // |
72 | 72 |
int duration = 1000 + mRnd.nextInt(3000); // for anytime from 3 to 4 seconds |
73 | 73 |
|
74 |
Float3D dp3d = new Float3D(0,0,height);
|
|
75 |
Float2D dp2d = new Float2D(pointx,pointy);
|
|
76 |
Float4D dr = new Float4D(0,0,radius,radius);
|
|
74 |
Static3D dp3d = new Static3D(0,0,height);
|
|
75 |
Static2D dp2d = new Static2D(pointx,pointy);
|
|
76 |
Static4D dr = new Static4D(0,0,radius,radius);
|
|
77 | 77 |
|
78 | 78 |
return water.distort(dp3d, dr, dp2d, duration, 1.0f); |
79 | 79 |
} |
... | ... | |
109 | 109 |
if( bmpHeight/bmpWidth > height/width ) |
110 | 110 |
{ |
111 | 111 |
int w = (height*bmpWidth)/bmpHeight; |
112 |
water.move((width-w)/2 ,0, 0); |
|
113 |
water.scale((float)height/bmpHeight); |
|
112 |
float factor = (float)height/bmpHeight; |
|
113 |
|
|
114 |
water.move( new Static3D((width-w)/2,0,0) ); |
|
115 |
water.scale( new Static3D(factor,factor,factor) ); |
|
114 | 116 |
} |
115 | 117 |
else |
116 | 118 |
{ |
117 | 119 |
int h = (width*bmpHeight)/bmpWidth; |
118 |
water.move(0 ,(height-h)/2, 0); |
|
119 |
water.scale((float)width/bmpWidth); |
|
120 |
float factor = (float)width/bmpWidth; |
|
121 |
|
|
122 |
water.move( new Static3D(0,(height-h)/2,0) ); |
|
123 |
water.scale( new Static3D(factor,factor,factor) ); |
|
120 | 124 |
} |
121 | 125 |
|
122 | 126 |
Distorted.onSurfaceChanged(width, height); |
Also available in: Unified diff
Major push towards simplifying DistortedObject's public API.
All MATRIX effects are using the new API - the 'DataND' marker interfaces.