Revision 752c6b57
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/wind/WindRenderer.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.graphics.Bitmap; |
23 | 23 |
import android.graphics.BitmapFactory; |
24 |
import android.opengl.GLES30; |
|
25 | 24 |
import android.opengl.GLSurfaceView; |
26 | 25 |
|
27 | 26 |
import org.distorted.examples.R; |
... | ... | |
85 | 84 |
} |
86 | 85 |
|
87 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
88 |
|
|
87 |
|
|
89 | 88 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
90 | 89 |
{ |
91 |
mEffects.abortAllEffects(); |
|
92 |
|
|
93 |
float factor = ( (float)(width<height? width:height) )/(mObjHeight + 1.4f*mObjWidth); |
|
94 |
|
|
95 |
mEffects.move( new Static3D( factor*mObjHeight*0.58f , factor*mObjHeight*0.08f , 0) ); |
|
96 |
mEffects.scale(factor); |
|
97 |
|
|
90 |
float q= ((float)width/height)*((float)mObjHeight/mObjWidth); |
|
91 |
float scale = 0.5f; |
|
98 | 92 |
Static1D angle = new Static1D(-45); |
99 | 93 |
Static3D axis = new Static3D(0,0,1); |
100 |
Static3D center= new Static3D(0,mObjHeight/2,0); |
|
94 |
Static3D center= new Static3D( -scale/2,0,0 ); |
|
95 |
Static3D move = new Static3D( 0,((float)width/height)*(1-scale/2)-0.5f,0 ); |
|
96 |
|
|
97 |
mEffects.abortAllEffects(); |
|
98 |
//mEffects.move( move ); |
|
99 |
//mEffects.rotate(angle, axis, center); |
|
100 |
//mManager.apply(mEffects,mWind); |
|
101 |
mEffects.scale(q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q))); |
|
101 | 102 |
|
102 |
mEffects.rotate(angle, axis, center); |
|
103 |
mManager.apply(mEffects,mWind); |
|
104 | 103 |
mScreen.resize(width, height); |
105 | 104 |
} |
106 | 105 |
|
Also available in: Unified diff
Progress with the last 2 Apps: Effects3D and Wind (not done yet)