Project

General

Profile

« Previous | Next » 

Revision 0e7a13b4

Added by Leszek Koltunski almost 4 years ago

Progress with Megaminx.

View differences:

src/main/java/org/distorted/objects/TwistyMegaminx.java
414 414

  
415 415
  int getCornerColor(int cubit, int cubitface, int numLayers, int numCubitsPerCorner)
416 416
    {
417
    if( cubitface<0 || cubitface>2 ) return NUM_TEXTURES*NUM_FACES;
417
    if( cubitface<0 || cubitface>2 ) return NUM_TEXTURES;
418 418

  
419 419
    int part  = cubit % numCubitsPerCorner;
420 420
    int corner= cubit / numCubitsPerCorner;
......
429 429
      int block = (part-1) % N;
430 430
      int index = (part-1) / N;
431 431

  
432
      if( block< (numLayers-1)/2 )
432
      if( block< (numLayers-3)/2 )
433 433
        {
434 434
        switch(index)
435 435
          {
436
          case 0: return cubitface==1 ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface];
437
          case 1: return cubitface==0 ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface];
438
          case 2: return cubitface==2 ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface];
436
          case 0: return cubitface==1 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
437
          case 1: return cubitface==0 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
438
          case 2: return cubitface==2 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
439 439
          }
440 440
        }
441 441
      else
442 442
        {
443 443
        switch(index)
444 444
          {
445
          case 0: return cubitface==0 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES;
446
          case 1: return cubitface==2 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES;
447
          case 2: return cubitface==1 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES;
445
          case 0: return cubitface==0 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
446
          case 1: return cubitface==2 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
447
          case 2: return cubitface==1 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
448 448
          }
449 449
        }
450 450
      }
451 451

  
452
    return NUM_TEXTURES*NUM_FACES;
452
    return NUM_TEXTURES;
453 453
    }
454 454

  
455 455
///////////////////////////////////////////////////////////////////////////////////////////////////
456 456

  
457 457
  int getEdgeColor(int cubit, int cubitface, int numLayers, int numCubitsPerCorner, int numCubitsPerEdge)
458 458
    {
459
    if( cubitface<0 || cubitface>1 ) return NUM_TEXTURES*NUM_FACES;
459
    if( cubitface<0 || cubitface>1 ) return NUM_TEXTURES;
460 460

  
461 461
    int part = (cubit - NUM_CORNERS*numCubitsPerCorner) % numCubitsPerEdge;
462 462
    int edge = (cubit - NUM_CORNERS*numCubitsPerCorner) / numCubitsPerEdge;
......
466 466
      return mEdgeMap[edge][cubitface+2];
467 467
      }
468 468

  
469
    return cubitface==((part+1)%2) ? mEdgeMap[edge][cubitface+2] : NUM_TEXTURES*NUM_FACES;
469
    return cubitface==((part+1)%2) ? mEdgeMap[edge][cubitface+2] : NUM_TEXTURES;
470 470
    }
471 471

  
472 472
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff