Project

General

Profile

« Previous | Next » 

Revision 43a4ccff

Added by Leszek Koltunski over 2 years ago

simplify sticker/color map.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyKilominx.java
558 558

  
559 559
    int part  = cubit % numCubitsPerCorner;
560 560
    int corner= cubit / numCubitsPerCorner;
561
    int color = mCornerFaceMap[corner][cubitface] + NUM_FACE_COLORS;
561 562

  
562 563
    if( part==0 )
563 564
      {
564
      return mCornerFaceMap[corner][cubitface];
565
      return color;
565 566
      }
566 567
    else
567 568
      {
......
573 574
        {
574 575
        switch(index)
575 576
          {
576
          case 0: return cubitface==1 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
577
          case 1: return cubitface==0 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
578
          case 2: return cubitface==2 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
577
          case 0: return cubitface==1 ? NUM_TEXTURES : color;
578
          case 1: return cubitface==0 ? NUM_TEXTURES : color;
579
          case 2: return cubitface==2 ? NUM_TEXTURES : color;
579 580
          }
580 581
        }
581 582
      else
582 583
        {
583 584
        switch(index)
584 585
          {
585
          case 0: return cubitface==0 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
586
          case 1: return cubitface==2 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
587
          case 2: return cubitface==1 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
586
          case 0: return cubitface==0 ? color : NUM_TEXTURES;
587
          case 1: return cubitface==2 ? color : NUM_TEXTURES;
588
          case 2: return cubitface==1 ? color : NUM_TEXTURES;
588 589
          }
589 590
        }
590 591
      }
......
604 605

  
605 606
    part /=2;
606 607

  
607
    return (part==0 || cubitface==((part+1)%2)) ? mEdgeMap[variant][cubitface+2] + ((part+3)/2)*NUM_FACE_COLORS : NUM_TEXTURES;
608
    return (part==0 || cubitface==((part+1)%2)) ? mEdgeMap[variant][cubitface+2] + ((part+5)/2)*NUM_FACE_COLORS : NUM_TEXTURES;
608 609
    }
609 610

  
610 611
///////////////////////////////////////////////////////////////////////////////////////////////////
......
619 620
      return cubitface>=0 && cubitface<3 ? mCornerFaceMap[center][cubitface] : NUM_TEXTURES;
620 621
      }
621 622

  
622
    return cubitface==mCenterFaceMap[center] ? center/5 + NUM_FACE_COLORS*(numLayers-1)/2 : NUM_TEXTURES;
623
    return cubitface==mCenterFaceMap[center] ? center/5 : NUM_TEXTURES;
623 624
    }
624 625

  
625 626
///////////////////////////////////////////////////////////////////////////////////////////////////
......
652 653
    {
653 654
    if( mStickers==null )
654 655
      {
655
      float[][] STICKERS = new float[][]
656
      float[][] STICKERS;
657
      int[] numLayers = getNumLayers();
658
      int numL = numLayers[0];
659

  
660
      if( numL==3 )
656 661
        {
657
          { -0.36616942f, -0.36327124f, 0.5f, -0.36327124f, 0.23233888f, 0.4605048f, -0.36616942f, 0.26603764f },
658
          { -0.36327127f, -0.5f, 0.36327127f, -0.26393202f, 0.36327127f, 0.5f, -0.36327127f, 0.26393202f },
659
          { -0.3249197f, -0.39442718f, 0.3249197f, -0.39442718f, 0.3249197f, 0.5f, -0.3249197f, 0.2888544f }
660
        };
662
        STICKERS = new float[][]
663
          {
664
            { -0.36616942f, -0.36327124f, 0.5f, -0.36327124f, 0.23233888f, 0.4605048f, -0.36616942f, 0.26603764f }
665
          };
666
        }
667
      else
668
        {
669
        STICKERS = new float[][]
670
          {
671
            { -0.36616942f, -0.36327124f, 0.5f, -0.36327124f, 0.23233888f, 0.4605048f, -0.36616942f, 0.26603764f },
672
            { -0.36327127f, -0.5f, 0.36327127f, -0.26393202f, 0.36327127f, 0.5f, -0.36327127f, 0.26393202f },
673
            { -0.3249197f, -0.39442718f, 0.3249197f, -0.39442718f, 0.3249197f, 0.5f, -0.3249197f, 0.2888544f }
674
          };
675
        }
661 676

  
662 677
      float CENTER_CORR = 0.87f;
663 678
      float C = 1.14f; // make the 'center' sticker artificially larger, so that we paint over the area in the center of the face.
......
677 692
      mStickers = new ObjectSticker[STICKERS.length];
678 693

  
679 694
      float R = 0.10f;
695
      float S = numL==3 ? 0.20f : 0.15f;
680 696
      final float[][] radii = { {R,R,R,R},{R,R,R,R},{R,R,R,R} };
681
      float[] strokes = { 0.20f, 0.11f, 0.10f };
697
      float[] strokes = { S, 0.11f, 0.10f };
682 698

  
683 699
      if( ObjectControl.isInIconMode() )
684 700
        {
685
        int[] numLayers = getNumLayers();
686
        float mult = numLayers[0]==3 ? 1.0f : 1.5f;
701
        float mult = numL==3 ? 1.0f : 1.5f;
687 702

  
688 703
        strokes[0]*=mult;
689 704
        strokes[1]*=mult;
......
699 714
    return mStickers[sticker];
700 715
    }
701 716

  
702
///////////////////////////////////////////////////////////////////////////////////////////////////
703

  
704
  protected int getStickerIndex(int face)
705
    {
706
    int variant = face/NUM_FACE_COLORS;
707
    int[] numLayers = getNumLayers();
708
    int numL = numLayers[0];
709

  
710
    if( variant == (numL-1)/2 || numL==3 ) return 0;
711
    if( variant==0 ) return 1;
712

  
713
    return 2;
714
    }
715

  
716 717
///////////////////////////////////////////////////////////////////////////////////////////////////
717 718

  
718 719
  public ObjectType intGetObjectType(int[] numLayers)

Also available in: Unified diff