Project

General

Profile

Download (26.1 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / json / JsonReader.java @ a72cd106

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.objectlib.json;
21

    
22
import java.io.BufferedReader;
23
import java.io.IOException;
24
import java.io.InputStream;
25
import java.io.InputStreamReader;
26
import java.nio.charset.StandardCharsets;
27

    
28
import org.distorted.objectlib.touchcontrol.TouchControl;
29
import org.json.JSONArray;
30
import org.json.JSONException;
31
import org.json.JSONObject;
32

    
33
import org.distorted.library.type.Static3D;
34
import org.distorted.library.type.Static4D;
35

    
36
import org.distorted.objectlib.helpers.ObjectShape;
37
import org.distorted.objectlib.helpers.ObjectSticker;
38
import org.distorted.objectlib.helpers.ScrambleState;
39
import org.distorted.objectlib.main.ObjectType;
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

    
43
public class JsonReader
44
{
45
  private ScrambleState[] mStates;
46
  private int[][] mSolvedQuats;
47
  private Static4D[] mQuats;
48
  private int mSolvedFuncIndex;
49
  private int mNumStickerTypes;
50
  private float[][] mCuts;
51
  private boolean[][] mLayerRotatable;
52
  private int mMovementType, mMovementSplit;
53
  private int[][][] mEnabled;
54
  private float[] mDist3D;
55
  private int mNumCubitFaces, mNumFaces, mNumFaceColors;
56
  private float[][] mPositions;
57
  private ObjectShape[] mShapes;
58
  private Static4D[] mCubitQuats;
59
  private int mNumCubitVariants;
60
  private int[] mCubitVariant;
61
  private int[][] mVariantFaceColor, mCubitFaceColor;
62
  private ObjectSticker[] mObjectSticker;
63
  private Static3D[] mAxis;
64
  private int[] mBasicAngle;
65
  private String mLongName, mShortName, mInventor;
66
  private int mYearOfInvention, mComplexity;
67
  private int[] mNumLayers;
68
  private float mSize;
69
  private int mScrambleType, mNumScrambles;
70
  private int[] mColor;
71
  private ObjectType mType;
72
  private boolean mResetMaps;
73

    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75

    
76
  private void parseMetadata(JSONObject object) throws JSONException
77
    {
78
    mLongName        = object.getString("longname");
79
    mShortName       = object.getString("shortname");
80
    mInventor        = object.getString("inventor");
81
    mYearOfInvention = object.getInt("year");
82
    mComplexity      = object.getInt("complexity");
83
    mSize            = (float)object.getDouble("size");
84
    mSolvedFuncIndex = object.getInt("solved_func");
85
    mNumScrambles    = object.getInt("scrambles");
86
    mResetMaps       = object.getBoolean("resetmaps");
87
    mNumFaces        = object.getInt("num_faces");
88

    
89
    int ordinal = ObjectType.getOrdinal(mShortName);
90
    mType = ordinal>=0 ? ObjectType.getObject(ordinal) : null;
91
    }
92

    
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

    
95
  private void parseCubits(JSONArray object) throws JSONException
96
    {
97
    int numCubits = object.length();
98

    
99
    mCubitQuats     = new Static4D[numCubits];
100
    mCubitVariant   = new int[numCubits];
101
    mPositions      = new float[numCubits][];
102
    mCubitFaceColor = new int[numCubits][];
103
    mSolvedQuats    = new int[numCubits][];
104

    
105
    for(int i=0; i<numCubits; i++)
106
      {
107
      JSONObject jsonCubit = object.getJSONObject(i);
108

    
109
      float qx = (float)jsonCubit.getDouble("qx");
110
      float qy = (float)jsonCubit.getDouble("qy");
111
      float qz = (float)jsonCubit.getDouble("qz");
112
      float qw = (float)jsonCubit.getDouble("qw");
113

    
114
      mCubitQuats[i] = new Static4D(qx,qy,qz,qw);
115
      mCubitVariant[i] = jsonCubit.getInt("variant");
116

    
117
      JSONArray jsonCenter = jsonCubit.getJSONArray("centers");
118
      int numCenter = jsonCenter.length();
119
      mPositions[i] = new float[numCenter];
120
      for(int j=0; j<numCenter; j++) mPositions[i][j] = (float)jsonCenter.getDouble(j);
121

    
122
      JSONArray jsonColor  = jsonCubit.getJSONArray("colors");
123
      int numColor = jsonColor.length();
124
      mCubitFaceColor[i] = new int[numColor];
125
      for(int j=0; j<numColor; j++) mCubitFaceColor[i][j] = jsonColor.getInt(j);
126

    
127
      try
128
        {
129
        JSONArray jsonSolved = jsonCubit.getJSONArray("solvedQuats");
130
        int numSolved = jsonSolved.length();
131
        mSolvedQuats[i] = new int[numSolved];
132
        for(int j=0; j<numSolved; j++) mSolvedQuats[i][j] = jsonSolved.getInt(j);
133
        }
134
      catch( JSONException ex )
135
        {
136
        // ignore
137
        }
138
      }
139
    }
140

    
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142

    
143
  private void parseShapes(JSONArray object) throws JSONException
144
    {
145
    mNumCubitVariants = object.length();
146
    mVariantFaceColor = new int[mNumCubitVariants][];
147
    mShapes = new ObjectShape[mNumCubitVariants];
148
    float[][][] verts     = new float[mNumCubitVariants][][];
149
    float[][][] bands     = new float[mNumCubitVariants][][];
150
    float[][][] corners   = new float[mNumCubitVariants][][];
151
    float[][][] centers   = new float[mNumCubitVariants][][];
152
    float[][] convexity   = new float[mNumCubitVariants][];
153
    int[][] cornerIndices = new int[mNumCubitVariants][];
154
    int[][] centerIndices = new int[mNumCubitVariants][];
155
    int[][] bandIndices   = new int[mNumCubitVariants][];
156
    int[][][] vertIndices = new int[mNumCubitVariants][][];
157

    
158
    mNumCubitFaces = -1;
159

    
160
    for(int i=0; i<mNumCubitVariants; i++)
161
      {
162
      JSONObject jsonShape = object.getJSONObject(i);
163

    
164
      ////// vertices /////////////////////////////////////////////////
165
      JSONArray jsonVertices= jsonShape.getJSONArray("vertices");
166
      int numVertices = jsonVertices.length();
167
      verts[i] = new float[numVertices][3];
168
      cornerIndices[i] = new int[numVertices];
169
      centerIndices[i] = new int[numVertices];
170

    
171
      for(int j=0; j<numVertices; j++)
172
        {
173
        JSONObject vert = jsonVertices.getJSONObject(j);
174
        verts[i][j][0] = (float)vert.getDouble("x");
175
        verts[i][j][1] = (float)vert.getDouble("y");
176
        verts[i][j][2] = (float)vert.getDouble("z");
177
        cornerIndices[i][j] = vert.getInt("cornerIndex");
178
        centerIndices[i][j] = vert.getInt("centerIndex");
179
        }
180

    
181
      ////// faces ////////////////////////////////////////////////////
182
      JSONArray jsonFaces= jsonShape.getJSONArray("faces");
183
      int numFaces = jsonFaces.length();
184
      mVariantFaceColor[i] = new int[numFaces];
185
      bandIndices[i] = new int[numFaces];
186
      vertIndices[i] = new int[numFaces][];
187

    
188
      if( mNumCubitFaces<numFaces ) mNumCubitFaces=numFaces;
189

    
190
      for(int j=0; j<numFaces; j++)
191
        {
192
        JSONObject jsonFace = jsonFaces.getJSONObject(j);
193
        mVariantFaceColor[i][j] = jsonFace.getInt("sticker");
194
        bandIndices[i][j] = jsonFace.getInt("bandIndex");
195
        JSONArray vertices = jsonFace.getJSONArray("vertexIndices");
196
        int numV = vertices.length();
197
        vertIndices[i][j] = new int[numV];
198
        for(int k=0; k<numV; k++) vertIndices[i][j][k] = vertices.getInt(k);
199
        }
200

    
201
      ////// bands ////////////////////////////////////////////////////
202
      JSONArray jsonBands= jsonShape.getJSONArray("bands");
203
      int numBands = jsonBands.length();
204
      bands[i] = new float[numBands][7];
205

    
206
      for(int j=0; j<numBands; j++)
207
        {
208
        JSONObject jsonBand = jsonBands.getJSONObject(j);
209

    
210
        bands[i][j][0] = (float)jsonBand.getDouble("height");
211
        bands[i][j][1] = (float)jsonBand.getDouble("angle");
212
        bands[i][j][2] = (float)jsonBand.getDouble("distanceToCenter");
213
        bands[i][j][3] = (float)jsonBand.getDouble("distanceToFlat");
214
        bands[i][j][4] = (float)jsonBand.getDouble("numOfBands");
215
        bands[i][j][5] = (float)jsonBand.getDouble("extraI");
216
        bands[i][j][6] = (float)jsonBand.getDouble("extraJ");
217
        }
218

    
219
      ////// cornerPush ///////////////////////////////////////////////
220
      JSONArray jsonCornerPush= jsonShape.optJSONArray("cornerPush");
221

    
222
      if( jsonCornerPush!=null )
223
        {
224
        int numCornerP = jsonCornerPush.length();
225
        corners[i] = new float[numCornerP][2];
226

    
227
        for(int j=0; j<numCornerP; j++)
228
          {
229
          JSONObject jsonC = jsonCornerPush.getJSONObject(j);
230
          corners[i][j][0] = (float)jsonC.getDouble("strength");
231
          corners[i][j][1] = (float)jsonC.getDouble("radius");
232
          }
233
        }
234

    
235
      ////// centerPush ///////////////////////////////////////////////
236
      JSONArray jsonCenterPush= jsonShape.optJSONArray("centerPush");
237

    
238
      if( jsonCenterPush!=null )
239
        {
240
        int numCenterP = jsonCenterPush.length();
241
        centers[i] = new float[numCenterP][3];
242

    
243
        for(int j=0; j<numCenterP; j++)
244
          {
245
          JSONObject jsonC = jsonCenterPush.getJSONObject(j);
246
          centers[i][j][0] = (float)jsonC.getDouble("x");
247
          centers[i][j][1] = (float)jsonC.getDouble("y");
248
          centers[i][j][2] = (float)jsonC.getDouble("z");
249
          }
250
        }
251

    
252
      ////// convexity ///////////////////////////////////////////////
253
      JSONObject jsonConvexity = jsonShape.optJSONObject("convexity");
254

    
255
      if( jsonConvexity!=null )
256
        {
257
        convexity[i] = new float[3];
258
        convexity[i][0] = (float)jsonConvexity.getDouble("x");
259
        convexity[i][1] = (float)jsonConvexity.getDouble("y");
260
        convexity[i][2] = (float)jsonConvexity.getDouble("z");
261
        }
262
      }
263

    
264
    for(int i=0; i<mNumCubitVariants; i++)
265
      {
266
      mShapes[i] = new ObjectShape(verts[i],vertIndices[i],bands[i],bandIndices[i],corners[i],
267
                                   cornerIndices[i],centers[i],centerIndices[i],mNumCubitFaces, convexity[i]);
268
      }
269
    }
270

    
271
///////////////////////////////////////////////////////////////////////////////////////////////////
272

    
273
  private void parseStickers(JSONArray object) throws JSONException
274
    {
275
    mNumStickerTypes = object.length();
276
    mObjectSticker = new ObjectSticker[mNumStickerTypes];
277

    
278
    for(int i=0; i<mNumStickerTypes; i++)
279
      {
280
      JSONObject sticker = object.getJSONObject(i);
281
      float stroke = (float)sticker.getDouble("stroke");
282
      JSONArray vertices = sticker.getJSONArray("vertices");
283
      int numVertices = vertices.length();
284

    
285
      float[] coords     = new float[2*numVertices];
286
      float[] curvatures = new float[numVertices];
287
      float[] radii      = new float[numVertices];
288

    
289
      for(int j=0; j<numVertices; j++)
290
        {
291
        JSONObject vertex = vertices.getJSONObject(j);
292

    
293
        coords[2*j  ] = (float)vertex.getDouble("x");
294
        coords[2*j+1] = (float)vertex.getDouble("y");
295
        curvatures[j] = (float)vertex.getDouble("angle");
296
        radii[j]      = (float)vertex.getDouble("radius");
297
        }
298

    
299
      mObjectSticker[i] = new ObjectSticker(coords,curvatures,radii,stroke);
300
      }
301
    }
302

    
303
///////////////////////////////////////////////////////////////////////////////////////////////////
304

    
305
  private void parseMesh(JSONObject object) throws JSONException
306
    {
307
    JSONArray cubits   = object.getJSONArray("cubits");
308
    parseCubits(cubits);
309
    JSONArray shapes   = object.getJSONArray("shapes");
310
    parseShapes(shapes);
311
    JSONArray stickers = object.getJSONArray("stickers");
312
    parseStickers(stickers);
313
    }
314

    
315
///////////////////////////////////////////////////////////////////////////////////////////////////
316

    
317
  private void parseAxis(JSONArray object) throws JSONException
318
    {
319
    int numAxis = object.length();
320

    
321
    mBasicAngle     = new int[numAxis];
322
    mAxis           = new Static3D[numAxis];
323
    mCuts           = new float[numAxis][];
324
    mLayerRotatable = new boolean[numAxis][];
325
    mNumLayers      = new int[numAxis];
326

    
327
    for(int i=0; i<numAxis; i++)
328
      {
329
      JSONObject jsonAx = object.getJSONObject(i);
330

    
331
      mBasicAngle[i] = jsonAx.getInt("basicAngle");
332

    
333
      float x = (float)jsonAx.getDouble("x");
334
      float y = (float)jsonAx.getDouble("y");
335
      float z = (float)jsonAx.getDouble("z");
336

    
337
      mAxis[i] = new Static3D(x,y,z);
338

    
339
      JSONArray jsonCuts = jsonAx.getJSONArray("cuts");
340
      int numCuts = jsonCuts.length();
341
      mCuts[i] = new float[numCuts];
342
      for(int j=0; j<numCuts; j++) mCuts[i][j] = (float)jsonCuts.getDouble(j);
343

    
344
      JSONArray jsonRota = jsonAx.getJSONArray("rotatable");
345
      int numRota = jsonRota.length();
346
      mLayerRotatable[i] = new boolean[numRota];
347
      for(int j=0; j<numRota; j++) mLayerRotatable[i][j] = jsonRota.getBoolean(j);
348

    
349
      mNumLayers[i] = numRota;
350
      }
351
    }
352

    
353
///////////////////////////////////////////////////////////////////////////////////////////////////
354

    
355
  private void parseQuats(JSONArray object) throws JSONException
356
    {
357
    int numQuats = object.length();
358
    mQuats = new Static4D[numQuats];
359

    
360
    for(int i=0; i<numQuats; i++)
361
      {
362
      JSONObject jsonQuat = object.getJSONObject(i);
363

    
364
      float x = (float)jsonQuat.getDouble("x");
365
      float y = (float)jsonQuat.getDouble("y");
366
      float z = (float)jsonQuat.getDouble("z");
367
      float w = (float)jsonQuat.getDouble("w");
368

    
369
      mQuats[i] = new Static4D(x,y,z,w);
370
      }
371
    }
372

    
373
///////////////////////////////////////////////////////////////////////////////////////////////////
374

    
375
  private void parseScrambling(JSONObject object) throws JSONException
376
    {
377
    mScrambleType = object.getInt("scrambleType");
378

    
379
    if( mScrambleType==0 )
380
      {
381
      JSONArray jsonStates = object.getJSONArray("scrambleStates");
382
      int numStates = jsonStates.length();
383
      mStates = new ScrambleState[numStates];
384

    
385
      for(int i=0; i<numStates; i++)
386
        {
387
        JSONArray jsonState = jsonStates.getJSONArray(i);
388
        int numAxis = jsonState.length();
389
        int[][] scramblingData = new int[numAxis][];
390

    
391
        for(int j=0; j<numAxis; j++)
392
          {
393
          JSONArray jsonData = jsonState.getJSONArray(j);
394
          int numData = jsonData.length();
395
          scramblingData[j] = new int[numData];
396
          for(int k=0; k<numData; k++) scramblingData[j][k] = jsonData.getInt(k);
397
          }
398

    
399
        mStates[i] = new ScrambleState(scramblingData);
400
        }
401
      }
402
    }
403

    
404
///////////////////////////////////////////////////////////////////////////////////////////////////
405

    
406
  private void parseTouchcontrol(JSONObject object) throws JSONException
407
    {
408
    mMovementType = object.getInt("movementType");
409
    mMovementSplit= object.getInt("movementSplit");
410

    
411
    JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
412
    int numFace = jsonEnabled.length();
413

    
414
    mEnabled = new int[numFace][][];
415

    
416
    for(int i=0; i<numFace; i++)
417
      {
418
      JSONArray jsonSection = jsonEnabled.getJSONArray(i);
419
      int numSection = jsonSection.length();
420
      mEnabled[i] = new int[numSection][];
421

    
422
      for(int j=0; j<numSection; j++)
423
        {
424
        JSONArray jsonAx = jsonSection.getJSONArray(j);
425
        int numAxis = jsonAx.length();
426
        mEnabled[i][j] = new int[numAxis];
427
        for(int k=0; k<numAxis; k++) mEnabled[i][j][k] = jsonAx.getInt(k);
428
        }
429
      }
430

    
431
    try
432
      {
433
      JSONArray jsonDist = object.getJSONArray("dist3D");
434
      int num = jsonDist.length();
435
      mDist3D = new float[num];
436
      for(int j=0; j<num; j++) mDist3D[j] = (float)jsonDist.getDouble(j);
437
      }
438
    catch( JSONException ex )
439
      {
440
      // ignore, the object does not have a 'dist3D' which is possible.
441
      }
442
    }
443

    
444
///////////////////////////////////////////////////////////////////////////////////////////////////
445

    
446
  private void parseColors(JSONArray object) throws JSONException
447
    {
448
    mNumFaceColors = object.length();
449
    mColor = new int[mNumFaceColors];
450
    for(int i=0; i<mNumFaceColors; i++) mColor[i] = object.getInt(i);
451
    }
452

    
453
///////////////////////////////////////////////////////////////////////////////////////////////////
454

    
455
  private void parseVersion1(JSONObject object) throws JSONException
456
    {
457
    JSONObject metadata    = object.getJSONObject("metadata");
458
    parseMetadata(metadata);
459
    JSONObject mesh        = object.getJSONObject("mesh");
460
    parseMesh(mesh);
461
    JSONArray axis         = object.getJSONArray("axis");
462
    parseAxis(axis);
463
    JSONArray quats        = object.getJSONArray("quats");
464
    parseQuats(quats);
465
    JSONObject scrambling  = object.getJSONObject("scrambling");
466
    parseScrambling(scrambling);
467
    JSONObject touchcontrol= object.getJSONObject("touchcontrol");
468
    parseTouchcontrol(touchcontrol);
469
    JSONArray colors       = object.getJSONArray("colors");
470
    parseColors(colors);
471
    }
472

    
473
///////////////////////////////////////////////////////////////////////////////////////////////////
474

    
475
  private void parseVersion1Metadata(JSONObject object) throws JSONException
476
    {
477
    JSONObject metadata = object.getJSONObject("metadata");
478
    parseMetadata(metadata);
479
    }
480

    
481
///////////////////////////////////////////////////////////////////////////////////////////////////
482

    
483
  public void parseJsonFile(InputStream jsonStream)
484
    {
485
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
486

    
487
    try
488
      {
489
      StringBuilder contents = new StringBuilder();
490
      String tmp;
491
      while( (tmp = br.readLine()) != null) contents.append(tmp);
492
      br.close();
493
      jsonStream.close();
494

    
495
      JSONObject object = new JSONObject(contents.toString());
496
      int major = object.getInt("major");
497

    
498
      if( major==1 )
499
        {
500
        parseVersion1(object);
501
        }
502
      else
503
        {
504
        android.util.Log.e("readJsonFile", "Unknown version "+major);
505
        }
506
      }
507
    catch(IOException e)
508
      {
509
      android.util.Log.e("readJsonFile", "Error reading JSON file: "+e.toString());
510
      }
511
    catch( JSONException e )
512
      {
513
      android.util.Log.e("parseJsonFile", "Error parsing JSON file: "+e.toString());
514
      }
515
    }
516

    
517
///////////////////////////////////////////////////////////////////////////////////////////////////
518

    
519
  public void parseJsonFileMetadata(InputStream jsonStream)
520
    {
521
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
522

    
523
    try
524
      {
525
      StringBuilder contents = new StringBuilder();
526
      String tmp;
527
      while( (tmp = br.readLine()) != null) contents.append(tmp);
528
      br.close();
529
      jsonStream.close();
530

    
531
      JSONObject object = new JSONObject(contents.toString());
532
      int major = object.getInt("major");
533

    
534
      if( major==1 )
535
        {
536
        parseVersion1Metadata(object);
537
        }
538
      else
539
        {
540
        android.util.Log.e("readJsonFileQuick", "Unknown version "+major);
541
        }
542
      }
543
    catch(IOException e)
544
      {
545
      android.util.Log.e("readJsonFileQuick", "Error reading JSON file: "+e.toString());
546
      }
547
    catch( JSONException e )
548
      {
549
      android.util.Log.e("parseJsonFileQuick", "Error parsing JSON file: "+e.toString());
550
      }
551
    }
552

    
553
///////////////////////////////////////////////////////////////////////////////////////////////////
554

    
555
  public ScrambleState[] getScrambleStates()
556
    {
557
    return mStates;
558
    }
559

    
560
///////////////////////////////////////////////////////////////////////////////////////////////////
561

    
562
  public int[] getSolvedQuats(int cubit)
563
    {
564
    return mSolvedQuats[cubit];
565
    }
566

    
567
///////////////////////////////////////////////////////////////////////////////////////////////////
568

    
569
  public Static4D[] getQuats()
570
    {
571
    return mQuats;
572
    }
573

    
574
///////////////////////////////////////////////////////////////////////////////////////////////////
575

    
576
  public int getSolvedFunctionIndex()
577
    {
578
    return mSolvedFuncIndex;
579
    }
580

    
581
///////////////////////////////////////////////////////////////////////////////////////////////////
582

    
583
  public int getNumStickerTypes()
584
    {
585
    return mNumStickerTypes;
586
    }
587

    
588
///////////////////////////////////////////////////////////////////////////////////////////////////
589

    
590
  public float[][] getCuts()
591
    {
592
    return mCuts;
593
    }
594

    
595
///////////////////////////////////////////////////////////////////////////////////////////////////
596

    
597
  public boolean[][] getLayerRotatable()
598
    {
599
    return mLayerRotatable;
600
    }
601

    
602
///////////////////////////////////////////////////////////////////////////////////////////////////
603

    
604
  public int getMovementType()
605
    {
606
    return mMovementType;
607
    }
608

    
609
///////////////////////////////////////////////////////////////////////////////////////////////////
610

    
611
  public int getMovementSplit()
612
    {
613
    return mMovementSplit;
614
    }
615

    
616
///////////////////////////////////////////////////////////////////////////////////////////////////
617

    
618
  public int[][][] getEnabled()
619
    {
620
    return mEnabled;
621
    }
622

    
623
///////////////////////////////////////////////////////////////////////////////////////////////////
624

    
625
  public float[] getDist3D()
626
    {
627
    return mDist3D;
628
    }
629

    
630
///////////////////////////////////////////////////////////////////////////////////////////////////
631

    
632
  public int getNumCubitFaces()
633
    {
634
    return mNumCubitFaces;
635
    }
636

    
637
///////////////////////////////////////////////////////////////////////////////////////////////////
638

    
639
  public float[][] getCubitPositions()
640
    {
641
    return mPositions;
642
    }
643

    
644
///////////////////////////////////////////////////////////////////////////////////////////////////
645

    
646
  public ObjectShape getObjectShape(int variant)
647
    {
648
    return mShapes[variant];
649
    }
650

    
651
///////////////////////////////////////////////////////////////////////////////////////////////////
652

    
653
  public Static4D getQuat(int cubit)
654
    {
655
    return mCubitQuats[cubit];
656
    }
657

    
658
///////////////////////////////////////////////////////////////////////////////////////////////////
659

    
660
  public int getNumCubitVariants()
661
    {
662
    return mNumCubitVariants;
663
    }
664

    
665
///////////////////////////////////////////////////////////////////////////////////////////////////
666

    
667
  public int getCubitVariant(int cubit)
668
    {
669
    return mCubitVariant[cubit];
670
    }
671

    
672
///////////////////////////////////////////////////////////////////////////////////////////////////
673

    
674
  public int getVariantFaceColor(int variant, int face)
675
    {
676
    int[] colors = mVariantFaceColor[variant];
677
    return colors.length>face ? colors[face] : -1;
678
    }
679

    
680
///////////////////////////////////////////////////////////////////////////////////////////////////
681

    
682
  public int getCubitFaceColor(int cubit, int face)
683
    {
684
    return mCubitFaceColor[cubit][face];
685
    }
686

    
687
///////////////////////////////////////////////////////////////////////////////////////////////////
688

    
689
  public int getNumScrambles()
690
    {
691
    return mNumScrambles;
692
    }
693

    
694
///////////////////////////////////////////////////////////////////////////////////////////////////
695

    
696
  public ObjectSticker retSticker(int sticker)
697
    {
698
    return mObjectSticker[sticker];
699
    }
700

    
701
///////////////////////////////////////////////////////////////////////////////////////////////////
702

    
703
  public Static3D[] getRotationAxis()
704
    {
705
    return mAxis;
706
    }
707

    
708
///////////////////////////////////////////////////////////////////////////////////////////////////
709

    
710
  public int[] getBasicAngle()
711
    {
712
    return mBasicAngle;
713
    }
714

    
715
///////////////////////////////////////////////////////////////////////////////////////////////////
716

    
717
  public ObjectType intGetObjectType()
718
    {
719
    return mType;
720
    }
721

    
722
///////////////////////////////////////////////////////////////////////////////////////////////////
723

    
724
  public String getObjectName()
725
    {
726
    return mLongName;
727
    }
728

    
729
///////////////////////////////////////////////////////////////////////////////////////////////////
730

    
731
  public String getShortName()
732
    {
733
    return mShortName;
734
    }
735

    
736
///////////////////////////////////////////////////////////////////////////////////////////////////
737

    
738
  public String getInventor()
739
    {
740
    return mInventor;
741
    }
742

    
743
///////////////////////////////////////////////////////////////////////////////////////////////////
744

    
745
  public int getYearOfInvention()
746
    {
747
    return mYearOfInvention;
748
    }
749

    
750
///////////////////////////////////////////////////////////////////////////////////////////////////
751

    
752
  public int getComplexity()
753
    {
754
    return mComplexity;
755
    }
756

    
757
///////////////////////////////////////////////////////////////////////////////////////////////////
758

    
759
  public int getNumFaces()
760
    {
761
    return mNumFaces;
762
    }
763

    
764
///////////////////////////////////////////////////////////////////////////////////////////////////
765

    
766
  public int getNumFaceColors()
767
    {
768
    return mNumFaceColors;
769
    }
770

    
771
///////////////////////////////////////////////////////////////////////////////////////////////////
772

    
773
  public int[] getNumLayers()
774
    {
775
    return mNumLayers;
776
    }
777

    
778
///////////////////////////////////////////////////////////////////////////////////////////////////
779

    
780
  public float getSize()
781
    {
782
    return mSize;
783
    }
784

    
785
///////////////////////////////////////////////////////////////////////////////////////////////////
786

    
787
  public int getScrambleType()
788
    {
789
    return mScrambleType;
790
    }
791

    
792
///////////////////////////////////////////////////////////////////////////////////////////////////
793

    
794
  public int getColor(int face)
795
    {
796
    return mColor[face];
797
    }
798

    
799
///////////////////////////////////////////////////////////////////////////////////////////////////
800

    
801
  public boolean shouldResetTextureMaps()
802
    {
803
    return mResetMaps;
804
    }
805
}
(1-1/2)