Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / main / TwistyJson.java @ e16fd960

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.ObjectShape;
27
import org.distorted.objectlib.helpers.ObjectSticker;
28
import org.distorted.objectlib.helpers.ScrambleState;
29
import org.distorted.objectlib.json.JsonReader;
30

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

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

    
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

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

    
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

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

    
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

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

    
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59

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

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

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

    
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73

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

    
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80

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

    
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87

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

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

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

    
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101

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

    
107
///////////////////////////////////////////////////////////////////////////////////////////////////
108

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

    
114
///////////////////////////////////////////////////////////////////////////////////////////////////
115

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

    
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122

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

    
128
///////////////////////////////////////////////////////////////////////////////////////////////////
129

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

    
135
///////////////////////////////////////////////////////////////////////////////////////////////////
136

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

    
142
///////////////////////////////////////////////////////////////////////////////////////////////////
143

    
144
  public Static4D getQuat(int cubit, int[] numLayers)
145
    {
146
    return mReader.getQuat(cubit);
147
    }
148

    
149
///////////////////////////////////////////////////////////////////////////////////////////////////
150

    
151
  public int getNumCubitVariants(int[] numLayers)
152
    {
153
    return mReader.getNumCubitVariants();
154
    }
155

    
156
///////////////////////////////////////////////////////////////////////////////////////////////////
157

    
158
  public int getCubitVariant(int cubit, int[] numLayers)
159
    {
160
    return mReader.getCubitVariant(cubit);
161
    }
162

    
163
///////////////////////////////////////////////////////////////////////////////////////////////////
164

    
165
  public int getVariantFaceColor(int variant, int face, int[] numLayers)
166
    {
167
    return mReader.getVariantFaceColor(variant,face);
168
    }
169

    
170
///////////////////////////////////////////////////////////////////////////////////////////////////
171

    
172
  public int getCubitFaceColor(int cubit, int face, int[] numLayers)
173
    {
174
    return mReader.getCubitFaceColor(cubit,face);
175
    }
176

    
177
///////////////////////////////////////////////////////////////////////////////////////////////////
178

    
179
  public int getNumStickerTypes()
180
    {
181
    return mReader.getNumStickerTypes();
182
    }
183

    
184
///////////////////////////////////////////////////////////////////////////////////////////////////
185

    
186
  public ObjectSticker retSticker(int sticker)
187
    {
188
    return mReader.retSticker(sticker);
189
    }
190

    
191
///////////////////////////////////////////////////////////////////////////////////////////////////
192
// fake, this will never be called
193

    
194
  public float getStickerStroke()
195
    {
196
    return 0.0f;
197
    }
198

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

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

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

    
210
  public float[][] getStickerAngles()
211
    {
212
    return null;
213
    }
214

    
215
///////////////////////////////////////////////////////////////////////////////////////////////////
216
// PUBLIC API
217

    
218
  public Static3D[] getRotationAxis()
219
    {
220
    return mReader.getRotationAxis();
221
    }
222

    
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224

    
225
  public int[] getBasicAngle()
226
    {
227
    return mReader.getBasicAngle();
228
    }
229

    
230
///////////////////////////////////////////////////////////////////////////////////////////////////
231

    
232
  public ObjectType intGetObjectType(int[] numLayers)
233
    {
234
    return mReader.intGetObjectType();
235
    }
236

    
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238

    
239
  public String getObjectName()
240
    {
241
    return mReader.getObjectName();
242
    }
243

    
244
///////////////////////////////////////////////////////////////////////////////////////////////////
245

    
246
  public String getInventor()
247
    {
248
    return mReader.getInventor();
249
    }
250

    
251
///////////////////////////////////////////////////////////////////////////////////////////////////
252

    
253
  public int getYearOfInvention()
254
    {
255
    return mReader.getYearOfInvention();
256
    }
257

    
258
///////////////////////////////////////////////////////////////////////////////////////////////////
259

    
260
  public int getComplexity()
261
    {
262
    return mReader.getComplexity();
263
    }
264

    
265
///////////////////////////////////////////////////////////////////////////////////////////////////
266

    
267
  public int getNumFaces()
268
    {
269
    return mReader.getNumFaces();
270
    }
271

    
272
///////////////////////////////////////////////////////////////////////////////////////////////////
273

    
274
  public int getNumFaceColors()
275
    {
276
    return mReader.getNumFaceColors();
277
    }
278

    
279
///////////////////////////////////////////////////////////////////////////////////////////////////
280

    
281
  public int getScrambleType()
282
    {
283
    return mReader.getScrambleType();
284
    }
285

    
286
///////////////////////////////////////////////////////////////////////////////////////////////////
287

    
288
  public int getColor(int face)
289
    {
290
    return mReader.getColor(face);
291
    }
292

    
293
///////////////////////////////////////////////////////////////////////////////////////////////////
294

    
295
  public boolean shouldResetTextureMaps()
296
    {
297
    return mReader.shouldResetTextureMaps();
298
    }
299

    
300
///////////////////////////////////////////////////////////////////////////////////////////////////
301

    
302
  public String getShortName()
303
    {
304
    return mReader.getShortName();
305
    }
306

    
307
///////////////////////////////////////////////////////////////////////////////////////////////////
308

    
309
  public int getFOV()
310
    {
311
    switch( mReader.getNumFaces() )
312
      {
313
      case  4: return ShapeTetrahedron.FOV;
314
      case  6: return ShapeHexahedron.FOV;
315
      case  8: return ShapeOctahedron.FOV;
316
      case 12: return ShapeDodecahedron.FOV;
317
      }
318

    
319
    return 0;
320
    }
321

    
322
///////////////////////////////////////////////////////////////////////////////////////////////////
323

    
324
  public float getScreenRatio()
325
    {
326
    switch( mReader.getNumFaces() )
327
      {
328
      case  4: return ShapeTetrahedron.RATIO;
329
      case  6: return ShapeHexahedron.RATIO;
330
      case  8: return ShapeOctahedron.RATIO;
331
      case 12: return ShapeDodecahedron.RATIO;
332
      }
333

    
334
    return 0.0f;
335
    }
336
}
(10-10/13)