Project

General

Profile

« Previous | Next » 

Revision deaf067b

Added by Leszek Koltunski 12 months ago

remember the rotation factors in the JSONs.

View differences:

src/main/java/org/distorted/objectlib/json/JsonReader.java
47 47
  private int mNumStickerTypes;
48 48
  private float[][] mCuts;
49 49
  private boolean[][] mLayerRotatable;
50
  private float[][] mRotationFactor;
50 51
  private int mMovementType, mMovementSplit;
51 52
  private int[][][] mEnabled;
52 53
  private float[] mDist3D;
......
397 398
    mAxis           = new Static3D[numAxis];
398 399
    mCuts           = new float[numAxis][];
399 400
    mLayerRotatable = new boolean[numAxis][];
401
    mRotationFactor = new float[numAxis][];
400 402
    mNumLayers      = new int[numAxis];
401 403

  
402 404
    for(int i=0; i<numAxis; i++)
......
424 426
      mLayerRotatable[i] = new boolean[numRota];
425 427
      for(int j=0; j<numRota; j++) mLayerRotatable[i][j] = jsonRota.getBoolean(j);
426 428

  
429
      JSONArray jsonFactor = jsonAx.optJSONArray("factor");
430

  
431
      if( jsonFactor!=null )
432
        {
433
        int numFactor = jsonFactor.length();
434
        mRotationFactor[i] = new float[numFactor];
435
        for(int j=0; j<numFactor; j++) mRotationFactor[i][j] = (float)jsonFactor.getDouble(j);
436
        }
437
      else
438
        {
439
        mRotationFactor[i] = new float[numRota];
440
        for(int j=0; j<numRota; j++) mRotationFactor[i][j] = 1.0f;
441
        }
442

  
427 443
      mNumLayers[i] = numRota;
428 444
      }
429 445
    }
......
978 994
    return shapes.length>face ? shapes[face] : -1;
979 995
    }
980 996

  
997
///////////////////////////////////////////////////////////////////////////////////////////////////
998

  
999
  public float[][] returnRotationFactor()
1000
    {
1001
    return mRotationFactor;
1002
    }
1003

  
981 1004
///////////////////////////////////////////////////////////////////////////////////////////////////
982 1005

  
983 1006
  public int[] getCubitTypes()

Also available in: Unified diff