Project

General

Profile

« Previous | Next » 

Revision c6223217

Added by Leszek Koltunski over 5 years ago

Improve the Rubik App.

View differences:

src/main/java/org/distorted/examples/rubik/RubikRenderer.java
281 281

  
282 282
///////////////////////////////////////////////////////////////////////////////////////////////////
283 283

  
284
    void rotateFace(Static3D vector, int angle, int row )
284
    void addNewRotation(int vector, int row )
285 285
      {
286
      String vect = "("+vector.get1()+","+vector.get2()+","+vector.get3()+")";
286
      String vect="?";
287 287

  
288
      android.util.Log.e("rubik", "rotating by "+angle+" degrees, row="+row+" vector: "+vect);
288
      switch(vector)
289
        {
290
        case RubikSurfaceView.VECTX: vect="X"; break;
291
        case RubikSurfaceView.VECTY: vect="Y"; break;
292
        case RubikSurfaceView.VECTZ: vect="Z"; break;
293
        }
294

  
295
      android.util.Log.e("rubik", "added new rotation (row="+row+" vector: "+vect+")");
296
      }
297

  
298
///////////////////////////////////////////////////////////////////////////////////////////////////
299

  
300
    void continueRotation(float angle)
301
      {
302
      android.util.Log.e("rubik", "rotating by angle: "+ (((float)((int)(angle*100.0f)))/100.0f) );
303
      }
304

  
305
///////////////////////////////////////////////////////////////////////////////////////////////////
306

  
307
    void finishRotation()
308
      {
309
      android.util.Log.e("rubik", "finishing rotation");
289 310
      }
290 311

  
291 312
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/rubik/RubikSurfaceView.java
25 25
import android.opengl.GLSurfaceView;
26 26
import android.view.MotionEvent;
27 27

  
28
import org.distorted.library.type.Static3D;
29 28
import org.distorted.library.type.Static4D;
30 29

  
31 30
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 32
class RubikSurfaceView extends GLSurfaceView
34 33
{
35 34
    private final static int NONE   =-1;
36
    private final static int FRONT  = 0;
37
    private final static int BACK   = 1;
38
    private final static int LEFT   = 2;
39
    private final static int RIGHT  = 3;
40
    private final static int TOP    = 4;
41
    private final static int BOTTOM = 5;
35
    private final static int FRONT  = 0;  // has to be 6 consecutive ints
36
    private final static int BACK   = 1;  // FRONT ... BOTTOM
37
    private final static int LEFT   = 2;  //
38
    private final static int RIGHT  = 3;  //
39
    private final static int TOP    = 4;  //
40
    private final static int BOTTOM = 5;  //
42 41

  
43 42
    private static final int DIR_UP   =0;
44 43
    private static final int DIR_DOWN =1;
45 44
    private static final int DIR_LEFT =2;
46 45
    private static final int DIR_RIGHT=3;
47 46

  
48
    private static final Static3D VECTX = new Static3D(1,0,0);
49
    private static final Static3D VECTY = new Static3D(0,1,0);
50
    private static final Static3D VECTZ = new Static3D(0,0,1);
47
    static final int VECTX = 0;
48
    static final int VECTY = 1;
49
    static final int VECTZ = 2;
50
    static final int VECTN = 3;
51 51

  
52 52
    private boolean mDragging, mRotating;
53 53
    private int mX, mY;
54 54
    private int mTouchedRow, mTouchedCol, mTouchedSli;
55 55
    private Static4D mQuatCurrent, mQuatAccumulated;
56
    private int mRotationVect;
56 57
    private RubikRenderer mRenderer;
57 58

  
58 59
    private float mPoiX, mPoiY, mPoiZ, mCamX, mCamY, mCamZ;
......
67 68

  
68 69
      mDragging = false;
69 70
      mRotating = false;
71
      mRotationVect = VECTN;
72

  
70 73
      mRenderer = new RubikRenderer(this);
71 74

  
72 75
      mQuatCurrent     = new Static4D(0,0,0,1);
......
123 126

  
124 127
                                         if( (mX-x)*(mX-x)+(mY-y)*(mY-y)>minimumToRotate )
125 128
                                           {
126
                                           rotateFace(x,y);
129
                                           addNewRotation(x,y);
127 130
                                           mRotating = false;
128 131
                                           }
129 132
                                         }
133
                                       else
134
                                         {
135
                                         continueRotation(x,y);
136
                                         }
130 137
                                       break;
131
         case MotionEvent.ACTION_UP  : mDragging = false;
138
         case MotionEvent.ACTION_UP  : if( !mDragging ) finishRotation();
139

  
140
                                       mDragging = false;
132 141
                                       mRotating = false;
133 142

  
134 143
                                       mQuatAccumulated.set(quatMultiply(mQuatCurrent, mQuatAccumulated));
......
143 152

  
144 153
///////////////////////////////////////////////////////////////////////////////////////////////////
145 154

  
146
    private void rotateFace(int x, int y)
155
    private void addNewRotation(int x, int y)
147 156
      {
148
      fillCameraAndTouchPoint(x,y);
157
      fillTouchPoint(x,y);
158

  
149 159
      float cubeHalfSize= mRenderer.returnCubeSize()*0.5f;
150
      float A=0f;
160
      float tmp = RubikRenderer.NUM_CUBES/(2*cubeHalfSize);
161
      float A=retA(mLastTouchedFace,cubeHalfSize);
151 162

  
152
      switch(mLastTouchedFace)
153
        {
154
        case FRONT : A = ( mPoiZ!=mCamZ ? ( cubeHalfSize-mCamZ)/(mPoiZ-mCamZ) : 0f); break;
155
        case BACK  : A = ( mPoiZ!=mCamZ ? (-cubeHalfSize-mCamZ)/(mPoiZ-mCamZ) : 0f); break;
156
        case LEFT  : A = ( mPoiX!=mCamX ? (-cubeHalfSize-mCamX)/(mPoiX-mCamX) : 0f); break;
157
        case RIGHT : A = ( mPoiX!=mCamX ? ( cubeHalfSize-mCamX)/(mPoiX-mCamX) : 0f); break;
158
        case TOP   : A = ( mPoiY!=mCamY ? ( cubeHalfSize-mCamY)/(mPoiY-mCamY) : 0f); break;
159
        case BOTTOM: A = ( mPoiY!=mCamY ? (-cubeHalfSize-mCamY)/(mPoiY-mCamY) : 0f); break;
160
        }
161 163
      float diffX = (mPoiX-mCamX)*A + mCamX - mStartX;
162 164
      float diffY = (mPoiY-mCamY)*A + mCamY - mStartY;
163 165
      float diffZ = (mPoiZ-mCamZ)*A + mCamZ - mStartZ;
164 166

  
165
      Static3D rotV=VECTX;
166
      int dir, rotA =1, rotRC=1;
167
      int dir, row=1;
167 168

  
168 169
      switch(mLastTouchedFace)
169 170
        {
170 171
        case FRONT : dir = retDirection( diffX, diffY);
171
                     rotV = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTY;
172
                     rotA = (dir==DIR_UP || dir==DIR_LEFT) ? -90:90;
173
                     rotRC = (int)( RubikRenderer.NUM_CUBES*((rotV==VECTX?mStartX:mStartY)+cubeHalfSize)/(2*cubeHalfSize) );
172
                     mRotationVect = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTY;
173
                     row = (int)( tmp*((mRotationVect==VECTX?mStartX:mStartY)+cubeHalfSize) );
174 174
                     break;
175 175
        case BACK  : dir = retDirection(-diffX, diffY);
176
                     rotV = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTY;
177
                     rotA = (dir==DIR_UP || dir==DIR_RIGHT) ? 90:-90;
178
                     rotRC = (int)( RubikRenderer.NUM_CUBES*((rotV==VECTX?mStartX:mStartY)+cubeHalfSize)/(2*cubeHalfSize) );
176
                     mRotationVect = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTY;
177
                     row = (int)( tmp*((mRotationVect==VECTX?mStartX:mStartY)+cubeHalfSize) );
179 178
                     break;
180 179
        case LEFT  : dir = retDirection( diffZ, diffY);
181
                     rotV = (dir==DIR_UP || dir==DIR_DOWN) ? VECTZ:VECTY;
182
                     rotA = (dir==DIR_UP || dir==DIR_LEFT) ? -90:90;
183
                     rotRC = (int)( RubikRenderer.NUM_CUBES*((rotV==VECTZ?mStartZ:mStartY)+cubeHalfSize)/(2*cubeHalfSize) );
180
                     mRotationVect = (dir==DIR_UP || dir==DIR_DOWN) ? VECTZ:VECTY;
181
                     row = (int)( tmp*((mRotationVect==VECTZ?mStartZ:mStartY)+cubeHalfSize) );
184 182
                     break;
185 183
        case RIGHT : dir = retDirection(-diffZ, diffY);
186
                     rotV = (dir==DIR_UP || dir==DIR_DOWN) ? VECTZ:VECTY;
187
                     rotA = (dir==DIR_UP || dir==DIR_RIGHT) ? 90:-90;
188
                     rotRC = (int)( RubikRenderer.NUM_CUBES*((rotV==VECTZ?mStartZ:mStartY)+cubeHalfSize)/(2*cubeHalfSize) );
184
                     mRotationVect = (dir==DIR_UP || dir==DIR_DOWN) ? VECTZ:VECTY;
185
                     row = (int)( tmp*((mRotationVect==VECTZ?mStartZ:mStartY)+cubeHalfSize) );
189 186
                     break;
190 187
        case TOP   : dir = retDirection( diffX,-diffZ);
191
                     rotV = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTZ;
192
                     rotA = (dir==DIR_UP || dir==DIR_RIGHT) ? -90:90;
193
                     rotRC = (int)( RubikRenderer.NUM_CUBES*((rotV==VECTX?mStartX:mStartZ)+cubeHalfSize)/(2*cubeHalfSize) );
188
                     mRotationVect = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTZ;
189
                     row = (int)( tmp*((mRotationVect==VECTX?mStartX:mStartZ)+cubeHalfSize) );
194 190
                     break;
195 191
        case BOTTOM: dir = retDirection( diffX, diffZ);
196
                     rotV = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTZ;
197
                     rotA = (dir==DIR_UP || dir==DIR_LEFT) ? -90:90;
198
                     rotRC = (int)( RubikRenderer.NUM_CUBES*((rotV==VECTX?mStartX:mStartZ)+cubeHalfSize)/(2*cubeHalfSize) );
192
                     mRotationVect = (dir==DIR_UP || dir==DIR_DOWN) ? VECTX:VECTZ;
193
                     row = (int)( tmp*((mRotationVect==VECTX?mStartX:mStartZ)+cubeHalfSize) );
199 194
                     break;
200 195
        }
201 196

  
202
      mRenderer.rotateFace(rotV,rotA,rotRC);
197
      mStartX = diffX + mStartX;
198
      mStartY = diffY + mStartY;
199
      mStartZ = diffZ + mStartZ;
200

  
201
      mRenderer.addNewRotation(mRotationVect,row);
202
      }
203

  
204
///////////////////////////////////////////////////////////////////////////////////////////////////
205

  
206
    private void continueRotation(int x, int y)
207
      {
208
      fillTouchPoint(x,y);
209

  
210
      float angle=0.0f;
211
      float cubeHalfSize= mRenderer.returnCubeSize()*0.5f;
212
      float A=retA(mLastTouchedFace,cubeHalfSize);
213

  
214
      float diffX = (mPoiX-mCamX)*A + mCamX - mStartX;
215
      float diffY = (mPoiY-mCamY)*A + mCamY - mStartY;
216
      float diffZ = (mPoiZ-mCamZ)*A + mCamZ - mStartZ;
217

  
218
      switch(mRotationVect)
219
        {
220
        case VECTX: switch(mLastTouchedFace)
221
                      {
222
                      case FRONT : angle = returnAngle(-diffZ, diffY); break;
223
                      case BACK  : angle = returnAngle( diffZ,-diffY); break;
224
                      case TOP   : angle = returnAngle(-diffY,-diffZ); break;
225
                      case BOTTOM: angle = returnAngle( diffY, diffZ); break;
226
                      }
227
                    break;
228
        case VECTY: switch(mLastTouchedFace)
229
                      {
230
                      case FRONT : angle = returnAngle(-diffZ, diffX); break;
231
                      case BACK  : angle = returnAngle( diffZ,-diffX); break;
232
                      case LEFT  : angle = returnAngle( diffX, diffZ); break;
233
                      case RIGHT : angle = returnAngle(-diffX,-diffZ); break;
234
                      }
235
                    break;
236
        case VECTZ: switch(mLastTouchedFace)
237
                      {
238
                      case TOP   : angle = returnAngle( diffY, diffX); break;
239
                      case BOTTOM: angle = returnAngle(-diffY,-diffX); break;
240
                      case LEFT  : angle = returnAngle(-diffX, diffY); break;
241
                      case RIGHT : angle = returnAngle( diffX,-diffY); break;
242
                      }
243
                    break;
244
        default   : android.util.Log.e("View", "impossible vector: "+mRotationVect);
245
        }
246

  
247
      mRenderer.continueRotation(angle);
248
      }
