Revision 7589635e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.distorted.library.DistortedCubes; |
31 | 31 |
import org.distorted.library.EffectTypes; |
32 |
import org.distorted.library.type.Float3D; |
|
33 |
import org.distorted.library.type.Float4D; |
|
34 |
import org.distorted.library.type.Interpolator3D; |
|
35 |
import org.distorted.library.type.Interpolator4D; |
|
32 |
import org.distorted.library.type.Dynamic1D; |
|
33 |
import org.distorted.library.type.Dynamic3D; |
|
34 |
import org.distorted.library.type.Static1D; |
|
35 |
import org.distorted.library.type.Static3D; |
|
36 |
import org.distorted.library.type.Static4D; |
|
37 |
import org.distorted.library.type.Dynamic4D; |
|
36 | 38 |
import org.distorted.library.Distorted; |
37 | 39 |
|
38 | 40 |
import android.graphics.Bitmap; |
... | ... | |
51 | 53 |
|
52 | 54 |
private static int[] order; |
53 | 55 |
|
54 |
private static Interpolator3D mMoveInter, mScaleInter, mShearInter;
|
|
55 |
private static Interpolator4D mRotateInter;
|
|
56 |
|
|
57 |
private static Float3D mZeroPoint, mMovePoint, mScalePoint, mShearPoint;
|
|
58 |
private static Float4D mRotatePoint;
|
|
59 |
|
|
56 |
private static Dynamic3D mMoveInter, mScaleInter, mShearInter;
|
|
57 |
private static Dynamic4D mDynamicRotate;
|
|
58 |
|
|
59 |
private static Static3D mZeroPoint, mMovePoint, mScalePoint, mShearPoint;
|
|
60 |
private static Static4D mRotatePoint;
|
|
61 |
|
|
60 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 63 |
|
62 | 64 |
public static void setMove(float x, float y, float z) |
... | ... | |
75 | 77 |
|
76 | 78 |
public static void setRotate(float a, float x, float y, float z) |
77 | 79 |
{ |
78 |
mRotatePoint.set(a, x, y, z);
|
|
80 |
mRotatePoint.set(a,x,y,z);
|
|
79 | 81 |
} |
80 | 82 |
|
81 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
103 | 105 |
{ |
104 | 106 |
switch(order[i]) |
105 | 107 |
{ |
106 |
case Effects3DActivity.MOVE : mCube.move(mMoveInter) ; break;
|
|
107 |
case Effects3DActivity.SCALE : mCube.scale(mScaleInter) ; break; |
|
108 |
case Effects3DActivity.ROTATE: mCube.rotate(mZeroPoint,mRotateInter); break;
|
|
109 |
case Effects3DActivity.SHEAR : mCube.shear(mZeroPoint,mShearInter) ; break; |
|
108 |
case Effects3DActivity.MOVE : mCube.move(mMoveInter) ; break;
|
|
109 |
case Effects3DActivity.SCALE : mCube.scale(mScaleInter) ; break;
|
|
110 |
case Effects3DActivity.ROTATE: mCube.rotate(mZeroPoint,mDynamicRotate); break;
|
|
111 |
case Effects3DActivity.SHEAR : mCube.shear(mZeroPoint,mShearInter) ; break;
|
|
110 | 112 |
} |
111 | 113 |
} |
112 | 114 |
} |
... | ... | |
118 | 120 |
mView = v; |
119 | 121 |
mCube = new DistortedCubes( 1, "1", SIZE); |
120 | 122 |
|
121 |
mZeroPoint = new Float3D(0,0,0);
|
|
122 |
mMovePoint = new Float3D(0,0,0);
|
|
123 |
mScalePoint = new Float3D(1,1,1);
|
|
124 |
mShearPoint = new Float3D(0,0,0);
|
|
125 |
mRotatePoint= new Float4D(1,0,0,0);
|
|
126 |
|
|
127 |
mMoveInter = new Interpolator3D();
|
|
128 |
mScaleInter = new Interpolator3D();
|
|
129 |
mShearInter = new Interpolator3D();
|
|
130 |
mRotateInter= new Interpolator4D();
|
|
131 |
|
|
123 |
mZeroPoint = new Static3D(0,0,0);
|
|
124 |
mMovePoint = new Static3D(0,0,0);
|
|
125 |
mScalePoint = new Static3D(1,1,1);
|
|
126 |
mShearPoint = new Static3D(0,0,0);
|
|
127 |
mRotatePoint = new Static4D(0,1,0,0);
|
|
128 |
|
|
129 |
mMoveInter = new Dynamic3D();
|
|
130 |
mScaleInter = new Dynamic3D();
|
|
131 |
mShearInter = new Dynamic3D();
|
|
132 |
mDynamicRotate= new Dynamic4D();
|
|
133 |
|
|
132 | 134 |
mMoveInter.add(mMovePoint); |
133 | 135 |
mScaleInter.add(mScalePoint); |
134 | 136 |
mShearInter.add(mShearPoint); |
135 |
mRotateInter.add(mRotatePoint);
|
|
137 |
mDynamicRotate.add(mRotatePoint);
|
|
136 | 138 |
} |
137 | 139 |
|
138 | 140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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.