Revision 833685d0
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/vertex3d/Vertex3DRenderer.java | ||
---|---|---|
32 | 32 |
import org.distorted.library.type.Dynamic1D; |
33 | 33 |
import org.distorted.library.type.Dynamic3D; |
34 | 34 |
import org.distorted.library.type.Dynamic4D; |
35 |
import org.distorted.library.type.DynamicQuat; |
|
35 | 36 |
import org.distorted.library.type.Static1D; |
36 | 37 |
import org.distorted.library.type.Static2D; |
37 | 38 |
import org.distorted.library.type.Static3D; |
... | ... | |
52 | 53 |
private GLSurfaceView mView; |
53 | 54 |
private static DistortedCubes mCube; |
54 | 55 |
private int mCols, mRows; |
56 |
private DynamicQuat mQuatInt1, mQuatInt2; |
|
55 | 57 |
|
56 | 58 |
private static EffectNames[] order; |
57 | 59 |
|
... | ... | |
62 | 64 |
private static Static3D mDeformPoint, mDistortPoint; |
63 | 65 |
private static Static1D mSinkPoint, mSwirlPoint; |
64 | 66 |
|
67 |
Static4D mQuat1, mQuat2; |
|
68 |
int mScreenMin; |
|
69 |
|
|
65 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
66 | 71 |
|
67 | 72 |
public static void setDeform(float x, float y, float z) |
... | ... | |
144 | 149 |
mDistortInter.add(mDistortPoint); |
145 | 150 |
mSwirlInter.add(mSwirlPoint); |
146 | 151 |
mSinkInter.add(mSinkPoint); |
152 |
|
|
153 |
mQuat1 = new Static4D(0,0,0,1); // unity |
|
154 |
mQuat2 = new Static4D(0,0,0,1); // quaternions |
|
155 |
|
|
156 |
mQuatInt1 = new DynamicQuat(0,0.5f); |
|
157 |
mQuatInt2 = new DynamicQuat(0,0.5f); |
|
158 |
|
|
159 |
mQuatInt1.add(mQuat1); |
|
160 |
mQuatInt2.add(mQuat2); |
|
147 | 161 |
} |
148 | 162 |
|
149 | 163 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
160 | 174 |
|
161 | 175 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
162 | 176 |
{ |
177 |
mScreenMin = width<height ? width:height; |
|
178 |
|
|
163 | 179 |
mCube.abortEffects(EffectTypes.MATRIX); |
164 | 180 |
float factor; |
165 | 181 |
|
... | ... | |
175 | 191 |
mCube.scale(factor); |
176 | 192 |
mCube.move( new Static3D( (width-factor*mCols*SIZE)/2 , (height-factor*mRows*SIZE)/2 , 0) ); |
177 | 193 |
|
194 |
Static3D center = new Static3D(mCols*SIZE/2,mRows*SIZE/2, 0); |
|
195 |
|
|
196 |
mCube.quaternion(mQuatInt1, center); |
|
197 |
mCube.quaternion(mQuatInt2, center); |
|
198 |
|
|
178 | 199 |
setVertexEffects(); |
179 | 200 |
|
180 | 201 |
Distorted.onSurfaceChanged(width, height); |
Also available in: Unified diff
Progress with Vertex3D