Revision e2d8ea1d
Added by Leszek Koltunski over 9 years ago
| src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java | ||
|---|---|---|
| 99 | 99 |
|
| 100 | 100 |
if( width > height ) |
| 101 | 101 |
{
|
| 102 |
float factor = height/(3.0f*SIZE); |
|
| 103 | 102 |
mCube.move( new Static3D((width-height)/2,0,0) ); |
| 104 |
mCube.scale(factor);
|
|
| 103 |
mCube.scale(height/(3.0f*SIZE));
|
|
| 105 | 104 |
} |
| 106 | 105 |
else |
| 107 | 106 |
{
|
| 108 |
float factor = width/(3.0f*SIZE); |
|
| 109 | 107 |
mCube.move( new Static3D(0,(height-width)/2,0) ); |
| 110 |
mCube.scale(factor);
|
|
| 108 |
mCube.scale(width/(3.0f*SIZE));
|
|
| 111 | 109 |
} |
| 112 | 110 |
|
| 113 | 111 |
mCube.quaternion( mRot, new Static3D(3*SIZE/2,3*SIZE/2,0) ); |
| src/main/java/org/distorted/examples/vertex3d/Vertex3DActivity.java | ||
|---|---|---|
| 38 | 38 |
{
|
| 39 | 39 |
private SeekBar bar; |
| 40 | 40 |
private TextView textDeform, textDistort, textSink, textSwirl; |
| 41 |
private int moveX, moveY, moveZ;
|
|
| 42 |
private int scaleX, scaleY, scaleZ;
|
|
| 43 |
private int rotateX, rotateY, rotateZ, rotateA;
|
|
| 44 |
private int shearX, shearY, shearZ;
|
|
| 41 |
private int deformX, deformY, deformZ;
|
|
| 42 |
private int distortX, distortY, distortZ;
|
|
| 43 |
private int sinkA;
|
|
| 44 |
private int swirlA;
|
|
| 45 | 45 |
|
| 46 | 46 |
private int maxX, maxY, maxZ; |
| 47 | 47 |
|
| 48 |
private float fmoveX, fmoveY, fmoveZ;
|
|
| 49 |
private float fscaleX, fscaleY, fscaleZ;
|
|
| 50 |
private float frotateX, frotateY, frotateZ, frotateA;
|
|
| 51 |
private float fshearX, fshearY, fshearZ;
|
|
| 48 |
private float fdeformX, fdeformY, fdeformZ;
|
|
| 49 |
private float fdistortX, fdistortY, fdistortZ;
|
|
| 50 |
private float fsinkA;
|
|
| 51 |
private float fswirlA;
|
|
| 52 | 52 |
|
| 53 | 53 |
private EffectNames[] effects = new EffectNames[4]; |
| 54 | 54 |
|
| ... | ... | |
| 71 | 71 |
effects[2] = EffectNames.SINK; |
| 72 | 72 |
effects[3] = EffectNames.SWIRL; |
| 73 | 73 |
|
| 74 |
moveX = 50; |
|
| 75 |
moveY = 50; |
|
| 76 |
moveZ = 50; |
|
| 77 |
|
|
| 78 |
scaleX = 50; |
|
| 79 |
scaleY = 50; |
|
| 80 |
scaleZ = 50; |
|
| 81 |
|
|
| 82 |
rotateX = 100; |
|
| 83 |
rotateY = 50; |
|
| 84 |
rotateZ = 50; |
|
| 85 |
rotateA = 50; |
|
| 86 |
|
|
| 87 |
shearX = 50; |
|
| 88 |
shearY = 50; |
|
| 89 |
shearZ = 50; |
|
| 90 |
|
|
| 74 |
deformX = 50; |
|
| 75 |
deformY = 50; |
|
| 76 |
deformZ = 50; |
|
| 77 |
|
|
| 78 |
distortX = 50; |
|
| 79 |
distortY = 50; |
|
| 80 |
distortZ = 50; |
|
| 81 |
|
|
| 82 |
sinkA = 50; |
|
| 83 |
swirlA = 50; |
|
| 84 |
|
|
| 91 | 85 |
addViews(); |
| 92 | 86 |
} |
| 93 | 87 |
|
| ... | ... | |
| 125 | 119 |
setSinkText(); |
| 126 | 120 |
setSwirlText(); |
| 127 | 121 |
|
| 128 |
setBar(R.id.vertex3ddeformBar1, moveX); |
|
| 129 |
setBar(R.id.vertex3ddeformBar2, moveY); |
|
| 130 |
setBar(R.id.vertex3ddeformBar3, moveZ); |
|
| 131 |
|
|
| 132 |
setBar(R.id.vertex3ddistortBar1, scaleX); |
|
| 133 |
setBar(R.id.vertex3ddistortBar2, scaleY); |
|
| 134 |
setBar(R.id.vertex3ddistortBar3, scaleZ); |
|
| 135 |
|
|
| 136 |
setBar(R.id.vertex3dsinkBar1, rotateX); |
|
| 137 |
setBar(R.id.vertex3dsinkBar2, rotateY); |
|
| 138 |
setBar(R.id.vertex3dsinkBar3, rotateZ); |
|
| 122 |
setBar(R.id.vertex3ddeformBar1, deformX); |
|
| 123 |
setBar(R.id.vertex3ddeformBar2, deformY); |
|
| 124 |
setBar(R.id.vertex3ddeformBar3, deformZ); |
|
| 139 | 125 |
|
| 140 |
setBar(R.id.vertex3dswirlBar1, shearX);
|
|
| 141 |
setBar(R.id.vertex3dswirlBar2, shearY);
|
|
| 142 |
setBar(R.id.vertex3dswirlBar3, shearZ);
|
|
| 126 |
setBar(R.id.vertex3ddistortBar1, distortX);
|
|
| 127 |
setBar(R.id.vertex3ddistortBar2, distortY);
|
|
| 128 |
setBar(R.id.vertex3ddistortBar3, distortZ);
|
|
| 143 | 129 |
|
| 130 |
setBar(R.id.vertex3dsinkBar1, sinkA); |
|
| 131 |
|
|
| 132 |
setBar(R.id.vertex3dswirlBar1, swirlA); |
|
| 133 |
|
|
| 144 | 134 |
Vertex3DRenderer.setOrder(effects); |
| 145 | 135 |
} |
| 146 | 136 |
|
| ... | ... | |
| 217 | 207 |
|
| 218 | 208 |
private void computeDeform() |
| 219 | 209 |
{
|
| 220 |
fmoveX = (moveX-50)*maxX/50.0f;
|
|
| 221 |
fmoveY = (moveY-50)*maxY/50.0f;
|
|
| 222 |
fmoveZ = (moveZ-50)*maxZ/50.0f;
|
|
| 210 |
fdeformX = (deformX-50)*maxX/50.0f;
|
|
| 211 |
fdeformY = (deformY-50)*maxY/50.0f;
|
|
| 212 |
fdeformZ = (deformZ-50)*maxZ/50.0f;
|
|
| 223 | 213 |
|
| 224 |
Vertex3DRenderer.setDeform( fmoveX, fmoveY, fmoveZ);
|
|
| 214 |
Vertex3DRenderer.setDeform( fdeformX, fdeformY, fdeformZ );
|
|
| 225 | 215 |
} |
| 226 | 216 |
|
| 227 | 217 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 228 | 218 |
|
| 229 | 219 |
private void setDeformText() |
| 230 | 220 |
{
|
| 231 |
fmoveX = ((int)(100*fmoveX))/100.0f;
|
|
| 232 |
fmoveY = ((int)(100*fmoveY))/100.0f;
|
|
| 233 |
fmoveZ = ((int)(100*fmoveZ))/100.0f;
|
|
| 221 |
fdeformX = ((int)(100*fdeformX))/100.0f;
|
|
| 222 |
fdeformY = ((int)(100*fdeformY))/100.0f;
|
|
| 223 |
fdeformZ = ((int)(100*fdeformZ))/100.0f;
|
|
| 234 | 224 |
|
| 235 |
textDeform.setText("deform("+fmoveX+" , "+fmoveY+" , "+fmoveZ+")");
|
|
| 225 |
textDeform.setText("deform("+fdeformX+" , "+fdeformY+" , "+fdeformZ+")");
|
|
| 236 | 226 |
} |
| 237 | 227 |
|
| 238 | 228 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 239 | 229 |
|
| 240 | 230 |
private void computeDistort() |
| 241 | 231 |
{
|
| 242 |
fscaleX = (scaleX>50 ? 0.18f : 0.018f)*(scaleX-50)+1;
|
|
| 243 |
fscaleY = (scaleY>50 ? 0.18f : 0.018f)*(scaleY-50)+1;
|
|
| 244 |
fscaleZ = (scaleZ>50 ? 0.18f : 0.018f)*(scaleZ-50)+1;
|
|
| 232 |
fdistortX = (distortX-50)*maxX/50.0f;
|
|
| 233 |
fdistortY = (distortY-50)*maxY/50.0f;
|
|
| 234 |
fdistortZ = (distortZ-50)*maxZ/50.0f;
|
|
| 245 | 235 |
|
| 246 |
Vertex3DRenderer.setDistort(fscaleX, fscaleY, fscaleZ);
|
|
| 236 |
Vertex3DRenderer.setDistort(fdistortX, fdistortY, fdistortZ);
|
|
| 247 | 237 |
} |
| 248 | 238 |
|
| 249 | 239 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 250 | 240 |
|
| 251 | 241 |
private void setDistortText() |
| 252 | 242 |
{
|
| 253 |
fscaleX = ((int)(100*fscaleX))/100.0f;
|
|
| 254 |
fscaleY = ((int)(100*fscaleY))/100.0f;
|
|
| 255 |
fscaleZ = ((int)(100*fscaleZ))/100.0f;
|
|
| 243 |
fdistortX = ((int)(100*fdistortX))/100.0f;
|
|
| 244 |
fdistortY = ((int)(100*fdistortY))/100.0f;
|
|
| 245 |
fdistortZ = ((int)(100*fdistortZ))/100.0f;
|
|
| 256 | 246 |
|
| 257 |
textDistort.setText("distort("+fscaleX+" , "+fscaleY+" , "+fscaleZ+")");
|
|
| 247 |
textDistort.setText("distort("+fdistortX+" , "+fdistortY+" , "+fdistortZ+")");
|
|
| 258 | 248 |
} |
| 259 | 249 |
|
| 260 | 250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 261 | 251 |
|
| 262 | 252 |
private void computeSink() |
| 263 | 253 |
{
|
| 264 |
frotateX = (rotateX-50)/50.0f; |
|
| 265 |
frotateY = (rotateY-50)/50.0f; |
|
| 266 |
frotateZ = (rotateZ-50)/50.0f; |
|
| 254 |
fsinkA = (sinkA>= 50 ? sinkA-49 : 1/(51-sinkA)); |
|
| 267 | 255 |
|
| 268 |
Vertex3DRenderer.setSink( frotateA, frotateX, frotateY, frotateZ );
|
|
| 256 |
Vertex3DRenderer.setSink( fsinkA );
|
|
| 269 | 257 |
} |
| 270 | 258 |
|
| 271 | 259 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 272 | 260 |
|
| 273 | 261 |
private void setSinkText() |
| 274 | 262 |
{
|
| 275 |
frotateX = ((int)(100*frotateX))/100.0f; |
|
| 276 |
frotateY = ((int)(100*frotateY))/100.0f; |
|
| 277 |
frotateZ = ((int)(100*frotateZ))/100.0f; |
|
| 278 |
|
|
| 279 |
frotateA = ((rotateA-50)*180)/50; |
|
| 263 |
fsinkA = ((int)(100*fsinkA))/100.0f; |
|
| 280 | 264 |
|
| 281 |
textSink.setText("sink( "+frotateA+" ("+frotateX+","+frotateY+","+frotateZ+") )");
|
|
| 265 |
textSink.setText("sink("+fsinkA+")");
|
|
| 282 | 266 |
} |
| 283 | 267 |
|
| 284 | 268 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 285 | 269 |
|
| 286 | 270 |
private void computeSwirl() |
| 287 | 271 |
{
|
| 288 |
fshearX = (shearX-50)/25.0f; |
|
| 289 |
fshearY = (shearY-50)/25.0f; |
|
| 290 |
fshearZ = (shearZ-50)/25.0f; |
|
| 272 |
fswirlA = (swirlA-50)*3.6f; |
|
| 291 | 273 |
|
| 292 |
Vertex3DRenderer.setSwirl( fshearX, fshearY, fshearZ );
|
|
| 274 |
Vertex3DRenderer.setSwirl( fswirlA );
|
|
| 293 | 275 |
} |
| 294 | 276 |
|
| 295 | 277 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 296 | 278 |
|
| 297 | 279 |
private void setSwirlText() |
| 298 | 280 |
{
|
| 299 |
fshearX = ((int)(100*fshearX))/100.0f; |
|
| 300 |
fshearY = ((int)(100*fshearY))/100.0f; |
|
| 301 |
fshearZ = ((int)(100*fshearZ))/100.0f; |
|
| 302 |
|
|
| 303 |
textSwirl.setText("swirl("+fshearX+" , "+fshearY+" , "+fshearZ+")");
|
|
| 281 |
fswirlA = ((int)(100*fswirlA))/100.0f; |
|
| 282 |
|
|
| 283 |
textSwirl.setText("swirl("+fswirlA+")");
|
|
| 304 | 284 |
} |
| 305 | 285 |
|
| 306 | 286 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 352 | 332 |
{
|
| 353 | 333 |
switch (bar.getId()) |
| 354 | 334 |
{
|
| 355 |
case R.id.vertex3ddeformBar1 : moveX = progress; computeDeform() ; setDeformText() ; break;
|
|
| 356 |
case R.id.vertex3ddeformBar2 : moveY = progress; computeDeform() ; setDeformText() ; break;
|
|
| 357 |
case R.id.vertex3ddeformBar3 : moveZ = progress; computeDeform() ; setDeformText() ; break;
|
|
| 358 |
|
|
| 359 |
case R.id.vertex3ddistortBar1 : scaleX= progress; computeDistort() ; setDistortText() ; break;
|
|
| 360 |
case R.id.vertex3ddistortBar2 : scaleY= progress; computeDistort() ; setDistortText() ; break;
|
|
| 361 |
case R.id.vertex3ddistortBar3 : scaleZ= progress; computeDistort() ; setDistortText() ; break;
|
|
| 335 |
case R.id.vertex3ddeformBar1 : deformX= progress; computeDeform() ; setDeformText() ; break;
|
|
| 336 |
case R.id.vertex3ddeformBar2 : deformY= progress; computeDeform() ; setDeformText() ; break;
|
|
| 337 |
case R.id.vertex3ddeformBar3 : deformZ= progress; computeDeform() ; setDeformText() ; break;
|
|
| 338 |
|
|
| 339 |
case R.id.vertex3ddistortBar1 : distortX= progress; computeDistort(); setDistortText() ; break;
|
|
| 340 |
case R.id.vertex3ddistortBar2 : distortY= progress; computeDistort(); setDistortText() ; break;
|
|
| 341 |
case R.id.vertex3ddistortBar3 : distortZ= progress; computeDistort(); setDistortText() ; break;
|
|
| 362 | 342 |
|
| 363 |
case R.id.vertex3dsinkBar1 : rotateX=progress; computeSink() ; setSinkText() ; break; |
|
| 364 |
case R.id.vertex3dsinkBar2 : rotateY=progress; computeSink() ; setSinkText() ; break; |
|
| 365 |
case R.id.vertex3dsinkBar3 : rotateZ=progress; computeSink() ; setSinkText() ; break; |
|
| 343 |
case R.id.vertex3dsinkBar1 : sinkA = progress; computeSink() ; setSinkText() ; break; |
|
| 366 | 344 |
|
| 367 |
case R.id.vertex3dswirlBar1 : shearX= progress; computeSwirl() ; setSwirlText() ; break; |
|
| 368 |
case R.id.vertex3dswirlBar2 : shearY= progress; computeSwirl() ; setSwirlText() ; break; |
|
| 369 |
case R.id.vertex3dswirlBar3 : shearZ= progress; computeSwirl() ; setSwirlText() ; break; |
|
| 345 |
case R.id.vertex3dswirlBar1 : swirlA = progress; computeSwirl() ; setSwirlText() ; break; |
|
| 370 | 346 |
} |
| 371 | 347 |
} |
| 372 | 348 |
|
| src/main/java/org/distorted/examples/vertex3d/Vertex3DRenderer.java | ||
|---|---|---|
| 29 | 29 |
import org.distorted.library.DistortedCubes; |
| 30 | 30 |
import org.distorted.library.EffectNames; |
| 31 | 31 |
import org.distorted.library.EffectTypes; |
| 32 |
import org.distorted.library.type.Dynamic1D; |
|
| 32 | 33 |
import org.distorted.library.type.Dynamic3D; |
| 33 | 34 |
import org.distorted.library.type.Dynamic4D; |
| 35 |
import org.distorted.library.type.Static1D; |
|
| 36 |
import org.distorted.library.type.Static2D; |
|
| 34 | 37 |
import org.distorted.library.type.Static3D; |
| 35 | 38 |
import org.distorted.library.type.Static4D; |
| 36 | 39 |
|
| ... | ... | |
| 45 | 48 |
class Vertex3DRenderer implements GLSurfaceView.Renderer |
| 46 | 49 |
{
|
| 47 | 50 |
private static final int SIZE = 100; |
| 48 |
|
|
| 51 |
private static final int NUM = 3; |
|
| 52 |
|
|
| 49 | 53 |
private GLSurfaceView mView; |
| 50 | 54 |
private static DistortedCubes mCube; |
| 51 | 55 |
|
| 52 | 56 |
private static EffectNames[] order; |
| 53 | 57 |
|
| 54 |
private static Dynamic3D mMoveInter, mScaleInter, mShearInter;
|
|
| 55 |
private static Dynamic4D mDynamicRotate;
|
|
| 58 |
private static Dynamic3D mDeformInter, mDistortInter;
|
|
| 59 |
private static Dynamic1D mSinkInter, mSwirlInter;
|
|
| 56 | 60 |
|
| 57 |
private static Static3D mZeroPoint, mMovePoint, mScalePoint, mShearPoint; |
|
| 58 |
private static Static4D mRotatePoint; |
|
| 61 |
private static Static2D mCenterPoint; |
|
| 62 |
private static Static3D mDeformPoint, mDistortPoint; |
|
| 63 |
private static Static1D mSinkPoint, mSwirlPoint; |
|
| 59 | 64 |
|
| 60 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 61 | 66 |
|
| 62 | 67 |
public static void setDeform(float x, float y, float z) |
| 63 | 68 |
{
|
| 64 |
mMovePoint.set(x, y, z);
|
|
| 69 |
mDeformPoint.set(x, y, z);
|
|
| 65 | 70 |
} |
| 66 | 71 |
|
| 67 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 68 | 73 |
|
| 69 | 74 |
public static void setDistort(float x, float y, float z) |
| 70 | 75 |
{
|
| 71 |
mScalePoint.set(x, y, z);
|
|
| 76 |
mDistortPoint.set(x, y, z);
|
|
| 72 | 77 |
} |
| 73 | 78 |
|
| 74 | 79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 75 | 80 |
|
| 76 |
public static void setSink(float a, float x, float y, float z)
|
|
| 81 |
public static void setSink(float s)
|
|
| 77 | 82 |
{
|
| 78 |
mRotatePoint.set(a,x,y,z);
|
|
| 83 |
mSinkPoint.set(s);
|
|
| 79 | 84 |
} |
| 80 | 85 |
|
| 81 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 82 | 87 |
|
| 83 |
public static void setSwirl(float x, float y, float z)
|
|
| 88 |
public static void setSwirl(float s)
|
|
| 84 | 89 |
{
|
| 85 |
mShearPoint.set(x, y, z);
|
|
| 90 |
mSwirlPoint.set(s);
|
|
| 86 | 91 |
} |
| 87 | 92 |
|
| 88 | 93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 90 | 95 |
public static void setOrder(EffectNames[] effects) |
| 91 | 96 |
{
|
| 92 | 97 |
order = effects; |
| 93 |
setMatrixEffects();
|
|
| 98 |
setVertexEffects();
|
|
| 94 | 99 |
} |
| 95 | 100 |
|
| 96 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 97 | 102 |
|
| 98 |
public static void setMatrixEffects()
|
|
| 103 |
public static void setVertexEffects()
|
|
| 99 | 104 |
{
|
| 100 |
mCube.abortEffects(EffectTypes.MATRIX);
|
|
| 105 |
mCube.abortEffects(EffectTypes.VERTEX);
|
|
| 101 | 106 |
|
| 102 | 107 |
for( int i=0; i<=order.length-1 ; i++ ) |
| 103 | 108 |
{
|
| 104 | 109 |
switch(order[i]) |
| 105 | 110 |
{
|
| 106 |
case MOVE : mCube.move(mMoveInter) ; break;
|
|
| 107 |
case SCALE : mCube.scale(mScaleInter) ; break;
|
|
| 108 |
case ROTATE: mCube.rotate(mDynamicRotate,mZeroPoint); break;
|
|
| 109 |
case SHEAR : mCube.shear(mShearInter, mZeroPoint) ; break;
|
|
| 111 |
case DEFORM : mCube.deform( mDeformInter , mCenterPoint) ; break;
|
|
| 112 |
case DISTORT: mCube.distort(mDistortInter, mCenterPoint) ; break;
|
|
| 113 |
case SINK : mCube.sink( mSinkInter , mCenterPoint) ; break;
|
|
| 114 |
case SWIRL : mCube.swirl( mSwirlInter , mCenterPoint) ; break;
|
|
| 110 | 115 |
} |
| 111 | 116 |
} |
| 112 | 117 |
} |
| ... | ... | |
| 116 | 121 |
public Vertex3DRenderer(GLSurfaceView v) |
| 117 | 122 |
{
|
| 118 | 123 |
mView = v; |
| 119 |
mCube = new DistortedCubes( 1, "1", SIZE);
|
|
| 124 |
mCube = new DistortedCubes( NUM, "111101111", SIZE);
|
|
| 120 | 125 |
|
| 121 |
mZeroPoint = new Static3D(0,0,0);
|
|
| 122 |
mMovePoint = new Static3D(0,0,0);
|
|
| 123 |
mScalePoint = new Static3D(1,1,1);
|
|
| 124 |
mShearPoint = new Static3D(0,0,0);
|
|
| 125 |
mRotatePoint = new Static4D(0,1,0,0);
|
|
| 126 |
|
|
| 127 |
mMoveInter = new Dynamic3D();
|
|
| 128 |
mScaleInter = new Dynamic3D();
|
|
| 129 |
mShearInter = new Dynamic3D();
|
|
| 130 |
mDynamicRotate= new Dynamic4D();
|
|
| 131 |
|
|
| 132 |
mMoveInter.add(mMovePoint);
|
|
| 133 |
mScaleInter.add(mScalePoint);
|
|
| 134 |
mShearInter.add(mShearPoint);
|
|
| 135 |
mDynamicRotate.add(mRotatePoint);
|
|
| 126 |
mCenterPoint = new Static2D(0,0);
|
|
| 127 |
mDeformPoint = new Static3D(0,0,0);
|
|
| 128 |
mDistortPoint= new Static3D(1,1,1);
|
|
| 129 |
mSwirlPoint = new Static1D(0);
|
|
| 130 |
mSinkPoint = new Static1D(1);
|
|
| 131 |
|
|
| 132 |
mDeformInter = new Dynamic3D();
|
|
| 133 |
mDistortInter = new Dynamic3D();
|
|
| 134 |
mSwirlInter = new Dynamic1D();
|
|
| 135 |
mSinkInter = new Dynamic1D();
|
|
| 136 |
|
|
| 137 |
mDeformInter.add(mDeformPoint);
|
|
| 138 |
mDistortInter.add(mDistortPoint);
|
|
| 139 |
mSwirlInter.add(mSwirlPoint);
|
|
| 140 |
mSinkInter.add(mSinkPoint);
|
|
| 136 | 141 |
} |
| 137 | 142 |
|
| 138 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 149 | 154 |
|
| 150 | 155 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
| 151 | 156 |
{
|
| 152 |
setMatrixEffects(); |
|
| 157 |
mCube.abortEffects(EffectTypes.MATRIX); |
|
| 158 |
float factor = (width>height ? height:width)/((NUM+2)*SIZE); |
|
| 159 |
mCube.scale(factor); |
|
| 160 |
mCube.move( new Static3D( (width-factor*NUM*SIZE)/2,(height-factor*NUM*SIZE)/2,0) ); |
|
| 161 |
|
|
| 162 |
setVertexEffects(); |
|
| 153 | 163 |
|
| 154 | 164 |
Distorted.onSurfaceChanged(width, height); |
| 155 | 165 |
} |
| src/main/res/layout/vertex3ddeform.xml | ||
|---|---|---|
| 20 | 20 |
android:layout_marginTop="3dp" |
| 21 | 21 |
android:textAppearance="?android:attr/textAppearanceLarge" /> |
| 22 | 22 |
|
| 23 |
<SeekBar |
|
| 24 |
android:id="@+id/vertex3ddeformBar4" |
|
| 25 |
android:layout_width="fill_parent" |
|
| 26 |
android:layout_height="wrap_content" |
|
| 27 |
android:layout_marginEnd="5dp" |
|
| 28 |
android:layout_marginLeft="5dp" |
|
| 29 |
android:layout_marginRight="5dp" /> |
|
| 30 |
|
|
| 31 | 23 |
<SeekBar |
| 32 | 24 |
android:id="@+id/vertex3ddeformBar1" |
| 33 | 25 |
android:layout_width="fill_parent" |
| src/main/res/layout/vertex3dsink.xml | ||
|---|---|---|
| 30 | 30 |
android:layout_marginLeft="5dp" |
| 31 | 31 |
android:layout_marginRight="5dp" /> |
| 32 | 32 |
|
| 33 |
<SeekBar |
|
| 34 |
android:id="@+id/vertex3dsinkBar2" |
|
| 35 |
android:layout_width="fill_parent" |
|
| 36 |
android:layout_height="wrap_content" |
|
| 37 |
android:layout_gravity="end" |
|
| 38 |
android:layout_marginEnd="5dp" |
|
| 39 |
android:layout_marginLeft="5dp" |
|
| 40 |
android:layout_marginRight="5dp" /> |
|
| 41 |
|
|
| 42 |
<SeekBar |
|
| 43 |
android:id="@+id/vertex3dsinkBar3" |
|
| 44 |
android:layout_width="fill_parent" |
|
| 45 |
android:layout_height="wrap_content" |
|
| 46 |
android:layout_gravity="end" |
|
| 47 |
android:layout_marginEnd="5dp" |
|
| 48 |
android:layout_marginLeft="5dp" |
|
| 49 |
android:layout_marginRight="5dp" /> |
|
| 50 |
|
|
| 51 | 33 |
</LinearLayout> |
| 52 | 34 |
|
| 53 | 35 |
<Button |
| src/main/res/layout/vertex3dswirl.xml | ||
|---|---|---|
| 29 | 29 |
android:layout_marginLeft="5dp" |
| 30 | 30 |
android:layout_marginRight="5dp" /> |
| 31 | 31 |
|
| 32 |
<SeekBar |
|
| 33 |
android:id="@+id/vertex3dswirlBar2" |
|
| 34 |
android:layout_width="fill_parent" |
|
| 35 |
android:layout_height="wrap_content" |
|
| 36 |
android:layout_gravity="end" |
|
| 37 |
android:layout_marginEnd="5dp" |
|
| 38 |
android:layout_marginLeft="5dp" |
|
| 39 |
android:layout_marginRight="5dp" /> |
|
| 40 |
|
|
| 41 |
<SeekBar |
|
| 42 |
android:id="@+id/vertex3dswirlBar3" |
|
| 43 |
android:layout_width="fill_parent" |
|
| 44 |
android:layout_height="wrap_content" |
|
| 45 |
android:layout_gravity="end" |
|
| 46 |
android:layout_marginEnd="5dp" |
|
| 47 |
android:layout_marginLeft="5dp" |
|
| 48 |
android:layout_marginRight="5dp" /> |
|
| 49 |
|
|
| 50 | 32 |
</LinearLayout> |
| 51 | 33 |
|
| 52 | 34 |
<Button |
Also available in: Unified diff
Progress with Vertex3D