Revision 7589635e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/cubes/CubesRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 | 30 |
import org.distorted.library.EffectTypes; |
31 |
import org.distorted.library.type.InterpolatorQuat;
|
|
31 |
import org.distorted.library.type.DynamicQuat;
|
|
32 | 32 |
import org.distorted.library.DistortedCubes; |
33 |
import org.distorted.library.type.Float4D;
|
|
34 |
import org.distorted.library.type.Float3D;
|
|
33 |
import org.distorted.library.type.Static4D;
|
|
34 |
import org.distorted.library.type.Static3D;
|
|
35 | 35 |
import org.distorted.library.Distorted; |
36 | 36 |
|
37 | 37 |
import android.graphics.Bitmap; |
... | ... | |
49 | 49 |
|
50 | 50 |
private GLSurfaceView mView; |
51 | 51 |
private DistortedCubes mCubes; |
52 |
private InterpolatorQuat mQuatInt1, mQuatInt2;
|
|
52 |
private DynamicQuat mQuatInt1, mQuatInt2;
|
|
53 | 53 |
|
54 |
Float4D mQuat1, mQuat2;
|
|
54 |
Static4D mQuat1, mQuat2;
|
|
55 | 55 |
int mScreenMin; |
56 | 56 |
|
57 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
67 | 67 |
|
68 | 68 |
mCubes = new DistortedCubes( mCols, shape, SIZE); |
69 | 69 |
|
70 |
mQuat1 = new Float4D(0,0,0,1); // unity
|
|
71 |
mQuat2 = new Float4D(0,0,0,1); // quaternions
|
|
70 |
mQuat1 = new Static4D(0,0,0,1); // unity
|
|
71 |
mQuat2 = new Static4D(0,0,0,1); // quaternions
|
|
72 | 72 |
|
73 |
mQuatInt1 = new InterpolatorQuat();
|
|
74 |
mQuatInt2 = new InterpolatorQuat();
|
|
73 |
mQuatInt1 = new DynamicQuat();
|
|
74 |
mQuatInt2 = new DynamicQuat();
|
|
75 | 75 |
mQuatInt1.setDuration(0); |
76 | 76 |
mQuatInt2.setDuration(0); |
77 | 77 |
mQuatInt1.setCount(0.5f); |
... | ... | |
102 | 102 |
if( mRows/mCols > height/width ) |
103 | 103 |
{ |
104 | 104 |
int w = (height*mRows)/mCols; |
105 |
mCubes.move((width-w)/2 ,0, 0); |
|
106 |
mCubes.scale((float)height/(mRows*SIZE)); |
|
105 |
float factor = (float)height/(mRows*SIZE); |
|
106 |
|
|
107 |
mCubes.move( new Static3D((width-w)/2,0,0) ); |
|
108 |
mCubes.scale( new Static3D(factor,factor,factor) ); |
|
107 | 109 |
} |
108 | 110 |
else |
109 | 111 |
{ |
110 | 112 |
int h = (width*mRows)/mCols; |
111 |
mCubes.move(0 ,(height-h)/2, 0); |
|
112 |
mCubes.scale((float)width/(mCols*SIZE)); |
|
113 |
float factor = (float)width/(mCols*SIZE); |
|
114 |
|
|
115 |
mCubes.move( new Static3D(0,(height-h)/2,0) ); |
|
116 |
mCubes.scale( new Static3D(factor,factor,factor) ); |
|
113 | 117 |
} |
114 | 118 |
|
115 |
Float3D center = new Float3D(mCols*SIZE/2,mRows*SIZE/2, 0);
|
|
119 |
Static3D center = new Static3D(mCols*SIZE/2,mRows*SIZE/2, 0);
|
|
116 | 120 |
|
117 | 121 |
mCubes.quaternion(center, mQuatInt1); |
118 | 122 |
mCubes.quaternion(center, mQuatInt2); |
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.