249

  
250
///////////////////////////////////////////////////////////////////////////////////////////////////
251

  
252
    private void finishRotation()
253
      {
254
      mRotationVect = VECTN;
255

  
256
      mRenderer.finishRotation();
257
      }
258

  
259
///////////////////////////////////////////////////////////////////////////////////////////////////
260

  
261
    private float returnAngle(float diff1, float diff2)
262
      {
263
      float len = (float)Math.sqrt(diff1*diff1 + diff2*diff2);
264
      len /= mRenderer.mScreenMin;
265

  
266
      return diff2>0 ? len : -len;
203 267
      }
204 268

  
205 269
///////////////////////////////////////////////////////////////////////////////////////////////////
......
322 386
      {
323 387
      float cubeHalfSize= mRenderer.returnCubeSize()*0.5f;
324 388

  
325
      fillCameraAndTouchPoint(xTouch,yTouch);
389
      fillTouchPoint(xTouch,yTouch);
390
      fillCamera();
326 391

  
327
      if( faceIsVisible(FRONT) )
392
      for(int face=FRONT; face<=BOTTOM; face++)
328 393
        {
329
        if( mPoiZ!= mCamZ )
394
        if( faceIsVisible(face) && faceCondition(face) )
330 395
          {
331
          float A = (cubeHalfSize-mCamZ)/(mPoiZ-mCamZ);
332
          mStartX = (mPoiX-mCamX)*A + mCamX;
333
          mStartY = (mPoiY-mCamY)*A + mCamY;
334
          mStartZ = (mPoiZ-mCamZ)*A + mCamZ;
335
          float qX= (mStartX+cubeHalfSize) / (2*cubeHalfSize);
336
          float qY= (mStartY+cubeHalfSize) / (2*cubeHalfSize);
337

  
338
          if( qX<=1 && qX>=0 && qY<=1 && qY>=0 )
339
            {
340
            mTouchedCol = (int)(qX*RubikRenderer.NUM_CUBES);
341
            mTouchedRow = (int)(qY*RubikRenderer.NUM_CUBES);
342
            mTouchedSli = RubikRenderer.NUM_CUBES - 1;
343
            return FRONT;
344
            }
345
          }
346
        }
347
      if( faceIsVisible(BACK) )
348
        {
349
        if( mPoiZ!= mCamZ )
350
          {
351
          float A = (-cubeHalfSize-mCamZ)/(mPoiZ-mCamZ);
352
          mStartX = (mPoiX-mCamX)*A + mCamX;
353
          mStartY = (mPoiY-mCamY)*A + mCamY;
354
          mStartZ = (mPoiZ-mCamZ)*A + mCamZ;
355
          float qX= (mStartX+cubeHalfSize) / (2*cubeHalfSize);
356
          float qY= (mStartY+cubeHalfSize) / (2*cubeHalfSize);
357

  
358
          if( qX<=1 && qX>=0 && qY<=1 && qY>=0 )
359
            {
360
            mTouchedCol = (int)( qX*RubikRenderer.NUM_CUBES);
361
            mTouchedRow = (int)( qY*RubikRenderer.NUM_CUBES);
362
            mTouchedSli = 0;
363
            return BACK;
364
            }
365
          }
366
        }
367
      if( faceIsVisible(LEFT) )
368
        {
369
        if( mPoiX!= mCamX )
370
          {
371
          float A = (-cubeHalfSize-mCamX)/(mPoiX-mCamX);
372
          mStartX = (mPoiX-mCamX)*A + mCamX;
373
          mStartY = (mPoiY-mCamY)*A + mCamY;
374
          mStartZ = (mPoiZ-mCamZ)*A + mCamZ;
375
          float qY= (mStartY+cubeHalfSize) / (2*cubeHalfSize);
376
          float qZ= (mStartZ+cubeHalfSize) / (2*cubeHalfSize);
396
          float A = retA(face,cubeHalfSize);
377 397

  
378
          if( qZ<=1 && qZ>=0 && qY<=1 && qY>=0 )
379
            {
380
            mTouchedCol = 0;
381
            mTouchedRow = (int)( qY*RubikRenderer.NUM_CUBES);
382
            mTouchedSli = (int)( qZ*RubikRenderer.NUM_CUBES);
383
            return LEFT;
384
            }
385
          }
386
        }
387
      if( faceIsVisible(RIGHT) )
388
        {
389
        if( mPoiX!= mCamX )
390
          {
391
          float A = (cubeHalfSize-mCamX)/(mPoiX-mCamX);
392 398
          mStartX = (mPoiX-mCamX)*A + mCamX;
393 399
          mStartY = (mPoiY-mCamY)*A + mCamY;
394 400
          mStartZ = (mPoiZ-mCamZ)*A + mCamZ;
395
          float qY= (mStartY+cubeHalfSize) / (2*cubeHalfSize);
396
          float qZ= (mStartZ+cubeHalfSize) / (2*cubeHalfSize);
397 401

  
398
          if( qZ<=1 && qZ>=0 && qY<=1 && qY>=0 )
399
            {
400
            mTouchedCol = RubikRenderer.NUM_CUBES -1;
401
            mTouchedRow = (int)( qY*RubikRenderer.NUM_CUBES);
402
            mTouchedSli = (int)( qZ*RubikRenderer.NUM_CUBES);
403
            return RIGHT;
404
            }
405
          }
406
        }
407
      if( faceIsVisible(TOP) )
408
        {
409
        if( mPoiY!= mCamY )
410
          {
411
          float A = (cubeHalfSize-mCamY)/(mPoiY-mCamY);
412
          mStartX = (mPoiX-mCamX)*A + mCamX;
413
          mStartY = (mPoiY-mCamY)*A + mCamY;
414
          mStartZ = (mPoiZ-mCamZ)*A + mCamZ;
415 402
          float qX= (mStartX+cubeHalfSize) / (2*cubeHalfSize);
403
          float qY= (mStartY+cubeHalfSize) / (2*cubeHalfSize);
416 404
          float qZ= (mStartZ+cubeHalfSize) / (2*cubeHalfSize);
417 405

  
418
          if( qZ<=1 && qZ>=0 && qX<=1 && qX>=0 )
419
            {
420
            mTouchedCol = (int)( qX*RubikRenderer.NUM_CUBES);
421
            mTouchedRow = RubikRenderer.NUM_CUBES -1;
422
            mTouchedSli = (int)( qZ*RubikRenderer.NUM_CUBES);
423
            return TOP;
424
            }
425
          }
426
        }
427
      if( faceIsVisible(BOTTOM) )
428
        {
429
        if( mPoiY!= mCamY )
430
          {
431
          float A = (-cubeHalfSize-mCamY)/(mPoiY-mCamY);
432
          mStartX = (mPoiX-mCamX)*A + mCamX;
433
          mStartY = (mPoiY-mCamY)*A + mCamY;
434
          mStartZ = (mPoiZ-mCamZ)*A + mCamZ;
435
          float qX= (mStartX+cubeHalfSize) / (2*cubeHalfSize);
436
          float qZ= (mStartZ+cubeHalfSize) / (2*cubeHalfSize);
406
          if( qX==1.0f ) qX-= 0.5f/RubikRenderer.NUM_CUBES;
407
          if( qY==1.0f ) qY-= 0.5f/RubikRenderer.NUM_CUBES;
408
          if( qZ==1.0f ) qZ-= 0.5f/RubikRenderer.NUM_CUBES;
437 409

  
438
          if( qZ<=1 && qZ>=0 && qX<=1 && qX>=0 )
410
          if( qX<1 && qX>=0 && qY<1 && qY>=0 && qZ<1 && qZ>=0 )
439 411
            {
440
            mTouchedCol = (int)( qX*RubikRenderer.NUM_CUBES);
441
            mTouchedRow = 0;
442
            mTouchedSli = (int)( qZ*RubikRenderer.NUM_CUBES);
443
            return BOTTOM;
412
            mTouchedCol = (int)(qX*RubikRenderer.NUM_CUBES);
413
            mTouchedRow = (int)(qY*RubikRenderer.NUM_CUBES);
414
            mTouchedSli = (int)(qZ*RubikRenderer.NUM_CUBES);
415
            return face;
444 416
            }
445 417
          }
446 418
        }
......
454 426

  
455 427
///////////////////////////////////////////////////////////////////////////////////////////////////
456 428

  
457
    void fillCameraAndTouchPoint(int x, int y)
429
    void fillTouchPoint(int x, int y)
458 430
      {
459
      float cameraDistance = mRenderer.returnCameraDistance();
460
      float halfScrWidth   = mRenderer.getScreenWidth()*0.5f;
461
      float halfScrHeight  = mRenderer.getScreenHeight()*0.5f;
431
      float halfScrWidth  = mRenderer.getScreenWidth() *0.5f;
432
      float halfScrHeight = mRenderer.getScreenHeight()*0.5f;
433
      Static4D touchPoint = new Static4D(x-halfScrWidth, halfScrHeight-y, 0, 0);
434
      Static4D rotatedTouchPoint= rotateVector(touchPoint);
462 435

  
463
      Static4D cameraPoint = new Static4D(             0,               0, cameraDistance, 0);
464
      Static4D touchPoint  = new Static4D(x-halfScrWidth, halfScrHeight-y,              0, 0);
436
      mPoiX = rotatedTouchPoint.get1();
437
      mPoiY = rotatedTouchPoint.get2();
438
      mPoiZ = rotatedTouchPoint.get3();
439
      }
465 440

  
466
      Static4D rotatedCamera    = rotateVector(cameraPoint);
467
      Static4D rotatedTouchPoint= rotateVector(touchPoint);
441
///////////////////////////////////////////////////////////////////////////////////////////////////
442

  
443
    void fillCamera()
444
      {
445
      float cameraDistance = mRenderer.returnCameraDistance();
446

  
447
      Static4D cameraPoint = new Static4D(0, 0, cameraDistance, 0);
448
      Static4D rotatedCamera= rotateVector(cameraPoint);
468 449

  
469 450
      mCamX = rotatedCamera.get1();
470 451
      mCamY = rotatedCamera.get2();
471 452
      mCamZ = rotatedCamera.get3();
453
      }
472 454

  
473
      mPoiX = rotatedTouchPoint.get1();
474
      mPoiY = rotatedTouchPoint.get2();
475
      mPoiZ = rotatedTouchPoint.get3();
455
///////////////////////////////////////////////////////////////////////////////////////////////////
456

  
457
    float retA(int face, float cubeHalfSize)
458
      {
459
      switch(face)
460
        {
461
        case FRONT : return ( mPoiZ!=mCamZ ? ( cubeHalfSize-mCamZ)/(mPoiZ-mCamZ) : 0f);
462
        case BACK  : return ( mPoiZ!=mCamZ ? (-cubeHalfSize-mCamZ)/(mPoiZ-mCamZ) : 0f);
463
        case LEFT  : return ( mPoiX!=mCamX ? (-cubeHalfSize-mCamX)/(mPoiX-mCamX) : 0f);
464
        case RIGHT : return ( mPoiX!=mCamX ? ( cubeHalfSize-mCamX)/(mPoiX-mCamX) : 0f);
465
        case TOP   : return ( mPoiY!=mCamY ? ( cubeHalfSize-mCamY)/(mPoiY-mCamY) : 0f);
466
        case BOTTOM: return ( mPoiY!=mCamY ? (-cubeHalfSize-mCamY)/(mPoiY-mCamY) : 0f);
467
        }
468

  
469
      return 0.0f;
470
      }
471

  
472
///////////////////////////////////////////////////////////////////////////////////////////////////
473

  
474
    boolean faceCondition(int face)
475
      {
476
      switch(face)
477
        {
478
        case FRONT :
479
        case BACK  : return ( mPoiZ!=mCamZ );
480
        case LEFT  :
481
        case RIGHT : return ( mPoiX!=mCamX );
482
        case TOP   :
483
        case BOTTOM: return ( mPoiY!=mCamY );
484
        }
485

  
486
      return false;
476 487
      }
477 488
}
478 489

  

Also available in: Unified diff