1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2020 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9
|
|
10
|
package org.distorted.objectlib.objects;
|
11
|
|
12
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
|
13
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_CORNER;
|
14
|
|
15
|
import org.distorted.library.type.Static3D;
|
16
|
import org.distorted.library.type.Static4D;
|
17
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
18
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
19
|
import org.distorted.objectlib.helpers.ObjectShape;
|
20
|
import org.distorted.objectlib.metadata.Metadata;
|
21
|
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
22
|
import org.distorted.objectlib.main.InitAssets;
|
23
|
import org.distorted.objectlib.metadata.ListObjects;
|
24
|
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
|
25
|
import org.distorted.objectlib.shape.ShapeHexahedron;
|
26
|
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
|
27
|
|
28
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
29
|
|
30
|
public class TwistyDinoSkewb extends ShapeHexahedron
|
31
|
{
|
32
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
33
|
{
|
34
|
new Static3D( SQ3/3, SQ3/3, SQ3/3),
|
35
|
new Static3D( SQ3/3, SQ3/3,-SQ3/3),
|
36
|
new Static3D( SQ3/3,-SQ3/3, SQ3/3),
|
37
|
new Static3D( SQ3/3,-SQ3/3,-SQ3/3)
|
38
|
};
|
39
|
|
40
|
private int[][] mEdges;
|
41
|
private int[][] mBasicAngle;
|
42
|
private float[][] mCuts;
|
43
|
private float[][] mPositions;
|
44
|
private int[] mQuatIndex;
|
45
|
private boolean[][] mRotatable;
|
46
|
|
47
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
48
|
|
49
|
public TwistyDinoSkewb(int iconMode, Static4D quat, Static3D move, float scale, Metadata meta, InitAssets asset)
|
50
|
{
|
51
|
super(iconMode, meta.getNumLayers()[0], quat, move, scale, meta, asset);
|
52
|
}
|
53
|
|
54
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
55
|
|
56
|
@Override
|
57
|
public float[][] returnRotationFactor()
|
58
|
{
|
59
|
int numL = getNumLayers()[0];
|
60
|
float[] f = new float[numL];
|
61
|
for(int i=0; i<numL; i++) f[i] = 1.7f;
|
62
|
return new float[][] { f,f,f,f };
|
63
|
}
|
64
|
|
65
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66
|
|
67
|
public int[][] getScrambleEdges()
|
68
|
{
|
69
|
if( mEdges==null )
|
70
|
{
|
71
|
mEdges = new int[][]
|
72
|
{
|
73
|
{ 0,0,1,0, 2,1,3,1, 4,1,5,1, 6,0,7,0, 8,1,9,1, 10,0,11,0, 12,0,13,0, 14,1,15,1 },
|
74
|
{ 0,0,1,0, 6,0,7,0, 10,0,11,0, 12,0,13,0 },
|
75
|
};
|
76
|
}
|
77
|
return mEdges;
|
78
|
}
|
79
|
|
80
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
81
|
|
82
|
@Override
|
83
|
public int[][] getScrambleAlgorithms()
|
84
|
{
|
85
|
if( mRotatable==null ) mRotatable = createRotatable();
|
86
|
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
|
87
|
}
|
88
|
|
89
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
90
|
|
91
|
public float[][] getCuts(int[] numLayers)
|
92
|
{
|
93
|
if( mCuts==null )
|
94
|
{
|
95
|
final float s = SQ3/6;
|
96
|
final float d = SQ3/2;
|
97
|
|
98
|
float[] c0 = new float[] {-s, d};
|
99
|
float[] c1 = new float[] {-d, s};
|
100
|
mCuts = new float[][] {c0,c1,c1,c0};
|
101
|
}
|
102
|
|
103
|
return mCuts;
|
104
|
}
|
105
|
|
106
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
107
|
|
108
|
private boolean[][] createRotatable()
|
109
|
{
|
110
|
boolean[] tmp = new boolean[] {true,false,true};
|
111
|
return new boolean[][] { tmp,tmp,tmp,tmp };
|
112
|
}
|
113
|
|
114
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
115
|
|
116
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
117
|
{
|
118
|
if( mRotatable==null ) mRotatable = createRotatable();
|
119
|
return mRotatable;
|
120
|
}
|
121
|
|
122
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
123
|
|
124
|
public int getTouchControlType()
|
125
|
{
|
126
|
return TC_HEXAHEDRON;
|
127
|
}
|
128
|
|
129
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
130
|
|
131
|
public int getTouchControlSplit()
|
132
|
{
|
133
|
return TYPE_SPLIT_CORNER;
|
134
|
}
|
135
|
|
136
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
137
|
|
138
|
public int[][][] getEnabled()
|
139
|
{
|
140
|
return new int[][][]
|
141
|
{
|
142
|
{{0,1},{3,1},{2,3},{0,2}},
|
143
|
{{2,3},{3,1},{0,1},{0,2}},
|
144
|
{{1,2},{0,1},{0,3},{2,3}},
|
145
|
{{1,2},{2,3},{0,3},{0,1}},
|
146
|
{{0,3},{0,2},{1,2},{1,3}},
|
147
|
{{1,2},{0,2},{0,3},{1,3}},
|
148
|
};
|
149
|
}
|
150
|
|
151
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
152
|
|
153
|
public float[] getDist3D(int[] numLayers)
|
154
|
{
|
155
|
return TouchControlHexahedron.D3D;
|
156
|
}
|
157
|
|
158
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
159
|
|
160
|
public Static3D[] getFaceAxis()
|
161
|
{
|
162
|
return TouchControlHexahedron.FACE_AXIS;
|
163
|
}
|
164
|
|
165
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
166
|
|
167
|
public float[][] getCubitPositions(int[] numLayers)
|
168
|
{
|
169
|
if( mPositions==null )
|
170
|
{
|
171
|
final float A = 1.5f;
|
172
|
final float B = 0.5f;
|
173
|
|
174
|
mPositions = new float[][]
|
175
|
{
|
176
|
{ A, A, A },
|
177
|
{-A, A,-A },
|
178
|
{-A,-A, A },
|
179
|
{ A,-A,-A },
|
180
|
|
181
|
{ B, B, A },
|
182
|
{-B,-B, A },
|
183
|
{-B, B,-A },
|
184
|
{ B,-B,-A },
|
185
|
{ A, B, B },
|
186
|
{ A,-B,-B },
|
187
|
{-A,-B, B },
|
188
|
{-A, B,-B },
|
189
|
{ B, A, B },
|
190
|
{-B, A,-B },
|
191
|
{-B,-A, B },
|
192
|
{ B,-A,-B },
|
193
|
|
194
|
{-B, A, A },
|
195
|
{-A, A, B },
|
196
|
{-A, B, A },
|
197
|
{ B,-A, A },
|
198
|
{ A,-A, B },
|
199
|
{ A,-B, A },
|
200
|
{ B, A,-A },
|
201
|
{ A, A,-B },
|
202
|
{ A, B,-A },
|
203
|
{-B,-A,-A },
|
204
|
{-A,-A,-B },
|
205
|
{-A,-B,-A },
|
206
|
};
|
207
|
}
|
208
|
|
209
|
return mPositions;
|
210
|
}
|
211
|
|
212
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
213
|
|
214
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
215
|
{
|
216
|
if( mQuatIndex==null )
|
217
|
{
|
218
|
mQuatIndex = new int[] { 0,3,6,4,
|
219
|
0,0, 9,9, 2,2, 3,3, 1,1, 4,4,
|
220
|
0,7,8, 10,4,2, 11,1,5, 9,6,3,
|
221
|
};
|
222
|
}
|
223
|
|
224
|
return mObjectQuats[mQuatIndex[cubit]];
|
225
|
}
|
226
|
|
227
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
228
|
|
229
|
private float[][] getVertices(int variant)
|
230
|
{
|
231
|
if( variant==0 )
|
232
|
{
|
233
|
return new float[][] { {-1,0,0},{0,-1,0},{0,0,-1},{-1,-1,-1},{0,0,0} };
|
234
|
}
|
235
|
else if( variant==1 )
|
236
|
{
|
237
|
return new float[][] { {-1,0,0},{0,-1,0},{1,0,0},{0,1,0},{0,0,-1} };
|
238
|
}
|
239
|
else
|
240
|
{
|
241
|
return new float[][] { {-1,0,0},{1,0,0},{0,-1,0},{0,0,-1} };
|
242
|
}
|
243
|
}
|
244
|
|
245
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
246
|
|
247
|
public ObjectShape getObjectShape(int variant)
|
248
|
{
|
249
|
if( variant==0 )
|
250
|
{
|
251
|
int[][] indices = { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
|
252
|
return new ObjectShape(getVertices(variant), indices);
|
253
|
}
|
254
|
else if( variant==1 )
|
255
|
{
|
256
|
int[][] indices = { {0,1,2,3},{4,1,0},{4,2,1},{4,3,2},{4,0,3} };
|
257
|
return new ObjectShape(getVertices(variant), indices);
|
258
|
}
|
259
|
else
|
260
|
{
|
261
|
int[][] indices = { {2,1,0},{3,0,1},{2,3,1},{3,2,0} };
|
262
|
return new ObjectShape(getVertices(variant), indices);
|
263
|
}
|
264
|
}
|
265
|
|
266
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
267
|
|
268
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
269
|
{
|
270
|
int numL = getNumLayers()[0];
|
271
|
|
272
|
if( variant==0 )
|
273
|
{
|
274
|
int N = numL==2 ? 7:5;
|
275
|
int E1= numL==2 ? 3:2;
|
276
|
int E2= numL==2 ? 5:3;
|
277
|
float height = isInIconMode() ? 0.001f : 0.02f;
|
278
|
float[][] bands = { {height,35,0.16f,0.7f,N,E1,E1}, {0.001f, 35,1.00f,0.0f,3,1,E2} };
|
279
|
int[] indices = { 0,0,0,1,1,1 };
|
280
|
return new ObjectFaceShape(bands,indices,null);
|
281
|
}
|
282
|
else if( variant==1 )
|
283
|
{
|
284
|
int N = numL==2 ? 6:5;
|
285
|
int E = numL==2 ? 2:1;
|
286
|
float height = isInIconMode() ? 0.001f : 0.04f;
|
287
|
float[][] bands = { {height,35,SQ2/8,0.9f,N,E,E}, {0.001f,35,1,0.0f,3,0,0} };
|
288
|
int[] indices = { 0,1,1,1,1 };
|
289
|
return new ObjectFaceShape(bands,indices,null);
|
290
|
}
|
291
|
else
|
292
|
{
|
293
|
int N = numL==2 ? 6:5;
|
294
|
int E = numL==2 ? 3:2;
|
295
|
float h1 = isInIconMode() ? 0.001f : 0.035f;
|
296
|
float h2 = isInIconMode() ? 0.001f : 0.020f;
|
297
|
float[][] bands = { {h1,30,0.16f,0.8f,N,2,E}, {h2,45,0.16f,0.2f,3,1,2} };
|
298
|
int[] indices = { 0,0,1,1 };
|
299
|
return new ObjectFaceShape(bands,indices,null);
|
300
|
}
|
301
|
}
|
302
|
|
303
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
304
|
|
305
|
public ObjectVertexEffects getVertexEffects(int variant)
|
306
|
{
|
307
|
if( variant==0 )
|
308
|
{
|
309
|
float[][] corners = { {0.05f,0.25f}, {0.05f,0.20f} };
|
310
|
int[] cornerIndices = { 1,1,1,0,0 };
|
311
|
float[][] centers = { {-0.5f, -0.5f, -0.5f} };
|
312
|
int[] centerIndices = { 0,0,0,-1,0 };
|
313
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
314
|
}
|
315
|
else if( variant==1 )
|
316
|
{
|
317
|
float[][] corners = { {0.03f,0.15f} };
|
318
|
int[] cornerIndices = { 0,0,0,0,0 };
|
319
|
float[][] centers = { {0,0,-0.4f} };
|
320
|
int[] centerIndices = { 0,0,0,0,-1 };
|
321
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
322
|
}
|
323
|
else
|
324
|
{
|
325
|
float[][] corners = { {0.04f,0.20f}, {0.02f,0.30f} };
|
326
|
int[] cornerIndices = { 0,0,1,1 };
|
327
|
float[][] centers = { {0.0f, -0.5f, -0.5f} };
|
328
|
int[] centerIndices = { 0,0,0,0 };
|
329
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
330
|
}
|
331
|
}
|
332
|
|
333
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
334
|
|
335
|
public int getNumCubitVariants(int[] numLayers)
|
336
|
{
|
337
|
return 3;
|
338
|
}
|
339
|
|
340
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
341
|
|
342
|
public int getCubitVariant(int cubit, int[] numLayers)
|
343
|
{
|
344
|
return cubit<4 ? 0 : (cubit<16 ? 1:2);
|
345
|
}
|
346
|
|
347
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
348
|
|
349
|
public float getStickerRadius()
|
350
|
{
|
351
|
return 0.10f;
|
352
|
}
|
353
|
|
354
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
355
|
|
356
|
public float getStickerStroke()
|
357
|
{
|
358
|
return isInIconMode() ? 0.18f : 0.10f;
|
359
|
}
|
360
|
|
361
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
362
|
|
363
|
public float[][][] getStickerAngles()
|
364
|
{
|
365
|
return null;
|
366
|
}
|
367
|
|
368
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
369
|
// PUBLIC API
|
370
|
|
371
|
public Static3D[] getRotationAxis()
|
372
|
{
|
373
|
return ROT_AXIS;
|
374
|
}
|
375
|
|
376
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
377
|
|
378
|
public int[][] getBasicAngles()
|
379
|
{
|
380
|
if( mBasicAngle ==null )
|
381
|
{
|
382
|
int[] tmp = new int[] {3,3,3};
|
383
|
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
|
384
|
}
|
385
|
|
386
|
return mBasicAngle;
|
387
|
}
|
388
|
|
389
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
390
|
|
391
|
public String getShortName()
|
392
|
{
|
393
|
return ListObjects.DSKE_3.name();
|
394
|
}
|
395
|
|
396
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
397
|
|
398
|
public String[][] getTutorials()
|
399
|
{
|
400
|
return new String[][] {
|
401
|
{"gb","NoYdr3eley0","Tutorial: Dino Skewb","PeteTheGeek196"},
|
402
|
{"gb","FYHdSpeMdqA","F-Skewb Solve","Superantoniovivaldi"},
|
403
|
{"es","R6deZc7wGaY","Tutorial Dino Skewb","QBAndo"},
|
404
|
{"ru","8nxHDHXypRE","Как собрать F-skewb (1/2)","Илья Топор-Гилка"},
|
405
|
{"ru","_nhpnjPGric","Как собрать F-skewb (2/2)","Илья Топор-Гилка"},
|
406
|
{"pl","yWGAF8qndww","Dino Skewb Tutorial PL","MrUK"},
|
407
|
{"br","_N5Vx29YEt4","Como resolver o Dino Skewb (1/3)","Rafael Cinoto"},
|
408
|
{"br","aVhl4vAB15w","Como resolver o Dino Skewb (2/3)","Rafael Cinoto"},
|
409
|
{"br","5nKwAkxu2Pg","Como resolver o Dino Skewb (3/3)","Rafael Cinoto"},
|
410
|
{"vn","STg0nMd18cQ","Dino F-Skewb tutorial","VĂN CÔNG TÙNG"},
|
411
|
{"tw","EoQFcqRGVdw","四階斜轉方塊 教學","不正常魔術方塊研究中心"},
|
412
|
};
|
413
|
}
|
414
|
}
|