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