Project

General

Profile

« Previous | Next » 

Revision 11fa413d

Added by Leszek Koltunski over 2 years ago

Make the ShapeChanging the default TouchControl during MODE_REPLACE.

View differences:

src/main/java/org/distorted/objectlib/touchcontrol/TouchControlShapeChanging.java
107 107

  
108 108
  public TouchControlShapeChanging(TwistyObject object)
109 109
    {
110
    super(object.getObjectRatio());
111

  
110 112
    mPoint = new float[3];
111 113
    mCamera= new float[3];
112 114
    mTouch = new float[3];
......
252 254
///////////////////////////////////////////////////////////////////////////////////////////////////
253 255
// vertices are counterclockwise
254 256

  
255
  private boolean isInside(float[] point, float[][] vertices )
257
  private boolean isInside(float[] point, float[][] vertices)
256 258
    {
257 259
    int numVert = vertices.length;
258 260

  
......
323 325
// 4) else, rotate 'vertices' by quat and see if the casted point lies inside the polygon defined by them
324 326
// 5) if yes, return its Z; otherwise, return NOT_TOUCHED
325 327

  
326
  private float cubitFaceTouched(FaceInfo info, float[] quat, float closestSoFar, int cubit, int face)
328
  private float cubitFaceTouched(FaceInfo info, float[] quat, float closestSoFar)
327 329
    {
328 330
    QuatHelper.rotateVectorByQuat(mTmp,info.vector,quat);
329 331
    float nx = mTmp[0];
......
376 378

  
377 379
      for(int face=0; face<mNumFaces[cubit]; face++)
378 380
        {
379
        float dist = cubitFaceTouched(mInfos[cubit][face],quat,closestSoFar,cubit,face);
381
        float dist = cubitFaceTouched(mInfos[cubit][face],quat,closestSoFar);
380 382

  
381 383
        if( dist!=NOT_TOUCHED )
382 384
          {
......
386 388
          }
387 389
        }
388 390
      }
389

  
391
/*
390 392
    if( closestSoFar!=NOT_TOUCHED )
391 393
      {
392 394
      android.util.Log.e("D", "cubit="+mTouchedCubit+" face="+mTouchedFace+" result: "+closestSoFar);
393 395
      }
394

  
396
*/
395 397
    return closestSoFar!=NOT_TOUCHED;
396 398
    }
397 399

  
......
419 421
    }
420 422

  
421 423
///////////////////////////////////////////////////////////////////////////////////////////////////
422
// replace mode only
423 424

  
424
  public int getTouchedFace()
425
  public int getTouchedCubitFace()
425 426
    {
426
    return -1;
427
    return mTouchedFace;
427 428
    }
428 429

  
429 430
///////////////////////////////////////////////////////////////////////////////////////////////////
430
// replace mode only
431 431

  
432
  public float[] getTouchedPoint3D()
432
  public int getTouchedCubit()
433 433
    {
434
    return null;
434
    return mTouchedCubit;
435 435
    }
436 436

  
437 437
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff