Project

General

Profile

« Previous | Next » 

Revision b62eb334

Added by Leszek Koltunski about 5 years ago

Many things.

1) make the Dynamic.setDuration() able to be called AFTER the Dynamic has already been run. (and rename it to 'makeRunNowFor()' )
2) remove the automatic removal of zero Effects from EffectQueues.
3) adjust several Apps to cope with 2)
4) add post-rotation to Rubik (still not finished)

View differences:

src/main/java/org/distorted/examples/rubik/RubikSurfaceView.java
63 63
      {
64 64
      super(context);
65 65

  
66
      mDragging = false;
67
      mBeginRot = false;
68 66
      mRotationVect = VECT[0];
69 67

  
70 68
      mPoint = new float[3];
......
109 107
                                       mY = y;
110 108
                                       mLastTouchedFace = faceTouched(x,y);
111 109

  
112
                                       if( mLastTouchedFace != NONE ) mBeginRot = true;
113
                                       else                           mDragging = true;
114

  
110
                                       if( mLastTouchedFace != NONE ) { mBeginRot = true; mDragging = false; }
111
                                       else                           { mDragging = true; mBeginRot = false; }
115 112
                                       break;
116 113
         case MotionEvent.ACTION_MOVE: if( mDragging )
117 114
                                         {
......
120 117
                                         }
121 118
                                       else if( mBeginRot )
122 119
                                         {
123
                                         int minimumToRotate = (mScreenMin*mScreenMin)/100;
120
                                         int minimumDistToStartRotating = (mScreenMin*mScreenMin)/100;
124 121

  
125
                                         if( (mX-x)*(mX-x)+(mY-y)*(mY-y)>minimumToRotate )
122
                                         if( (mX-x)*(mX-x)+(mY-y)*(mY-y) > minimumDistToStartRotating )
126 123
                                           {
127 124
                                           addNewRotation(x,y);
128 125
                                           mBeginRot = false;
......
134 131
                                         }
135 132
                                       break;
136 133
         case MotionEvent.ACTION_UP  : if( !mDragging ) finishRotation();
137

  
138
                                       mDragging = false;
139
                                       mBeginRot = false;
140

  
141 134
                                       mQuatAccumulated.set(quatMultiply(mQuatCurrent, mQuatAccumulated));
142 135
                                       mQuatCurrent.set(0f, 0f, 0f, 1f);
143 136
                                       mRenderer.setQuatCurrent(mQuatCurrent);
......
366 359
      }
367 360

  
368 361
///////////////////////////////////////////////////////////////////////////////////////////////////
369
// given precomputed mCam and mPoi, respectively camera and touch point positions in ScreenSpace,
370
// cast this touch point onto the 'face' and write the cast coords to 'output'.
371
// Center of the 'face' = (0,0)
362
// given precomputed mCamera and mPoint, respectively camera and touch point positions in ScreenSpace,
363
// cast this touch point onto the surface defined by the 'face' and write the cast coords to 'output'.
364
// Center of the 'face' = (0,0), third coord always +- cubeHalfSize.
372 365

  
373 366
    private void castTouchPointOntoFace(int face, float cubeHalfSize, float[] output)
374 367
      {
......
398 391
      }
399 392

  
400 393
///////////////////////////////////////////////////////////////////////////////////////////////////
394
// retFace{X,Y,Z}axis: 3 functions which return which real AXIS gets mapped to which when we look
395
// directly at a given face. For example, when we look at the RIGHT face of the cube (with TOP still
396
// in the top) then the 'real' X axis becomes the 'Z' axis, thus retFaceZaxis(RIGHT) = VECTX.
401 397

  
402 398
    private int retFaceXaxis(int face)
403 399
      {

Also available in: Unified diff