| 1 |
5d7bb479
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 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 TwistyTins 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[][] mPosition;
|
| 46 |
|
|
private int[] mQuatIndex;
|
| 47 |
acf2a9e1
|
Leszek Koltunski
|
private boolean[][] mRotatable;
|
| 48 |
5d7bb479
|
Leszek Koltunski
|
|
| 49 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 50 |
|
|
|
| 51 |
|
|
public TwistyTins(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
|
| 52 |
|
|
{
|
| 53 |
|
|
super(meshState, iconMode, 4, quat, move, scale, data, asset);
|
| 54 |
|
|
}
|
| 55 |
|
|
|
| 56 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 57 |
|
|
|
| 58 |
|
|
public int[][] getScrambleEdges()
|
| 59 |
|
|
{
|
| 60 |
acf2a9e1
|
Leszek Koltunski
|
if( mEdges==null )
|
| 61 |
|
|
{
|
| 62 |
|
|
setUpRotatable();
|
| 63 |
|
|
mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable);
|
| 64 |
|
|
}
|
| 65 |
|
|
|
| 66 |
5d7bb479
|
Leszek Koltunski
|
return mEdges;
|
| 67 |
|
|
}
|
| 68 |
|
|
|
| 69 |
acf2a9e1
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 70 |
|
|
|
| 71 |
|
|
@Override
|
| 72 |
|
|
public int[][] getScrambleAlgorithms()
|
| 73 |
|
|
{
|
| 74 |
|
|
setUpRotatable();
|
| 75 |
|
|
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
|
| 76 |
|
|
}
|
| 77 |
|
|
|
| 78 |
5d7bb479
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 79 |
|
|
|
| 80 |
|
|
public float[][] getCuts(int[] numLayers)
|
| 81 |
|
|
{
|
| 82 |
|
|
if( mCuts==null )
|
| 83 |
|
|
{
|
| 84 |
|
|
float C1 = -4*SQ3/3;
|
| 85 |
|
|
float C2 = -2*SQ3/3;
|
| 86 |
|
|
float C3 = 2*SQ3/3;
|
| 87 |
|
|
float C4 = SQ3+0.01f;
|
| 88 |
|
|
|
| 89 |
|
|
float[] cut1 = new float[] { C1, C2, C3, C4 };
|
| 90 |
|
|
float[] cut2 = new float[] {-C4,-C3,-C2,-C1 };
|
| 91 |
|
|
|
| 92 |
|
|
mCuts = new float[][] { cut1,cut2,cut2,cut1 };
|
| 93 |
|
|
}
|
| 94 |
|
|
|
| 95 |
|
|
return mCuts;
|
| 96 |
|
|
}
|
| 97 |
|
|
|
| 98 |
acf2a9e1
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 99 |
|
|
|
| 100 |
|
|
private void setUpRotatable()
|
| 101 |
|
|
{
|
| 102 |
|
|
if( mRotatable==null )
|
| 103 |
|
|
{
|
| 104 |
|
|
boolean[] tmp = new boolean[] {true,true,false,true,true};
|
| 105 |
|
|
mRotatable = new boolean[][] { tmp,tmp,tmp,tmp };
|
| 106 |
|
|
}
|
| 107 |
|
|
}
|
| 108 |
|
|
|
| 109 |
5d7bb479
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 110 |
|
|
|
| 111 |
|
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
| 112 |
|
|
{
|
| 113 |
acf2a9e1
|
Leszek Koltunski
|
setUpRotatable();
|
| 114 |
|
|
return mRotatable;
|
| 115 |
5d7bb479
|
Leszek Koltunski
|
}
|
| 116 |
|
|
|
| 117 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 118 |
|
|
|
| 119 |
|
|
public int getTouchControlType()
|
| 120 |
|
|
{
|
| 121 |
|
|
return TC_HEXAHEDRON;
|
| 122 |
|
|
}
|
| 123 |
|
|
|
| 124 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 125 |
|
|
|
| 126 |
|
|
public int getTouchControlSplit()
|
| 127 |
|
|
{
|
| 128 |
|
|
return TYPE_SPLIT_CORNER;
|
| 129 |
|
|
}
|
| 130 |
|
|
|
| 131 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 132 |
|
|
|
| 133 |
|
|
public int[][][] getEnabled()
|
| 134 |
|
|
{
|
| 135 |
|
|
return new int[][][]
|
| 136 |
|
|
{
|
| 137 |
|
|
{{0,1},{3,1},{2,3},{0,2}},
|
| 138 |
|
|
{{2,3},{3,1},{0,1},{0,2}},
|
| 139 |
|
|
{{1,2},{0,1},{0,3},{2,3}},
|
| 140 |
|
|
{{1,2},{2,3},{0,3},{0,1}},
|
| 141 |
|
|
{{0,3},{0,2},{1,2},{1,3}},
|
| 142 |
|
|
{{1,2},{0,2},{0,3},{1,3}},
|
| 143 |
|
|
};
|
| 144 |
|
|
}
|
| 145 |
|
|
|
| 146 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 147 |
|
|
|
| 148 |
|
|
public float[] getDist3D(int[] numLayers)
|
| 149 |
|
|
{
|
| 150 |
|
|
return TouchControlHexahedron.D3D;
|
| 151 |
|
|
}
|
| 152 |
|
|
|
| 153 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 154 |
|
|
|
| 155 |
|
|
public Static3D[] getFaceAxis()
|
| 156 |
|
|
{
|
| 157 |
|
|
return TouchControlHexahedron.FACE_AXIS;
|
| 158 |
|
|
}
|
| 159 |
|
|
|
| 160 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 161 |
|
|
// corner cubes, corner 'dino' , edges, centers.
|
| 162 |
|
|
|
| 163 |
|
|
public float[][] getCubitPositions(int[] numLayers)
|
| 164 |
|
|
{
|
| 165 |
|
|
if( mPosition==null )
|
| 166 |
|
|
{
|
| 167 |
|
|
float C1 = 1.5f;
|
| 168 |
|
|
float C2 = 1.0f;
|
| 169 |
|
|
float C3 = 2.0f;
|
| 170 |
|
|
float C4 = 0.5f;
|
| 171 |
|
|
float C5 = 0.25f;
|
| 172 |
|
|
float C6 = 0.75f;
|
| 173 |
|
|
|
| 174 |
|
|
mPosition = new float[][]
|
| 175 |
|
|
{
|
| 176 |
|
|
{ C1, C1, C1},
|
| 177 |
|
|
{-C1, C1,-C1},
|
| 178 |
|
|
{ C1,-C1,-C1},
|
| 179 |
|
|
{-C1,-C1, C1},
|
| 180 |
|
|
|
| 181 |
|
|
{-C2, C3, C3},
|
| 182 |
|
|
{-C3, C2, C3},
|
| 183 |
|
|
{-C3, C3, C2},
|
| 184 |
|
|
{ C2, C3,-C3},
|
| 185 |
|
|
{ C3, C2,-C3},
|
| 186 |
|
|
{ C3, C3,-C2},
|
| 187 |
|
|
{ C2,-C3, C3},
|
| 188 |
|
|
{ C3,-C2, C3},
|
| 189 |
|
|
{ C3,-C3, C2},
|
| 190 |
|
|
{-C2,-C3,-C3},
|
| 191 |
|
|
{-C3,-C2,-C3},
|
| 192 |
|
|
{-C3,-C3,-C2},
|
| 193 |
|
|
|
| 194 |
|
|
{ C4, C3, C3},
|
| 195 |
|
|
{ C3, C4, C3},
|
| 196 |
|
|
{-C4,-C3, C3},
|
| 197 |
|
|
{-C3,-C4, C3},
|
| 198 |
|
|
{ C3, C3, C4},
|
| 199 |
|
|
{ C3,-C3,-C4},
|
| 200 |
|
|
{-C3,-C3, C4},
|
| 201 |
|
|
{-C3, C3,-C4},
|
| 202 |
|
|
{-C4, C3,-C3},
|
| 203 |
|
|
{ C3,-C4,-C3},
|
| 204 |
|
|
{ C4,-C3,-C3},
|
| 205 |
|
|
{-C3, C4,-C3},
|
| 206 |
|
|
|
| 207 |
|
|
{-C5, C6, C3}, // F
|
| 208 |
|
|
{ C5,-C6, C3},
|
| 209 |
|
|
{ C5, C6,-C3}, // B
|
| 210 |
|
|
{-C5,-C6,-C3},
|
| 211 |
b3c8eeda
|
Leszek Koltunski
|
{ C3, C5,-C6}, // R
|
| 212 |
5d7bb479
|
Leszek Koltunski
|
{ C3,-C5, C6},
|
| 213 |
b3c8eeda
|
Leszek Koltunski
|
{-C3,-C5,-C6}, // L
|
| 214 |
5d7bb479
|
Leszek Koltunski
|
{-C3, C5, C6},
|
| 215 |
b3c8eeda
|
Leszek Koltunski
|
{-C6, C3, C5}, // T
|
| 216 |
5d7bb479
|
Leszek Koltunski
|
{ C6, C3,-C5},
|
| 217 |
b3c8eeda
|
Leszek Koltunski
|
{-C6,-C3,-C5}, // D
|
| 218 |
5d7bb479
|
Leszek Koltunski
|
{ C6,-C3, C5},
|
| 219 |
b3c8eeda
|
Leszek Koltunski
|
|
| 220 |
|
|
{ C6,-C5, C3},
|
| 221 |
|
|
{-C6, C5, C3},
|
| 222 |
|
|
{-C6,-C5,-C3},
|
| 223 |
|
|
{ C6, C5,-C3},
|
| 224 |
|
|
{ C3,-C6, C5},
|
| 225 |
|
|
{ C3, C6,-C5},
|
| 226 |
|
|
{-C3, C6, C5},
|
| 227 |
|
|
{-C3,-C6,-C5},
|
| 228 |
|
|
{ C5, C3,-C6},
|
| 229 |
|
|
{-C5, C3, C6},
|
| 230 |
|
|
{ C5,-C3, C6},
|
| 231 |
5d7bb479
|
Leszek Koltunski
|
{-C5,-C3,-C6},
|
| 232 |
|
|
};
|
| 233 |
|
|
}
|
| 234 |
|
|
|
| 235 |
|
|
return mPosition;
|
| 236 |
|
|
}
|
| 237 |
|
|
|
| 238 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 239 |
|
|
|
| 240 |
|
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
| 241 |
|
|
{
|
| 242 |
|
|
if( mQuatIndex==null ) mQuatIndex = new int[] { 0, 3, 4, 6,
|
| 243 |
|
|
0, 8, 7,11, 5, 1,10, 2, 4, 9, 3, 6,
|
| 244 |
|
|
0, 2,10, 8, 1, 4, 6, 7,11, 5, 9, 3,
|
| 245 |
b3c8eeda
|
Leszek Koltunski
|
0,10,11, 9, 5, 2, 3, 8, 7, 1, 6, 4,
|
| 246 |
|
|
0,10,11, 9, 5, 2, 3, 8, 7, 1, 6, 4,
|
| 247 |
5d7bb479
|
Leszek Koltunski
|
};
|
| 248 |
|
|
return mObjectQuats[mQuatIndex[cubit]];
|
| 249 |
|
|
}
|
| 250 |
|
|
|
| 251 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 252 |
|
|
|
| 253 |
|
|
private float[][] getVertices(int variant)
|
| 254 |
|
|
{
|
| 255 |
|
|
if( variant==0 )
|
| 256 |
|
|
{
|
| 257 |
|
|
return new float[][]
|
| 258 |
|
|
{
|
| 259 |
|
|
{ 0.0f, 0.0f, 0.0f },
|
| 260 |
|
|
{-0.5f, 0.5f, 0.5f },
|
| 261 |
|
|
{-0.5f,-0.5f, 0.5f },
|
| 262 |
|
|
{ 0.5f, 0.5f, 0.5f },
|
| 263 |
|
|
{ 0.5f,-0.5f, 0.5f },
|
| 264 |
|
|
{ 0.5f, 0.5f,-0.5f },
|
| 265 |
|
|
{ 0.5f,-0.5f,-0.5f },
|
| 266 |
|
|
{-0.5f, 0.5f,-0.5f },
|
| 267 |
|
|
};
|
| 268 |
|
|
}
|
| 269 |
|
|
else if( variant==1 )
|
| 270 |
|
|
{
|
| 271 |
|
|
return new float[][]
|
| 272 |
|
|
{
|
| 273 |
|
|
{-1.0f, 0.0f, 0.0f},
|
| 274 |
|
|
{ 1.0f, 0.0f, 0.0f},
|
| 275 |
|
|
{ 0.0f,-1.0f, 0.0f},
|
| 276 |
|
|
{ 0.0f, 0.0f,-1.0f}
|
| 277 |
|
|
};
|
| 278 |
|
|
}
|
| 279 |
|
|
else if( variant==2 )
|
| 280 |
|
|
{
|
| 281 |
|
|
return new float[][]
|
| 282 |
|
|
{
|
| 283 |
|
|
{-0.5f, 0.0f, 0.0f},
|
| 284 |
|
|
{ 0.5f, 0.0f, 0.0f},
|
| 285 |
|
|
{ 0.5f,-1.0f, 0.0f},
|
| 286 |
|
|
{ 0.0f,-1.5f, 0.0f},
|
| 287 |
|
|
{-1.0f,-0.5f, 0.0f},
|
| 288 |
|
|
{-1.0f, 0.0f,-0.5f},
|
| 289 |
|
|
{ 0.0f, 0.0f,-1.5f},
|
| 290 |
|
|
{ 0.5f, 0.0f,-1.0f}
|
| 291 |
|
|
};
|
| 292 |
|
|
}
|
| 293 |
b3c8eeda
|
Leszek Koltunski
|
else if( variant==3 )
|
| 294 |
|
|
{
|
| 295 |
|
|
return new float[][]
|
| 296 |
|
|
{
|
| 297 |
|
|
{-0.25f, 0.75f, 0.00f},
|
| 298 |
|
|
{ 0.75f,-0.25f, 0.00f},
|
| 299 |
|
|
{ 0.25f,-0.75f, 0.00f},
|
| 300 |
|
|
{-0.75f, 0.25f, 0.00f},
|
| 301 |
|
|
{-0.25f, 1.00f,-0.25f},
|
| 302 |
|
|
{ 0.75f, 0.50f,-0.75f},
|
| 303 |
|
|
{ 0.25f, 0.25f,-1.00f},
|
| 304 |
|
|
{-0.75f, 0.75f,-0.50f}
|
| 305 |
|
|
};
|
| 306 |
|
|
}
|
| 307 |
5d7bb479
|
Leszek Koltunski
|
else
|
| 308 |
|
|
{
|
| 309 |
|
|
return new float[][]
|
| 310 |
|
|
{
|
| 311 |
b3c8eeda
|
Leszek Koltunski
|
{-0.25f, 0.75f, 0.00f},
|
| 312 |
|
|
{ 0.75f,-0.25f, 0.00f},
|
| 313 |
|
|
{ 0.25f,-0.75f, 0.00f},
|
| 314 |
|
|
{-0.75f, 0.25f, 0.00f},
|
| 315 |
|
|
{ 0.50f, 0.75f,-0.75f},
|
| 316 |
|
|
{ 1.00f,-0.25f,-0.25f},
|
| 317 |
|
|
{ 0.75f,-0.75f,-0.50f},
|
| 318 |
|
|
{ 0.25f, 0.25f,-1.00f}
|
| 319 |
5d7bb479
|
Leszek Koltunski
|
};
|
| 320 |
|
|
}
|
| 321 |
|
|
}
|
| 322 |
|
|
|
| 323 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 324 |
|
|
|
| 325 |
|
|
public ObjectShape getObjectShape(int variant)
|
| 326 |
|
|
{
|
| 327 |
|
|
if( variant==0 )
|
| 328 |
|
|
{
|
| 329 |
|
|
int[][] indices =
|
| 330 |
|
|
{
|
| 331 |
|
|
{ 2,4,3,1 },
|
| 332 |
|
|
{ 1,3,5,7 },
|
| 333 |
|
|
{ 4,6,5,3 },
|
| 334 |
|
|
{ 0,4,2 },
|
| 335 |
|
|
{ 0,7,5 },
|
| 336 |
|
|
{ 0,6,4 },
|
| 337 |
|
|
{ 0,1,7 },
|
| 338 |
|
|
{ 0,2,1 },
|
| 339 |
|
|
{ 0,5,6 }
|
| 340 |
|
|
};
|
| 341 |
|
|
|
| 342 |
|
|
return new ObjectShape(getVertices(variant), indices);
|
| 343 |
|
|
}
|
| 344 |
|
|
else if( variant==1 )
|
| 345 |
|
|
{
|
| 346 |
|
|
int[][] indices =
|
| 347 |
|
|
{
|
| 348 |
|
|
{2,1,0},
|
| 349 |
|
|
{3,0,1},
|
| 350 |
|
|
{2,3,1},
|
| 351 |
|
|
{3,2,0}
|
| 352 |
|
|
};
|
| 353 |
|
|
|
| 354 |
|
|
return new ObjectShape(getVertices(variant), indices);
|
| 355 |
|
|
}
|
| 356 |
|
|
else if( variant==2 )
|
| 357 |
|
|
{
|
| 358 |
|
|
int[][] indices =
|
| 359 |
|
|
{
|
| 360 |
|
|
{4,3,2,1,0},
|
| 361 |
|
|
{0,1,7,6,5},
|
| 362 |
|
|
{1,2,7},
|
| 363 |
|
|
{2,3,6,7},
|
| 364 |
|
|
{3,4,5,6},
|
| 365 |
a2c64ac3
|
Leszek Koltunski
|
{0,5,4}
|
| 366 |
5d7bb479
|
Leszek Koltunski
|
};
|
| 367 |
|
|
|
| 368 |
|
|
return new ObjectShape(getVertices(variant), indices);
|
| 369 |
|
|
}
|
| 370 |
|
|
else
|
| 371 |
|
|
{
|
| 372 |
|
|
int[][] indices =
|
| 373 |
|
|
{
|
| 374 |
|
|
{3,2,1,0},
|
| 375 |
b3c8eeda
|
Leszek Koltunski
|
{6,5,1,2},
|
| 376 |
|
|
{5,4,0,1},
|
| 377 |
|
|
{4,7,3,0},
|
| 378 |
|
|
{7,6,2,3},
|
| 379 |
|
|
{4,5,6,7}
|
| 380 |
5d7bb479
|
Leszek Koltunski
|
};
|
| 381 |
|
|
|
| 382 |
|
|
return new ObjectShape(getVertices(variant), indices);
|
| 383 |
|
|
}
|
| 384 |
|
|
}
|
| 385 |
|
|
|
| 386 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 387 |
|
|
|
| 388 |
|
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
| 389 |
|
|
{
|
| 390 |
|
|
if( variant==0 )
|
| 391 |
|
|
{
|
| 392 |
|
|
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
| 393 |
|
|
float h2 = isInIconMode() ? 0.001f : 0.01f;
|
| 394 |
|
|
float[][] bands = { {h1,35,0.5f,0.7f,5,1,0}, {h2,35,0.2f,0.4f,5,1,0} };
|
| 395 |
|
|
int[] indices = { 0,0,0,1,1,1,1,1,1 };
|
| 396 |
|
|
return new ObjectFaceShape(bands,indices,null);
|
| 397 |
|
|
}
|
| 398 |
|
|
else if( variant==1 )
|
| 399 |
|
|
{
|
| 400 |
|
|
float h1 = isInIconMode() ? 0.001f : 0.035f;
|
| 401 |
|
|
float h2 = isInIconMode() ? 0.001f : 0.010f;
|
| 402 |
|
|
float[][] bands = { {h1,30,0.16f,0.8f,5,0,0}, {h2,30,0.16f,0.2f,5,0,0} };
|
| 403 |
|
|
int[] bandIndices= { 0,0,1,1 };
|
| 404 |
|
|
return new ObjectFaceShape(bands,bandIndices,null);
|
| 405 |
|
|
}
|
| 406 |
|
|
else if( variant==2 )
|
| 407 |
|
|
{
|
| 408 |
|
|
float h1 = isInIconMode() ? 0.001f : 0.035f;
|
| 409 |
|
|
float h2 = isInIconMode() ? 0.001f : 0.010f;
|
| 410 |
|
|
float[][] bands = { {h1,30,0.16f,0.8f,5,1,0}, {h2,30,0.16f,0.2f,5,0,0} };
|
| 411 |
|
|
int[] bandIndices= { 0,0,1,1,1,1 };
|
| 412 |
|
|
return new ObjectFaceShape(bands,bandIndices,null);
|
| 413 |
|
|
}
|
| 414 |
|
|
else
|
| 415 |
|
|
{
|
| 416 |
a2c64ac3
|
Leszek Koltunski
|
float h1 = isInIconMode() ? 0.001f : 0.040f;
|
| 417 |
b3c8eeda
|
Leszek Koltunski
|
float h2 = isInIconMode() ? 0.001f : 0.002f;
|
| 418 |
a2c64ac3
|
Leszek Koltunski
|
float[][] bands = { {h1,30,0.3f,0.5f,5,0,0}, {h2,30,0.1f,0.2f,3,0,0} };
|
| 419 |
b3c8eeda
|
Leszek Koltunski
|
int[] bandIndices= { 0,1,1,1,1,1,1,1 };
|
| 420 |
5d7bb479
|
Leszek Koltunski
|
return new ObjectFaceShape(bands,bandIndices,null);
|
| 421 |
|
|
}
|
| 422 |
|
|
}
|
| 423 |
|
|
|
| 424 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 425 |
|
|
|
| 426 |
|
|
public ObjectVertexEffects getVertexEffects(int variant)
|
| 427 |
|
|
{
|
| 428 |
|
|
if( variant==0 )
|
| 429 |
|
|
{
|
| 430 |
|
|
float[][] corners = { {0.06f,0.12f} };
|
| 431 |
|
|
int[] indices = { -1,0,-1,0,0,0,-1,-1 };
|
| 432 |
|
|
float[][] centers = { { 0.0f, 0.0f, 0.0f} };
|
| 433 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
| 434 |
|
|
}
|
| 435 |
|
|
else if( variant==1 )
|
| 436 |
|
|
{
|
| 437 |
a2c64ac3
|
Leszek Koltunski
|
float[][] corners = { {0.05f,0.30f}, {0.05f,0.20f} };
|
| 438 |
5d7bb479
|
Leszek Koltunski
|
int[] cornerIndices = { 0,0,1,1 };
|
| 439 |
|
|
float[][] centers = { {0.0f, -0.75f, -0.75f} };
|
| 440 |
|
|
int[] centerIndices = { 0,0,0,0 };
|
| 441 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
| 442 |
|
|
}
|
| 443 |
|
|
else if( variant==2 )
|
| 444 |
|
|
{
|
| 445 |
a2c64ac3
|
Leszek Koltunski
|
float[][] corners = { {0.05f,0.20f}, {0.05f,0.15f} };
|
| 446 |
5d7bb479
|
Leszek Koltunski
|
int[] cornerIndices = { 0,0,1,1,1,1,1,1 };
|
| 447 |
|
|
float[][] centers = { {0.0f, -0.5f, -0.5f} };
|
| 448 |
|
|
int[] centerIndices = { 0,0,0,0,0,0,0,0 };
|
| 449 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
| 450 |
|
|
}
|
| 451 |
|
|
else
|
| 452 |
|
|
{
|
| 453 |
|
|
return null;
|
| 454 |
|
|
}
|
| 455 |
|
|
}
|
| 456 |
|
|
|
| 457 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 458 |
|
|
|
| 459 |
|
|
public int getNumCubitVariants(int[] numLayers)
|
| 460 |
|
|
{
|
| 461 |
b3c8eeda
|
Leszek Koltunski
|
return 5;
|
| 462 |
5d7bb479
|
Leszek Koltunski
|
}
|
| 463 |
|
|
|
| 464 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 465 |
|
|
|
| 466 |
|
|
public int getCubitVariant(int cubit, int[] numLayers)
|
| 467 |
|
|
{
|
| 468 |
b3c8eeda
|
Leszek Koltunski
|
return cubit<4 ? 0: (cubit<16 ? 1: (cubit<28 ? 2: (cubit<40 ? 3:4)));
|
| 469 |
5d7bb479
|
Leszek Koltunski
|
}
|
| 470 |
|
|
|
| 471 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 472 |
|
|
|
| 473 |
|
|
public float getStickerRadius()
|
| 474 |
|
|
{
|
| 475 |
|
|
return 0.09f;
|
| 476 |
|
|
}
|
| 477 |
|
|
|
| 478 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 479 |
|
|
|
| 480 |
|
|
public float getStickerStroke()
|
| 481 |
|
|
{
|
| 482 |
|
|
return isInIconMode() ? 0.20f : 0.09f;
|
| 483 |
|
|
}
|
| 484 |
|
|
|
| 485 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 486 |
|
|
|
| 487 |
|
|
public float[][] getStickerAngles()
|
| 488 |
|
|
{
|
| 489 |
|
|
return null;
|
| 490 |
|
|
}
|
| 491 |
|
|
|
| 492 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 493 |
|
|
// PUBLIC API
|
| 494 |
|
|
|
| 495 |
|
|
public Static3D[] getRotationAxis()
|
| 496 |
|
|
{
|
| 497 |
|
|
return ROT_AXIS;
|
| 498 |
|
|
}
|
| 499 |
|
|
|
| 500 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 501 |
|
|
|
| 502 |
|
|
public int[][] getBasicAngles()
|
| 503 |
|
|
{
|
| 504 |
|
|
if( mBasicAngle ==null )
|
| 505 |
|
|
{
|
| 506 |
|
|
int[] tmp = {3,3,3,3,3};
|
| 507 |
|
|
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
|
| 508 |
|
|
}
|
| 509 |
|
|
|
| 510 |
|
|
return mBasicAngle;
|
| 511 |
|
|
}
|
| 512 |
|
|
|
| 513 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 514 |
|
|
|
| 515 |
|
|
public String getShortName()
|
| 516 |
|
|
{
|
| 517 |
|
|
return ObjectType.TINS_5.name();
|
| 518 |
|
|
}
|
| 519 |
|
|
|
| 520 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 521 |
|
|
|
| 522 |
|
|
public ObjectSignature getSignature()
|
| 523 |
|
|
{
|
| 524 |
|
|
return new ObjectSignature(ObjectSignatures.TINS_5);
|
| 525 |
|
|
}
|
| 526 |
|
|
|
| 527 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 528 |
|
|
|
| 529 |
|
|
public String getObjectName()
|
| 530 |
|
|
{
|
| 531 |
|
|
return "Tins Cube";
|
| 532 |
|
|
}
|
| 533 |
|
|
|
| 534 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 535 |
|
|
|
| 536 |
|
|
public String getInventor()
|
| 537 |
|
|
{
|
| 538 |
|
|
return "조현준";
|
| 539 |
|
|
}
|
| 540 |
|
|
|
| 541 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 542 |
|
|
|
| 543 |
|
|
public int getYearOfInvention()
|
| 544 |
|
|
{
|
| 545 |
|
|
return 2021;
|
| 546 |
|
|
}
|
| 547 |
|
|
|
| 548 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 549 |
|
|
|
| 550 |
|
|
public int getComplexity()
|
| 551 |
|
|
{
|
| 552 |
|
|
return 2;
|
| 553 |
|
|
}
|
| 554 |
|
|
|
| 555 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 556 |
|
|
|
| 557 |
|
|
public String[][] getTutorials()
|
| 558 |
|
|
{
|
| 559 |
|
|
return null;
|
| 560 |
|
|
}
|
| 561 |
|
|
}
|