Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / main / TwistyJson.java @ 3ee1d662

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube 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
// Magic Cube 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 Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.objectlib.main;
21

    
22
import java.io.InputStream;
23

    
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26
import org.distorted.objectlib.helpers.ObjectFaceShape;
27
import org.distorted.objectlib.helpers.ObjectShape;
28
import org.distorted.objectlib.helpers.ObjectSticker;
29
import org.distorted.objectlib.helpers.ScrambleState;
30
import org.distorted.objectlib.json.JsonReader;
31

    
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33

    
34
public class TwistyJson extends TwistyObject
35
{
36
  private JsonReader mReader;
37

    
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

    
40
  public TwistyJson(InputStream jsonStream, int meshState, Static4D quat, Static3D move, float scale, InputStream meshStream)
41
    {
42
    super(jsonStream, meshState, quat, move, scale, meshStream);
43
    }
44

    
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

    
47
  public void setReader(JsonReader reader)
48
    {
49
    mReader = reader;
50
    }
51

    
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53

    
54
  public ScrambleState[] getScrambleStates()
55
    {
56
    return mReader.getScrambleStates();
57
    }
58

    
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

    
61
  public int[] getSolvedQuats(int cubit, int[] numLayers)
62
    {
63
    return mReader.getSolvedQuats(cubit);
64
    }
65

    
66
///////////////////////////////////////////////////////////////////////////////////////////////////
67

    
68
  public Static4D[] getQuats()
69
    {
70
    return mReader.getQuats();
71
    }
72

    
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74

    
75
  public int getSolvedFunctionIndex()
76
    {
77
    return mReader.getSolvedFunctionIndex();
78
    }
79

    
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81

    
82
  public float[][] getCuts(int[] numLayers)
83
    {
84
    return mReader.getCuts();
85
    }
86

    
87
///////////////////////////////////////////////////////////////////////////////////////////////////
88

    
89
  public boolean[][] getLayerRotatable(int[] numLayers)
90
    {
91
    return mReader.getLayerRotatable();
92
    }
93

    
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95

    
96
  public int getTouchControlType()
97
    {
98
    return mReader.getMovementType();
99
    }
100

    
101
///////////////////////////////////////////////////////////////////////////////////////////////////
102

    
103
  public int getTouchControlSplit()
104
    {
105
    return mReader.getMovementSplit();
106
    }
107

    
108
///////////////////////////////////////////////////////////////////////////////////////////////////
109

    
110
  public int[][][] getEnabled()
111
    {
112
    return mReader.getEnabled();
113
    }
114

    
115
///////////////////////////////////////////////////////////////////////////////////////////////////
116

    
117
  public float[] getDist3D(int[] numLayers)
118
    {
119
    return mReader.getDist3D();
120
    }
121

    
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123

    
124
  public int getNumCubitFaces()
125
    {
126
    return mReader.getNumCubitFaces();
127
    }
128

    
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130

    
131
  public float[][] getCubitPositions(int[] numLayers)
132
    {
133
    return mReader.getCubitPositions();
134
    }
135

    
136
///////////////////////////////////////////////////////////////////////////////////////////////////
137

    
138
  public ObjectShape getObjectShape(int variant)
139
    {
140
    return mReader.getObjectShape(variant);
141
    }
142

    
143
///////////////////////////////////////////////////////////////////////////////////////////////////
144

    
145
  public ObjectFaceShape getObjectFaceShape(int variant)
146
    {
147
    return mReader.getObjectFaceShape(variant);
148
    }
149

    
150
///////////////////////////////////////////////////////////////////////////////////////////////////
151

    
152
  public Static4D getQuat(int cubit, int[] numLayers)
153
    {
154
    return mReader.getQuat(cubit);
155
    }
156

    
157
///////////////////////////////////////////////////////////////////////////////////////////////////
158

    
159
  public int getNumCubitVariants(int[] numLayers)
160
    {
161
    return mReader.getNumCubitVariants();
162
    }
163

    
164
///////////////////////////////////////////////////////////////////////////////////////////////////
165

    
166
  public int getCubitVariant(int cubit, int[] numLayers)
167
    {
168
    return mReader.getCubitVariant(cubit);
169
    }
170

    
171
///////////////////////////////////////////////////////////////////////////////////////////////////
172

    
173
  public int getVariantFaceColor(int variant, int face)
174
    {
175
    return mReader.getVariantFaceColor(variant,face);
176
    }
177

    
178
///////////////////////////////////////////////////////////////////////////////////////////////////
179

    
180
  public int getCubitFaceColor(int cubit, int face, int[] numLayers)
181
    {
182
    return mReader.getCubitFaceColor(cubit,face);
183
    }
184

    
185
///////////////////////////////////////////////////////////////////////////////////////////////////
186

    
187
  public int getNumStickerTypes()
188
    {
189
    return mReader.getNumStickerTypes();
190
    }
191

    
192
///////////////////////////////////////////////////////////////////////////////////////////////////
193

    
194
  public ObjectSticker retSticker(int sticker)
195
    {
196
    return mReader.retSticker(sticker);
197
    }
198

    
199
///////////////////////////////////////////////////////////////////////////////////////////////////
200
// fake, this will never be called
201

    
202
  public float getStickerStroke()
203
    {
204
    return 0.0f;
205
    }
206

    
207
///////////////////////////////////////////////////////////////////////////////////////////////////
208
// fake, this will never be called
209

    
210
  public float getStickerRadius()
211
    {
212
    return 0.0f;
213
    }
214

    
215
///////////////////////////////////////////////////////////////////////////////////////////////////
216
// fake, this will never be called
217

    
218
  public float[][] getStickerAngles()
219
    {
220
    return null;
221
    }
222

    
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224
// PUBLIC API
225

    
226
  public Static3D[] getRotationAxis()
227
    {
228
    return mReader.getRotationAxis();
229
    }
230

    
231
///////////////////////////////////////////////////////////////////////////////////////////////////
232

    
233
  public int[] getBasicAngle()
234
    {
235
    return mReader.getBasicAngle();
236
    }
237

    
238
///////////////////////////////////////////////////////////////////////////////////////////////////
239

    
240
  public ObjectType intGetObjectType(int[] numLayers)
241
    {
242
    return mReader.intGetObjectType();
243
    }
244

    
245
///////////////////////////////////////////////////////////////////////////////////////////////////
246

    
247
  public String getObjectName()
248
    {
249
    return mReader.getObjectName();
250
    }
251

    
252
///////////////////////////////////////////////////////////////////////////////////////////////////
253

    
254
  public String getInventor()
255
    {
256
    return mReader.getInventor();
257
    }
258

    
259
///////////////////////////////////////////////////////////////////////////////////////////////////
260

    
261
  public int getYearOfInvention()
262
    {
263
    return mReader.getYearOfInvention();
264
    }
265

    
266
///////////////////////////////////////////////////////////////////////////////////////////////////
267

    
268
  public int getComplexity()
269
    {
270
    return mReader.getComplexity();
271
    }
272

    
273
///////////////////////////////////////////////////////////////////////////////////////////////////
274

    
275
  public int getNumFaces()
276
    {
277
    return mReader.getNumFaces();
278
    }
279

    
280
///////////////////////////////////////////////////////////////////////////////////////////////////
281

    
282
  public int getNumFaceColors()
283
    {
284
    return mReader.getNumFaceColors();
285
    }
286

    
287
///////////////////////////////////////////////////////////////////////////////////////////////////
288

    
289
  public int getScrambleType()
290
    {
291
    return mReader.getScrambleType();
292
    }
293

    
294
///////////////////////////////////////////////////////////////////////////////////////////////////
295

    
296
  public int getColor(int face)
297
    {
298
    return mReader.getColor(face);
299
    }
300

    
301
///////////////////////////////////////////////////////////////////////////////////////////////////
302

    
303
  public boolean shouldResetTextureMaps()
304
    {
305
    return mReader.shouldResetTextureMaps();
306
    }
307

    
308
///////////////////////////////////////////////////////////////////////////////////////////////////
309

    
310
  public String getShortName()
311
    {
312
    return mReader.getShortName();
313
    }
314

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

    
317
  public int getFOV()
318
    {
319
    switch( mReader.getNumFaces() )
320
      {
321
      case  4: return ShapeTetrahedron.FOV;
322
      case  6: return ShapeHexahedron.FOV;
323
      case  8: return ShapeOctahedron.FOV;
324
      case 12: return ShapeDodecahedron.FOV;
325
      }
326

    
327
    return 0;
328
    }
329

    
330
///////////////////////////////////////////////////////////////////////////////////////////////////
331

    
332
  public float getScreenRatio()
333
    {
334
    switch( mReader.getNumFaces() )
335
      {
336
      case  4: return ShapeTetrahedron.RATIO;
337
      case  6: return ShapeHexahedron.RATIO;
338
      case  8: return ShapeOctahedron.RATIO;
339
      case 12: return ShapeDodecahedron.RATIO;
340
      }
341

    
342
    return 0.0f;
343
    }
344
}
(10-10/13)