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, Static4D quat, Static3D move, float scale, InputStream meshStream)
|
40
|
{
|
41
|
super(jsonStream, 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 int getNumStickerTypes(int[] numLayers)
|
82
|
{
|
83
|
return mReader.getNumStickerTypes();
|
84
|
}
|
85
|
|
86
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
87
|
|
88
|
public float[][] getCuts(int[] numLayers)
|
89
|
{
|
90
|
return mReader.getCuts();
|
91
|
}
|
92
|
|
93
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
94
|
|
95
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
96
|
{
|
97
|
return mReader.getLayerRotatable();
|
98
|
}
|
99
|
|
100
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
101
|
|
102
|
public int getMovementType()
|
103
|
{
|
104
|
return mReader.getMovementType();
|
105
|
}
|
106
|
|
107
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
108
|
|
109
|
public int getMovementSplit()
|
110
|
{
|
111
|
return mReader.getMovementSplit();
|
112
|
}
|
113
|
|
114
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
115
|
|
116
|
public int[][][] getEnabled()
|
117
|
{
|
118
|
return mReader.getEnabled();
|
119
|
}
|
120
|
|
121
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
122
|
|
123
|
public float[] getDist3D(int[] numLayers)
|
124
|
{
|
125
|
return mReader.getDist3D();
|
126
|
}
|
127
|
|
128
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129
|
|
130
|
public int getNumCubitFaces()
|
131
|
{
|
132
|
return mReader.getNumCubitFaces();
|
133
|
}
|
134
|
|
135
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
136
|
|
137
|
public float[][] getCubitPositions(int[] numLayers)
|
138
|
{
|
139
|
return mReader.getCubitPositions();
|
140
|
}
|
141
|
|
142
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
143
|
|
144
|
public ObjectShape getObjectShape(int variant)
|
145
|
{
|
146
|
return mReader.getObjectShape(variant);
|
147
|
}
|
148
|
|
149
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
150
|
|
151
|
public Static4D getQuat(int cubit, int[] numLayers)
|
152
|
{
|
153
|
return mReader.getQuat(cubit);
|
154
|
}
|
155
|
|
156
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
157
|
|
158
|
public int getNumCubitVariants(int[] numLayers)
|
159
|
{
|
160
|
return mReader.getNumCubitVariants();
|
161
|
}
|
162
|
|
163
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
164
|
|
165
|
public int getCubitVariant(int cubit, int[] numLayers)
|
166
|
{
|
167
|
return mReader.getCubitVariant(cubit);
|
168
|
}
|
169
|
|
170
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
171
|
|
172
|
public int getVariantFaceColor(int variant, int face, int[] numLayers)
|
173
|
{
|
174
|
return mReader.getVariantFaceColor(variant,face);
|
175
|
}
|
176
|
|
177
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
178
|
|
179
|
public int getCubitFaceColor(int cubit, int face, int[] numLayers)
|
180
|
{
|
181
|
return mReader.getCubitFaceColor(cubit,face);
|
182
|
}
|
183
|
|
184
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
185
|
|
186
|
public ObjectSticker retSticker(int sticker)
|
187
|
{
|
188
|
return mReader.retSticker(sticker);
|
189
|
}
|
190
|
|
191
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
192
|
// PUBLIC API
|
193
|
|
194
|
public Static3D[] getRotationAxis()
|
195
|
{
|
196
|
return mReader.getRotationAxis();
|
197
|
}
|
198
|
|
199
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
200
|
|
201
|
public int[] getBasicAngle()
|
202
|
{
|
203
|
return mReader.getBasicAngle();
|
204
|
}
|
205
|
|
206
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
207
|
|
208
|
public ObjectType intGetObjectType(int[] numLayers)
|
209
|
{
|
210
|
return mReader.intGetObjectType();
|
211
|
}
|
212
|
|
213
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
214
|
|
215
|
public String getObjectName()
|
216
|
{
|
217
|
return mReader.getObjectName();
|
218
|
}
|
219
|
|
220
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
221
|
|
222
|
public String getInventor()
|
223
|
{
|
224
|
return mReader.getInventor();
|
225
|
}
|
226
|
|
227
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
228
|
|
229
|
public int getYearOfInvention()
|
230
|
{
|
231
|
return mReader.getYearOfInvention();
|
232
|
}
|
233
|
|
234
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
235
|
|
236
|
public int getComplexity()
|
237
|
{
|
238
|
return mReader.getComplexity();
|
239
|
}
|
240
|
|
241
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
242
|
|
243
|
public int getNumFaces()
|
244
|
{
|
245
|
return mReader.getNumFaces();
|
246
|
}
|
247
|
|
248
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
249
|
|
250
|
public int getNumFaceColors()
|
251
|
{
|
252
|
return mReader.getNumFaceColors();
|
253
|
}
|
254
|
|
255
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
256
|
|
257
|
public int getScrambleType()
|
258
|
{
|
259
|
return mReader.getScrambleType();
|
260
|
}
|
261
|
|
262
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
263
|
|
264
|
public int getColor(int face)
|
265
|
{
|
266
|
return mReader.getColor(face);
|
267
|
}
|
268
|
|
269
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
270
|
|
271
|
public boolean shouldResetTextureMaps()
|
272
|
{
|
273
|
return mReader.shouldResetTextureMaps();
|
274
|
}
|
275
|
|
276
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
277
|
|
278
|
public String getShortName()
|
279
|
{
|
280
|
return mReader.getShortName();
|
281
|
}
|
282
|
|
283
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
284
|
|
285
|
public int getFOV()
|
286
|
{
|
287
|
switch( mReader.getNumFaces() )
|
288
|
{
|
289
|
case 4: return ShapeTetrahedron.FOV;
|
290
|
case 6: return ShapeHexahedron.FOV;
|
291
|
case 8: return ShapeOctahedron.FOV;
|
292
|
case 12: return ShapeDodecahedron.FOV;
|
293
|
}
|
294
|
|
295
|
return 0;
|
296
|
}
|
297
|
|
298
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
299
|
|
300
|
public float getScreenRatio()
|
301
|
{
|
302
|
switch( mReader.getNumFaces() )
|
303
|
{
|
304
|
case 4: return ShapeTetrahedron.RATIO;
|
305
|
case 6: return ShapeHexahedron.RATIO;
|
306
|
case 8: return ShapeOctahedron.RATIO;
|
307
|
case 12: return ShapeDodecahedron.RATIO;
|
308
|
}
|
309
|
|
310
|
return 0.0f;
|
311
|
}
|
312
|
}
|