Project

General

Profile

« Previous | Next » 

Revision 3a0a23bf

Added by Leszek Koltunski almost 2 years ago

Beginnings of support for 'sticker overrides' - possibility to override the color of an individual face of an individual cubit. Ultimately this will enable overriding with any bitmap; so far only a solid color.

Also, fixes for two crashers.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyCrazy3x3.java
26 26
import org.distorted.objectlib.helpers.ObjectFaceShape;
27 27
import org.distorted.objectlib.helpers.ObjectShape;
28 28
import org.distorted.objectlib.helpers.ObjectSignature;
29
import org.distorted.objectlib.helpers.ObjectStickerOverride;
29 30
import org.distorted.objectlib.main.Cubit;
30 31
import org.distorted.objectlib.main.InitData;
31 32
import org.distorted.objectlib.main.ObjectType;
......
99 100
      };
100 101
    }
101 102

  
103

  
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

  
106
  @Override
107
  public ObjectStickerOverride[] getStickerOverrides()
108
    {
109
    ObjectStickerOverride[] overrides = new ObjectStickerOverride[6];
110

  
111
    for(int i=0; i<6; i++)
112
      {
113
      int cubit = 20+i;
114
      float[] offset = getCubitRowOffset(cubit);
115
      float isX = offset[0]*offset[0]+offset[1]*offset[1]+offset[2]*offset[2];
116
      overrides[i] = new ObjectStickerOverride(cubit,6,isX==0 ? 0xff0f0000 : 0xff000000 );
117
      }
118

  
119
    return overrides;
120
    }
121

  
102 122
///////////////////////////////////////////////////////////////////////////////////////////////////
103 123

  
104 124
  @Override
......
581 601

  
582 602
  private ObjectShape getCenterShape(float D)
583 603
    {
604
    final float A = 0.1f;
605
    final float B = 0.2f;
606
    final float C = 0.55f+D;
607

  
584 608
    float[][] vertices = new float[][]
585 609
        {
586 610
            {-0.5f,-0.5f,-0.5f+D},
......
591 615
            {+0.5f,-0.5f,+0.5f+D},
592 616
            {+0.5f,+0.5f,-0.5f+D},
593 617
            {+0.5f,+0.5f,+0.5f+D},
618

  
619
            {   0,-A  , C},
620
            {   B,-A-B, C},
621
            { A+B,  -B, C},
622
            { A  ,   0, C},
623
            { A+B,   B, C},
624
            {   B, A+B, C},
625
            {   0, A  , C},
626
            {  -B, A+B, C},
627
            {-A-B,   B, C},
628
            {-A  ,   0, C},
629
            {-A-B,  -B, C},
630
            {  -B,-A-B, C},
594 631
        };
595 632

  
596 633
    int[][] indices = new int[][]
......
600 637
            {0,1,3,2},
601 638
            {3,7,6,2},
602 639
            {0,4,5,1},
603
            {4,0,2,6}
640
            {4,0,2,6},
641

  
642
            {8,9,10,11,12,13,14,15,16,17,18,19}
604 643
        };
605 644

  
606 645
    return new ObjectShape(vertices,indices);
......
758 797
      {
759 798
      float h1 = isInIconMode() ? 0.001f : 0.04f;
760 799
      float h2 = 0.001f;
761
      float[][] bands   = { {h1,45,0.3f,0.7f,5,0,0}, {h2,5,0.3f,0.2f,2,0,0} };
800
      float[][] bands   = { {h1,45,0.3f,0.7f,5,0,0}, {h2,5,0.3f,0.2f,5,0,0}, {h2,5,0.3f,0.2f,2,0,0} };
762 801
      final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
763 802
      int[] bandIndices = new int[NUM_BANDS];
764 803
      bandIndices[0] = bandIndices[1] = bandIndices[2] = 0;
765
      for(int i=3; i<NUM_BANDS; i++) bandIndices[i] = 1;
804
      bandIndices[3] = bandIndices[4] = bandIndices[5] = 1;
805
      for(int i=6; i<NUM_BANDS; i++) bandIndices[i] = 2;
766 806
      float[][] corners = { {0.02f,0.09f} };
767 807
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
768 808
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
......
794 834
      {
795 835
      float h1 = isInIconMode() ? 0.001f : 0.05f;
796 836
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
797
      int[] bandIndices = new int[] {0,1,1,1,1,1};
837
      int[] bandIndices = new int[] {0,1,1,1,1,1,1};
798 838
      float[][] corners = { {0.02f,0.09f} };
799 839
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
800
      int[] indices = new int[] {0,0,0,0,-1,-1,-1,-1};
840
      int[] indices = new int[] {0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
801 841
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
802 842
      }
803 843
    if( variant==3 )

Also available in: Unified diff