Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / main / TwistyJson.java @ 4c9ca251

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
// this is only needed when computing sticker colors which here we do via the retSticker() method.
124

    
125
  public Static3D[] getFaceAxis()
126
    {
127
    return null;
128
    }
129

    
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

    
132
  public int getNumCubitFaces()
133
    {
134
    return mReader.getNumCubitFaces();
135
    }
136

    
137
///////////////////////////////////////////////////////////////////////////////////////////////////
138

    
139
  public float[][] getCubitPositions(int[] numLayers)
140
    {
141
    return mReader.getCubitPositions();
142
    }
143

    
144
///////////////////////////////////////////////////////////////////////////////////////////////////
145

    
146
  public ObjectShape getObjectShape(int variant)
147
    {
148
    return mReader.getObjectShape(variant);
149
    }
150

    
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152

    
153
  public ObjectFaceShape getObjectFaceShape(int variant)
154
    {
155
    return mReader.getObjectFaceShape(variant);
156
    }
157

    
158
///////////////////////////////////////////////////////////////////////////////////////////////////
159

    
160
  public Static4D getQuat(int cubit, int[] numLayers)
161
    {
162
    return mReader.getQuat(cubit);
163
    }
164

    
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166

    
167
  public int getNumCubitVariants(int[] numLayers)
168
    {
169
    return mReader.getNumCubitVariants();
170
    }
171

    
172
///////////////////////////////////////////////////////////////////////////////////////////////////
173

    
174
  public int getCubitVariant(int cubit, int[] numLayers)
175
    {
176
    return mReader.getCubitVariant(cubit);
177
    }
178

    
179
///////////////////////////////////////////////////////////////////////////////////////////////////
180

    
181
  public int getVariantFaceColor(int variant, int face)
182
    {
183
    return mReader.getVariantFaceColor(variant,face);
184
    }
185

    
186
///////////////////////////////////////////////////////////////////////////////////////////////////
187

    
188
  public int getCubitFaceColor(int cubit, int face, int[] numLayers)
189
    {
190
    return mReader.getCubitFaceColor(cubit,face);
191
    }
192

    
193
///////////////////////////////////////////////////////////////////////////////////////////////////
194

    
195
  public int getNumStickerTypes()
196
    {
197
    return mReader.getNumStickerTypes();
198
    }
199

    
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201

    
202
  public ObjectSticker retSticker(int sticker)
203
    {
204
    return mReader.retSticker(sticker);
205
    }
206

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

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

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

    
218
  public float getStickerRadius()
219
    {
220
    return 0.0f;
221
    }
222

    
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224
// fake, this will never be called
225

    
226
  public float[][] getStickerAngles()
227
    {
228
    return null;
229
    }
230

    
231
///////////////////////////////////////////////////////////////////////////////////////////////////
232
// PUBLIC API
233

    
234
  public Static3D[] getRotationAxis()
235
    {
236
    return mReader.getRotationAxis();
237
    }
238

    
239
///////////////////////////////////////////////////////////////////////////////////////////////////
240

    
241
  public int[] getBasicAngle()
242
    {
243
    return mReader.getBasicAngle();
244
    }
245

    
246
///////////////////////////////////////////////////////////////////////////////////////////////////
247

    
248
  public ObjectType intGetObjectType(int[] numLayers)
249
    {
250
    return mReader.intGetObjectType();
251
    }
252

    
253
///////////////////////////////////////////////////////////////////////////////////////////////////
254

    
255
  public String getObjectName()
256
    {
257
    return mReader.getObjectName();
258
    }
259

    
260
///////////////////////////////////////////////////////////////////////////////////////////////////
261

    
262
  public String getInventor()
263
    {
264
    return mReader.getInventor();
265
    }
266

    
267
///////////////////////////////////////////////////////////////////////////////////////////////////
268

    
269
  public int getYearOfInvention()
270
    {
271
    return mReader.getYearOfInvention();
272
    }
273

    
274
///////////////////////////////////////////////////////////////////////////////////////////////////
275

    
276
  public int getComplexity()
277
    {
278
    return mReader.getComplexity();
279
    }
280

    
281
///////////////////////////////////////////////////////////////////////////////////////////////////
282

    
283
  public int getNumFaces()
284
    {
285
    return mReader.getNumFaces();
286
    }
287

    
288
///////////////////////////////////////////////////////////////////////////////////////////////////
289

    
290
  public int getNumFaceColors()
291
    {
292
    return mReader.getNumFaceColors();
293
    }
294

    
295
///////////////////////////////////////////////////////////////////////////////////////////////////
296

    
297
  public int getScrambleType()
298
    {
299
    return mReader.getScrambleType();
300
    }
301

    
302
///////////////////////////////////////////////////////////////////////////////////////////////////
303

    
304
  public int getColor(int face)
305
    {
306
    return mReader.getColor(face);
307
    }
308

    
309
///////////////////////////////////////////////////////////////////////////////////////////////////
310

    
311
  public boolean shouldResetTextureMaps()
312
    {
313
    return mReader.shouldResetTextureMaps();
314
    }
315

    
316
///////////////////////////////////////////////////////////////////////////////////////////////////
317

    
318
  public String getShortName()
319
    {
320
    return mReader.getShortName();
321
    }
322

    
323
///////////////////////////////////////////////////////////////////////////////////////////////////
324

    
325
  public int getFOV()
326
    {
327
    switch( mReader.getNumFaces() )
328
      {
329
      case  4: return ShapeTetrahedron.FOV;
330
      case  6: return ShapeHexahedron.FOV;
331
      case  8: return ShapeOctahedron.FOV;
332
      case 12: return ShapeDodecahedron.FOV;
333
      }
334

    
335
    return 0;
336
    }
337

    
338
///////////////////////////////////////////////////////////////////////////////////////////////////
339

    
340
  public float getScreenRatio()
341
    {
342
    switch( mReader.getNumFaces() )
343
      {
344
      case  4: return ShapeTetrahedron.RATIO;
345
      case  6: return ShapeHexahedron.RATIO;
346
      case  8: return ShapeOctahedron.RATIO;
347
      case 12: return ShapeDodecahedron.RATIO;
348
      }
349

    
350
    return 0.0f;
351
    }
352
}
(10-10/13)