Project

General

Profile

« Previous | Next » 

Revision d6fa5f24

Added by Leszek Koltunski over 3 years ago

Square-1: progress

View differences:

src/main/java/org/distorted/objects/TwistySquare1.java
181 181
              {6,7,3,2}
182 182
          };
183 183

  
184
  // TODO
185 184
  private static final float[][] STICKERS = new float[][]
186 185
          {
187
              { -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f }
186
              { -0.5f, -0.26289170f, 0.5f, -0.26289170f, 0.5f, 0.26289170f, -0.5f, 0.26289170f }, // middle front
187
              { -0.5f, -0.16666667f, 0.5f, -0.16666667f, 0.5f, 0.16666667f, -0.5f, 0.16666667f }, // middle right
188
              { -0.5f, -0.45534182f, 0.5f, -0.45534182f, 0.5f, 0.45534182f, -0.5f, 0.45534182f }, // middle back
189
              { -0.20096192f, -0.25f, 0.20096192f, -0.25f, 0.0f, 0.5f },                          // edge top
190
              { -0.40192384f, -0.5f, 0.40192384f, -0.5f, 0.40192384f, 0.5f, -0.40192384f, 0.5f }, // edge face
191
              { -0.2637079f, -0.38185397f, 0.38185397f, -0.38185397f, 0.38185397f, 0.2637079f, -0.5f, 0.5f } // corner top
188 192
          };
189 193

  
190 194
  private static final int NUM_ST = STICKERS.length;
......
192 196
  private static final int[][] mStickerType = new int[][]
193 197
         {
194 198
           {  NUM_ST,NUM_ST,0,     1,     2,NUM_ST },
195
           {       4,NUM_ST,3,NUM_ST,NUM_ST,NUM_ST },
199
           {       3,NUM_ST,4,NUM_ST,NUM_ST,NUM_ST },
196 200
           {       5,NUM_ST,2,     2,NUM_ST,NUM_ST }
197 201
         };
198 202

  
......
215 219
           { 3, 0, 0, 4, 0, 0 },
216 220
           { 3, 0, 4, 1, 0, 0 },
217 221
           { 3, 0, 1, 5, 0, 0 },
218
           { 2, 0, 5, 0, 0, 0 },
219
           { 2, 0, 0, 4, 0, 0 },
220
           { 2, 0, 4, 1, 0, 0 },
221
           { 2, 0, 1, 5, 0, 0 },
222
           { 2, 0, 0, 5, 0, 0 },
223
           { 2, 0, 4, 0, 0, 0 },
224
           { 2, 0, 1, 4, 0, 0 },
225
           { 2, 0, 5, 1, 0, 0 },
222 226
         };
223 227

  
224 228
  private static MeshBase[] mMeshes;
......
257 261
        {
258 262
        float[][] bands= new float[][]
259 263
          {
260
             {0.06f,35,0.5f,0.7f,6,2,2},
261
             {0.03f,35,0.5f,0.7f,6,2,2},
264
             {0.04f,35,0.5f,0.7f,6,2,2},
265
             {0.02f,35,0.5f,0.7f,6,2,2},
262 266
             {0.00f, 0,1.0f,0.0f,2,0,0}
263 267
          };
264 268
        int[] bandIndexes   = new int[] { 2,2,1,1,0,2 };
265
        float[][] corners   = new float[][] { {0.06f,0.08f} };
269
        float[][] corners   = new float[][] { {0.04f,0.05f} };
266 270
        int[] cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
267 271
        float[][] centers   = new float[][] { { -0.75f, 0.0f, 0.0f} };
268 272
        int[] centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
......
335 339
    }
336 340

  
337 341
///////////////////////////////////////////////////////////////////////////////////////////////////
338
// TODO
339 342

  
340 343
  void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
341 344
    {
342
    float R = 0.10f;
343
    float S = 0.08f;
345
    int COLORS = FACE_COLORS.length;
346
    int stickerType = face/COLORS;
347
    float R,S;
348

  
349
    switch(stickerType)
350
      {
351
      case 0:  R = 0.06f; S = 0.05f; break;
352
      case 1:  R = 0.04f; S = 0.04f; break;
353
      case 2:  R = 0.10f; S = 0.08f; break;
354
      case 3:  R = 0.03f; S = 0.05f; break;
355
      case 4:  R = 0.11f; S = 0.08f; break;
356
      case 5:  R = 0.08f; S = 0.08f; break;
357
      default: R = 0.00f; S = 0.00f; break;
358
      }
344 359

  
345 360
    FactorySticker factory = FactorySticker.getInstance();
346
    factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[0], S, FACE_COLORS[face], R);
361
    factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[stickerType], S, FACE_COLORS[face%COLORS], R);
347 362
    }
348 363

  
349 364
///////////////////////////////////////////////////////////////////////////////////////////////////
......
420 435
    else if( cubit<10 ) type = 1;
421 436
    else                type = 2;
422 437

  
423
    return 0;//mStickerType[type][cubitface]*FACE_COLORS.length + mStickerColor[cubit][cubitface];
438
    return mStickerType[type][cubitface]*FACE_COLORS.length + mStickerColor[cubit][cubitface];
424 439
    }
425 440

  
426 441
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff