Project

General

Profile

« Previous | Next » 

Revision 68b5f9c5

Added by Leszek Koltunski over 3 years ago

Progress making the Diamond class support any size.

View differences:

src/main/java/org/distorted/objects/TwistyDiamond.java
90 90
             {4, 8}
91 91
         };
92 92

  
93
  private static final int[] mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
94

  
93 95
  private static MeshBase mOctaMesh, mTetraMesh;
94 96

  
95 97
///////////////////////////////////////////////////////////////////////////////////////////////////
......
146 148
    else
147 149
      {
148 150
      float[] cuts = new float[numLayers-1];
149
      float dist = SQ6*0.666f;
151
      float dist = SQ6*0.666f*DIST;
150 152
      float cut  = 0.5f*dist*(2-numLayers);
151 153

  
152 154
      for(int i=0; i<numLayers-1; i++)
......
306 308
    }
307 309

  
308 310
///////////////////////////////////////////////////////////////////////////////////////////////////
309
// TODO:
310 311

  
311 312
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
312 313
    {
313
    switch(tetra)
314
    for(int i=numLayers-1; i>0; i--)
314 315
      {
315
      case 0 : return 1;
316
      case 1 : return 2;
317
      case 2 : return 3;
318
      case 3 : return 0;
319
      case 4 : return 5;
320
      case 5 : return 6;
321
      case 6 : return 7;
322
      case 7 : return 4;
323
      default: return 8;
316
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
317
      tetra -= 8*i;
324 318
      }
319

  
320
    return -1;
325 321
    }
326 322

  
327 323
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyObject.java
150 150
    NUM_CUBIT_FACES = getNumCubitFaces();
151 151
    NUM_TEXTURES = getNumStickerTypes(mNumLayers)*NUM_FACES;
152 152
    CUTS = getCuts(mNumLayers);
153
    NUM_CUTS = CUTS.length;
153
    NUM_CUTS = CUTS== null ? 0: CUTS.length;
154 154

  
155 155
    mQuatDebug = new int[NUM_CUBITS];
156 156

  

Also available in: Unified diff