Revision efa81f0c
Added by Leszek Koltunski about 4 years ago
| src/main/java/org/distorted/objects/Twisty12.java | ||
|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 2 | // Copyright 2019 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.objects; | |
| 21 |  | |
| 22 | import android.content.res.Resources; | |
| 23 |  | |
| 24 | import org.distorted.library.main.DistortedEffects; | |
| 25 | import org.distorted.library.main.DistortedTexture; | |
| 26 | import org.distorted.library.mesh.MeshSquare; | |
| 27 | import org.distorted.library.type.Static4D; | |
| 28 |  | |
| 29 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 30 |  | |
| 31 | abstract class Twisty12 extends TwistyObject | |
| 32 | {
 | |
| 33 | static final int MINX_LGREEN = 0xff53aa00; | |
| 34 | static final int MINX_PINK = 0xfffd7ab7; | |
| 35 | static final int MINX_SANDY = 0xffefd48b; | |
| 36 | static final int MINX_LBLUE = 0xff00a2d7; | |
| 37 | static final int MINX_ORANGE = 0xffff6200; | |
| 38 | static final int MINX_VIOLET = 0xff7d59a4; | |
| 39 | static final int MINX_DGREEN = 0xff007a47; | |
| 40 | static final int MINX_DRED = 0xffbd0000; | |
| 41 | static final int MINX_DBLUE = 0xff1a29b2; | |
| 42 | static final int MINX_DYELLOW= 0xffffc400; | |
| 43 | static final int MINX_WHITE = 0xffffffff; | |
| 44 | static final int MINX_GREY = 0xff727c7b; | |
| 45 |  | |
| 46 | static final int[] FACE_COLORS = new int[] | |
| 47 |          {
 | |
| 48 | MINX_LGREEN, MINX_PINK , MINX_SANDY , MINX_LBLUE, | |
| 49 | MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED , | |
| 50 | MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY | |
| 51 | }; | |
| 52 |  | |
| 53 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 54 |  | |
| 55 | Twisty12(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh, | |
| 56 | DistortedEffects effects, int[][] moves, ObjectList list, Resources res, int scrWidth) | |
| 57 |     {
 | |
| 58 | super(numLayers, realSize, quat, texture, mesh, effects, moves, list, res, scrWidth); | |
| 59 | } | |
| 60 |  | |
| 61 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 62 |  | |
| 63 | int getColor(int face) | |
| 64 |     {
 | |
| 65 | return FACE_COLORS[face]; | |
| 66 | } | |
| 67 |  | |
| 68 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 69 |  | |
| 70 | int getNumFaceColors() | |
| 71 |     {
 | |
| 72 | return 12; | |
| 73 | } | |
| 74 |  | |
| 75 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 76 |  | |
| 77 | float getScreenRatio() | |
| 78 |     {
 | |
| 79 | return 0.33f; | |
| 80 | } | |
| 81 |  | |
| 82 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 83 |  | |
| 84 | float returnMultiplier() | |
| 85 |     {
 | |
| 86 | return 1.0f; | |
| 87 | } | |
| 88 | } | |
| src/main/java/org/distorted/objects/Twisty4.java | ||
|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 2 | // Copyright 2019 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.objects; | |
| 21 |  | |
| 22 | import android.content.res.Resources; | |
| 23 |  | |
| 24 | import org.distorted.library.main.DistortedEffects; | |
| 25 | import org.distorted.library.main.DistortedTexture; | |
| 26 | import org.distorted.library.mesh.MeshSquare; | |
| 27 | import org.distorted.library.type.Static4D; | |
| 28 |  | |
| 29 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 30 |  | |
| 31 | abstract class Twisty4 extends TwistyObject | |
| 32 | {
 | |
| 33 | private static final int[] FACE_COLORS = new int[] | |
| 34 |          {
 | |
| 35 | COLOR_GREEN , COLOR_YELLOW, | |
| 36 | COLOR_BLUE , COLOR_RED | |
| 37 | }; | |
| 38 |  | |
| 39 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 40 |  | |
| 41 | Twisty4(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh, | |
| 42 | DistortedEffects effects, int[][] moves, ObjectList list, Resources res, int scrWidth) | |
| 43 |     {
 | |
| 44 | super(numLayers, realSize, quat, texture, mesh, effects, moves, list, res, scrWidth); | |
| 45 | } | |
| 46 |  | |
| 47 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 48 |  | |
| 49 | int getColor(int face) | |
| 50 |     {
 | |
| 51 | return FACE_COLORS[face]; | |
| 52 | } | |
| 53 |  | |
| 54 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 55 |  | |
| 56 | int getNumFaceColors() | |
| 57 |     {
 | |
| 58 | return 4; | |
| 59 | } | |
| 60 |  | |
| 61 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 62 |  | |
| 63 | float getScreenRatio() | |
| 64 |     {
 | |
| 65 | return 0.88f; | |
| 66 | } | |
| 67 |  | |
| 68 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 69 |  | |
| 70 | float returnMultiplier() | |
| 71 |     {
 | |
| 72 | return getNumLayers()/(SQ6/3); | |
| 73 | } | |
| 74 | } | |
| src/main/java/org/distorted/objects/Twisty6.java | ||
|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 2 | // Copyright 2019 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.objects; | |
| 21 |  | |
| 22 | import android.content.res.Resources; | |
| 23 |  | |
| 24 | import org.distorted.library.main.DistortedEffects; | |
| 25 | import org.distorted.library.main.DistortedTexture; | |
| 26 | import org.distorted.library.mesh.MeshSquare; | |
| 27 | import org.distorted.library.type.Static4D; | |
| 28 |  | |
| 29 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 30 |  | |
| 31 | abstract class Twisty6 extends TwistyObject | |
| 32 | {
 | |
| 33 | private static final int[] FACE_COLORS = new int[] | |
| 34 |          {
 | |
| 35 | COLOR_YELLOW, COLOR_WHITE, | |
| 36 | COLOR_BLUE , COLOR_GREEN, | |
| 37 | COLOR_RED , COLOR_ORANGE | |
| 38 | }; | |
| 39 |  | |
| 40 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 41 |  | |
| 42 | Twisty6(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh, | |
| 43 | DistortedEffects effects, int[][] moves, ObjectList list, Resources res, int scrWidth) | |
| 44 |     {
 | |
| 45 | super(numLayers, realSize, quat, texture, mesh, effects, moves, list, res, scrWidth); | |
| 46 | } | |
| 47 |  | |
| 48 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 49 |  | |
| 50 | int getColor(int face) | |
| 51 |     {
 | |
| 52 | return FACE_COLORS[face]; | |
| 53 | } | |
| 54 |  | |
| 55 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 56 |  | |
| 57 | int getNumFaceColors() | |
| 58 |     {
 | |
| 59 | return 6; | |
| 60 | } | |
| 61 |  | |
| 62 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 63 |  | |
| 64 | float getScreenRatio() | |
| 65 |     {
 | |
| 66 | return 0.5f; | |
| 67 | } | |
| 68 |  | |
| 69 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 70 |  | |
| 71 | float returnMultiplier() | |
| 72 |     {
 | |
| 73 | return getNumLayers(); | |
| 74 | } | |
| 75 | } | |
| src/main/java/org/distorted/objects/Twisty8.java | ||
|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 2 | // Copyright 2019 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.objects; | |
| 21 |  | |
| 22 | import android.content.res.Resources; | |
| 23 |  | |
| 24 | import org.distorted.library.main.DistortedEffects; | |
| 25 | import org.distorted.library.main.DistortedTexture; | |
| 26 | import org.distorted.library.mesh.MeshSquare; | |
| 27 | import org.distorted.library.type.Static4D; | |
| 28 |  | |
| 29 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 30 |  | |
| 31 | abstract class Twisty8 extends TwistyObject | |
| 32 | {
 | |
| 33 | private static final int[] FACE_COLORS = new int[] | |
| 34 |          {
 | |
| 35 | COLOR_ORANGE, COLOR_VIOLET, | |
| 36 | COLOR_WHITE , COLOR_BLUE , | |
| 37 | COLOR_YELLOW, COLOR_RED , | |
| 38 | COLOR_GREEN , COLOR_GREY | |
| 39 | }; | |
| 40 |  | |
| 41 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 42 |  | |
| 43 | Twisty8(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh, | |
| 44 | DistortedEffects effects, int[][] moves, ObjectList list, Resources res, int scrWidth) | |
| 45 |     {
 | |
| 46 | super(numLayers, realSize, quat, texture, mesh, effects, moves, list, res, scrWidth); | |
| 47 | } | |
| 48 |  | |
| 49 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 50 |  | |
| 51 | int getColor(int face) | |
| 52 |     {
 | |
| 53 | return FACE_COLORS[face]; | |
| 54 | } | |
| 55 |  | |
| 56 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 57 |  | |
| 58 | int getNumFaceColors() | |
| 59 |     {
 | |
| 60 | return 8; | |
| 61 | } | |
| 62 |  | |
| 63 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 64 |  | |
| 65 | float getScreenRatio() | |
| 66 |     {
 | |
| 67 | return 0.65f; | |
| 68 | } | |
| 69 |  | |
| 70 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 71 |  | |
| 72 | float returnMultiplier() | |
| 73 |     {
 | |
| 74 | return 1.5f; | |
| 75 | } | |
| 76 | } | |
| src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
|---|---|---|
| 32 | 32 |  | 
| 33 | 33 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 34 | 34 |  | 
| 35 | abstract class TwistyBandagedAbstract extends TwistyObject
 | |
| 35 | abstract class TwistyBandagedAbstract extends Twisty6
 | |
| 36 | 36 | {
 | 
| 37 | 37 | // the three rotation axis of a 3x3 Cube. Must be normalized. | 
| 38 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| ... | ... | |
| 42 | 42 | new Static3D(0,0,1) | 
| 43 | 43 | }; | 
| 44 | 44 |  | 
| 45 | private static final int[] FACE_COLORS = new int[] | |
| 46 |          {
 | |
| 47 | COLOR_YELLOW, COLOR_WHITE, | |
| 48 | COLOR_BLUE , COLOR_GREEN, | |
| 49 | COLOR_RED , COLOR_ORANGE | |
| 50 | }; | |
| 51 |  | |
| 52 | 45 | private static final int[][] mDimensions = new int[][] | 
| 53 | 46 |         {
 | 
| 54 | 47 |          {1,1,1},  // has to be X>=Z>=Y so that all
 | 
| ... | ... | |
| 258 | 251 | return 1; | 
| 259 | 252 | } | 
| 260 | 253 |  | 
| 261 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 262 |  | |
| 263 | int getColor(int face) | |
| 264 |     {
 | |
| 265 | return FACE_COLORS[face]; | |
| 266 | } | |
| 267 |  | |
| 268 | 254 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 269 | 255 |  | 
| 270 | 256 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 323 | 309 | return mQuats; | 
| 324 | 310 | } | 
| 325 | 311 |  | 
| 326 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 327 |  | |
| 328 | boolean shouldResetTextureMaps() | |
| 329 |     {
 | |
| 330 | return false; | |
| 331 | } | |
| 332 |  | |
| 333 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 334 |  | |
| 335 | int getNumFaceColors() | |
| 336 |     {
 | |
| 337 | return FACE_COLORS.length; | |
| 338 | } | |
| 339 |  | |
| 340 | 312 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 341 | 313 |  | 
| 342 | 314 | float[][] getCuts(int numLayers) | 
| ... | ... | |
| 372 | 344 |  | 
| 373 | 345 | int getNumCubitFaces() | 
| 374 | 346 |     {
 | 
| 375 | return FACE_COLORS.length; | |
| 376 | } | |
| 377 |  | |
| 378 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 379 |  | |
| 380 | float getScreenRatio() | |
| 381 |     {
 | |
| 382 | return 0.5f; | |
| 347 | return 6; | |
| 383 | 348 | } | 
| 384 | 349 |  | 
| 385 | 350 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 454 | 419 | return reaches ? stickerIndex*NUM_FACE_COLORS + face : NUM_TEXTURES; | 
| 455 | 420 | } | 
| 456 | 421 |  | 
| 457 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 458 |  | |
| 459 | float returnMultiplier() | |
| 460 |     {
 | |
| 461 | return getNumLayers(); | |
| 462 | } | |
| 463 |  | |
| 464 | 422 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 465 | 423 | // PUBLIC API | 
| 466 | 424 |  | 
| src/main/java/org/distorted/objects/TwistyBandagedFused.java | ||
|---|---|---|
| 99 | 99 |  | 
| 100 | 100 | int[] getQuatIndices() | 
| 101 | 101 |     {
 | 
| 102 | if( QUAT_INDICES==null ) | |
| 103 |       {
 | |
| 104 |       QUAT_INDICES = new int[] { 0 };
 | |
| 105 | } | |
| 106 |  | |
| 102 |     if( QUAT_INDICES==null ) QUAT_INDICES = new int[] { 0 };
 | |
| 107 | 103 | return QUAT_INDICES; | 
| 108 | 104 | } | 
| 109 | 105 |  | 
| src/main/java/org/distorted/objects/TwistyCube.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | class TwistyCube extends TwistyObject
 | |
| 36 | class TwistyCube extends Twisty6
 | |
| 37 | 37 | {
 | 
| 38 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 39 | 39 |          {
 | 
| ... | ... | |
| 42 | 42 | new Static3D(0,0,1) | 
| 43 | 43 | }; | 
| 44 | 44 |  | 
| 45 | private static final int[] FACE_COLORS = new int[] | |
| 46 |          {
 | |
| 47 | COLOR_YELLOW, COLOR_WHITE, | |
| 48 | COLOR_BLUE , COLOR_GREEN, | |
| 49 | COLOR_RED , COLOR_ORANGE | |
| 50 | }; | |
| 51 |  | |
| 52 | 45 | private ScrambleState[] mStates; | 
| 53 | 46 | private Static4D[] mQuats; | 
| 54 | 47 | private int[] mBasicAngle; | 
| ... | ... | |
| 232 | 225 | return 0; | 
| 233 | 226 | } | 
| 234 | 227 |  | 
| 235 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 236 |  | |
| 237 | int getColor(int face) | |
| 238 |     {
 | |
| 239 | return FACE_COLORS[face]; | |
| 240 | } | |
| 241 |  | |
| 242 | 228 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 243 | 229 |  | 
| 244 | 230 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 285 | 271 | return mQuats; | 
| 286 | 272 | } | 
| 287 | 273 |  | 
| 288 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 289 |  | |
| 290 | boolean shouldResetTextureMaps() | |
| 291 |     {
 | |
| 292 | return false; | |
| 293 | } | |
| 294 |  | |
| 295 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 296 |  | |
| 297 | int getNumFaceColors() | |
| 298 |     {
 | |
| 299 | return FACE_COLORS.length; | |
| 300 | } | |
| 301 |  | |
| 302 | 274 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 303 | 275 |  | 
| 304 | 276 | float[][] getCuts(int numLayers) | 
| ... | ... | |
| 334 | 306 |  | 
| 335 | 307 | int getNumCubitFaces() | 
| 336 | 308 |     {
 | 
| 337 | return FACE_COLORS.length; | |
| 338 | } | |
| 339 |  | |
| 340 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 341 |  | |
| 342 | float getScreenRatio() | |
| 343 |     {
 | |
| 344 | return 0.5f; | |
| 309 | return 6; | |
| 345 | 310 | } | 
| 346 | 311 |  | 
| 347 | 312 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 351 | 316 | return CUBITS[cubit].mRotationRow[cubitface/2] == (cubitface%2==0 ? (1<<(numLayers-1)):1) ? cubitface : NUM_TEXTURES; | 
| 352 | 317 | } | 
| 353 | 318 |  | 
| 354 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 355 |  | |
| 356 | float returnMultiplier() | |
| 357 |     {
 | |
| 358 | return getNumLayers(); | |
| 359 | } | |
| 360 |  | |
| 361 | 319 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 362 | 320 | // PUBLIC API | 
| 363 | 321 |  | 
| src/main/java/org/distorted/objects/TwistyDiamond.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyDiamond extends TwistyObject
 | |
| 36 | public class TwistyDiamond extends Twisty8
 | |
| 37 | 37 | {
 | 
| 38 | 38 | // the four rotation axis of a Diamond. Must be normalized. | 
| 39 | 39 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| ... | ... | |
| 44 | 44 | new Static3D( 0,-SQ3/3,+SQ6/3) | 
| 45 | 45 | }; | 
| 46 | 46 |  | 
| 47 | private static final int[] FACE_COLORS = new int[] | |
| 48 |          {
 | |
| 49 | COLOR_ORANGE, COLOR_VIOLET, | |
| 50 | COLOR_WHITE , COLOR_BLUE , | |
| 51 | COLOR_YELLOW, COLOR_RED , | |
| 52 | COLOR_GREEN , COLOR_GREY | |
| 53 | }; | |
| 54 |  | |
| 55 | private static final int FACES_PER_CUBIT =8; | |
| 56 |  | |
| 57 | 47 | private ScrambleState[] mStates; | 
| 58 | 48 | private int[] mBasicAngle; | 
| 59 | 49 | private int[] mFaceMap; | 
| ... | ... | |
| 127 | 117 | return status<0 ? null : buildSolvedQuats(MovementDiamond.FACE_AXIS[mFaceMap[status]],mQuats); | 
| 128 | 118 | } | 
| 129 | 119 |  | 
| 130 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 131 |  | |
| 132 | float getScreenRatio() | |
| 133 |     {
 | |
| 134 | return 0.65f; | |
| 135 | } | |
| 136 |  | |
| 137 | 120 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 138 | 121 |  | 
| 139 | 122 | Static4D[] getQuats() | 
| ... | ... | |
| 142 | 125 | return mQuats; | 
| 143 | 126 | } | 
| 144 | 127 |  | 
| 145 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 146 |  | |
| 147 | int getNumFaceColors() | |
| 148 |     {
 | |
| 149 | return FACE_COLORS.length; | |
| 150 | } | |
| 151 |  | |
| 152 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 153 |  | |
| 154 | boolean shouldResetTextureMaps() | |
| 155 |     {
 | |
| 156 | return false; | |
| 157 | } | |
| 158 |  | |
| 159 | 128 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 160 | 129 |  | 
| 161 | 130 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 201 | 170 |  | 
| 202 | 171 | int getNumCubitFaces() | 
| 203 | 172 |     {
 | 
| 204 |     return FACES_PER_CUBIT;
 | |
| 173 |     return 8;
 | |
| 205 | 174 | } | 
| 206 | 175 |  | 
| 207 | 176 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 481 | 450 | } | 
| 482 | 451 | } | 
| 483 | 452 |  | 
| 484 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 485 |  | |
| 486 | int getColor(int face) | |
| 487 |     {
 | |
| 488 | return FACE_COLORS[face]; | |
| 489 | } | |
| 490 |  | |
| 491 | 453 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 492 | 454 |  | 
| 493 | 455 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 505 | 467 | return mStickers[face/NUM_FACE_COLORS]; | 
| 506 | 468 | } | 
| 507 | 469 |  | 
| 508 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 509 |  | |
| 510 | float returnMultiplier() | |
| 511 |     {
 | |
| 512 | return 1.5f; | |
| 513 | } | |
| 514 |  | |
| 515 | 470 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 516 | 471 | // PUBLIC API | 
| 517 | 472 |  | 
| src/main/java/org/distorted/objects/TwistyDino.java | ||
|---|---|---|
| 32 | 32 |  | 
| 33 | 33 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 34 | 34 |  | 
| 35 | public abstract class TwistyDino extends TwistyObject
 | |
| 35 | public abstract class TwistyDino extends Twisty6
 | |
| 36 | 36 | {
 | 
| 37 | 37 | // the four rotation axis of a RubikDino. Must be normalized. | 
| 38 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| ... | ... | |
| 43 | 43 | new Static3D(+SQ3/3,-SQ3/3,-SQ3/3) | 
| 44 | 44 | }; | 
| 45 | 45 |  | 
| 46 | private static final int[] FACE_COLORS = new int[] | |
| 47 |          {
 | |
| 48 | COLOR_YELLOW, COLOR_WHITE, | |
| 49 | COLOR_BLUE , COLOR_GREEN, | |
| 50 | COLOR_RED , COLOR_ORANGE | |
| 51 | }; | |
| 52 |  | |
| 53 | 46 | private int[] mBasicAngle; | 
| 54 | 47 | private Static4D[] mQuats; | 
| 55 | 48 | private ObjectSticker[] mStickers; | 
| ... | ... | |
| 86 | 79 | }; | 
| 87 | 80 | } | 
| 88 | 81 |  | 
| 89 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 90 |  | |
| 91 | float getScreenRatio() | |
| 92 |     {
 | |
| 93 | return 0.5f; | |
| 94 | } | |
| 95 |  | |
| 96 | 82 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 97 | 83 |  | 
| 98 | 84 | Static4D[] getQuats() | 
| ... | ... | |
| 101 | 87 | return mQuats; | 
| 102 | 88 | } | 
| 103 | 89 |  | 
| 104 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 105 |  | |
| 106 | int getNumFaceColors() | |
| 107 |     {
 | |
| 108 | return FACE_COLORS.length; | |
| 109 | } | |
| 110 |  | |
| 111 | 90 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 112 | 91 |  | 
| 113 | 92 | float[][] getCuts(int size) | 
| ... | ... | |
| 193 | 172 | return 0; | 
| 194 | 173 | } | 
| 195 | 174 |  | 
| 196 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 197 |  | |
| 198 | int getColor(int face) | |
| 199 |     {
 | |
| 200 | return FACE_COLORS[face]; | |
| 201 | } | |
| 202 |  | |
| 203 | 175 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 204 | 176 |  | 
| 205 | 177 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 217 | 189 | return mStickers[face/NUM_FACE_COLORS]; | 
| 218 | 190 | } | 
| 219 | 191 |  | 
| 220 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 221 |  | |
| 222 | float returnMultiplier() | |
| 223 |     {
 | |
| 224 | return 2.0f; | |
| 225 | } | |
| 226 |  | |
| 227 | 192 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 228 | 193 | // PUBLIC API | 
| 229 | 194 |  | 
| src/main/java/org/distorted/objects/TwistyDino6.java | ||
|---|---|---|
| 96 | 96 | return 2; | 
| 97 | 97 | } | 
| 98 | 98 |  | 
| 99 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 100 |  | |
| 101 | boolean shouldResetTextureMaps() | |
| 102 |     {
 | |
| 103 | return false; | |
| 104 | } | |
| 105 |  | |
| 106 | 99 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 107 | 100 |  | 
| 108 | 101 | public int getObjectName(int numLayers) | 
| src/main/java/org/distorted/objects/TwistyHelicopter.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyHelicopter extends TwistyObject
 | |
| 36 | public class TwistyHelicopter extends Twisty6
 | |
| 37 | 37 | {
 | 
| 38 | 38 | // the six rotation axis of a Helicopter. Must be normalized. | 
| 39 | 39 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| ... | ... | |
| 46 | 46 | new Static3D(-SQ2/2, -SQ2/2, 0) | 
| 47 | 47 | }; | 
| 48 | 48 |  | 
| 49 | private static final int[] FACE_COLORS = new int[] | |
| 50 |          {
 | |
| 51 | COLOR_YELLOW, COLOR_WHITE, | |
| 52 | COLOR_BLUE , COLOR_GREEN, | |
| 53 | COLOR_RED , COLOR_ORANGE | |
| 54 | }; | |
| 55 |  | |
| 56 | private static final int FACES_PER_CUBIT =6; | |
| 57 |  | |
| 58 | 49 | private ScrambleState[] mStates; | 
| 59 | 50 | private int[] mBasicAngle; | 
| 60 | 51 | private Static4D[] mQuats; | 
| ... | ... | |
| 143 | 134 | return status<0 ? null : buildSolvedQuats(MovementHelicopter.FACE_AXIS[status],mQuats); | 
| 144 | 135 | } | 
| 145 | 136 |  | 
| 146 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 147 |  | |
| 148 | float getScreenRatio() | |
| 149 |     {
 | |
| 150 | return 0.5f; | |
| 151 | } | |
| 152 |  | |
| 153 | 137 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 154 | 138 |  | 
| 155 | 139 | Static4D[] getQuats() | 
| ... | ... | |
| 158 | 142 | return mQuats; | 
| 159 | 143 | } | 
| 160 | 144 |  | 
| 161 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 162 |  | |
| 163 | boolean shouldResetTextureMaps() | |
| 164 |     {
 | |
| 165 | return false; | |
| 166 | } | |
| 167 |  | |
| 168 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 169 |  | |
| 170 | int getNumFaceColors() | |
| 171 |     {
 | |
| 172 | return FACE_COLORS.length; | |
| 173 | } | |
| 174 |  | |
| 175 | 145 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 176 | 146 |  | 
| 177 | 147 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 198 | 168 |  | 
| 199 | 169 | int getNumCubitFaces() | 
| 200 | 170 |     {
 | 
| 201 |     return FACES_PER_CUBIT;
 | |
| 171 |     return 4;
 | |
| 202 | 172 | } | 
| 203 | 173 |  | 
| 204 | 174 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 395 | 365 | return mFaceMap[cubit][cubitface]; | 
| 396 | 366 | } | 
| 397 | 367 |  | 
| 398 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 399 |  | |
| 400 | int getColor(int face) | |
| 401 |     {
 | |
| 402 | return FACE_COLORS[face]; | |
| 403 | } | |
| 404 |  | |
| 405 | 368 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 406 | 369 |  | 
| 407 | 370 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 419 | 382 | return mStickers[face/NUM_FACE_COLORS]; | 
| 420 | 383 | } | 
| 421 | 384 |  | 
| 422 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 423 |  | |
| 424 | float returnMultiplier() | |
| 425 |     {
 | |
| 426 | return 2.0f; | |
| 427 | } | |
| 428 |  | |
| 429 | 385 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 430 | 386 | // PUBLIC API | 
| 431 | 387 |  | 
| src/main/java/org/distorted/objects/TwistyIvy.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyIvy extends TwistyObject
 | |
| 36 | public class TwistyIvy extends Twisty6
 | |
| 37 | 37 | {
 | 
| 38 | // the four rotation axis of a RubikIvy. Must be normalized. | |
| 39 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 40 | 39 |          {
 | 
| 41 | 40 | new Static3D(+SQ3/3,+SQ3/3,+SQ3/3), | 
| ... | ... | |
| 44 | 43 | new Static3D(+SQ3/3,-SQ3/3,-SQ3/3) | 
| 45 | 44 | }; | 
| 46 | 45 |  | 
| 47 | private static final int[] FACE_COLORS = new int[] | |
| 48 |          {
 | |
| 49 | COLOR_YELLOW, COLOR_WHITE, | |
| 50 | COLOR_BLUE , COLOR_GREEN, | |
| 51 | COLOR_RED , COLOR_ORANGE | |
| 52 | }; | |
| 53 |  | |
| 54 | 46 | private static final int NUM_STICKERS = 2; | 
| 55 | 47 | public static final float IVY_D = 0.006f; | 
| 56 | 48 | private static final int IVY_N = 8; | 
| 57 | private static final int FACES_PER_CUBIT =6; | |
| 58 | 49 |  | 
| 59 | 50 | private ScrambleState[] mStates; | 
| 60 | 51 | private int[] mBasicAngle; | 
| ... | ... | |
| 69 | 60 | MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth) | 
| 70 | 61 |     {
 | 
| 71 | 62 | super(size, size, quat, texture, mesh, effects, moves, ObjectList.IVY, res, scrWidth); | 
| 72 |  | |
| 73 |     int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
 | |
| 74 |  | |
| 75 | mStates = new ScrambleState[] | |
| 76 |       {
 | |
| 77 |       new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
 | |
| 78 | }; | |
| 79 | 63 | } | 
| 80 | 64 |  | 
| 81 | 65 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 126 | 110 | return status<0 ? null : buildSolvedQuats(MovementIvy.FACE_AXIS[status],mQuats); | 
| 127 | 111 | } | 
| 128 | 112 |  | 
| 129 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 130 |  | |
| 131 | float getScreenRatio() | |
| 132 |     {
 | |
| 133 | return 0.5f; | |
| 134 | } | |
| 135 |  | |
| 136 | 113 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 137 | 114 |  | 
| 138 | 115 | Static4D[] getQuats() | 
| ... | ... | |
| 141 | 118 | return mQuats; | 
| 142 | 119 | } | 
| 143 | 120 |  | 
| 144 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 145 |  | |
| 146 | int getNumFaceColors() | |
| 147 |     {
 | |
| 148 | return FACE_COLORS.length; | |
| 149 | } | |
| 150 |  | |
| 151 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 152 |  | |
| 153 | boolean shouldResetTextureMaps() | |
| 154 |     {
 | |
| 155 | return false; | |
| 156 | } | |
| 157 |  | |
| 158 | 121 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 159 | 122 |  | 
| 160 | 123 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 181 | 144 |  | 
| 182 | 145 | int getNumCubitFaces() | 
| 183 | 146 |     {
 | 
| 184 |     return FACES_PER_CUBIT;
 | |
| 147 |     return 6;
 | |
| 185 | 148 | } | 
| 186 | 149 |  | 
| 187 | 150 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 427 | 390 | return mFaceMap[cubit][cubitface]; | 
| 428 | 391 | } | 
| 429 | 392 |  | 
| 430 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 431 |  | |
| 432 | int getColor(int face) | |
| 433 |     {
 | |
| 434 | return FACE_COLORS[face]; | |
| 435 | } | |
| 436 |  | |
| 437 | 393 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 438 | 394 |  | 
| 439 | 395 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 452 | 408 | return mStickers[face/NUM_FACE_COLORS]; | 
| 453 | 409 | } | 
| 454 | 410 |  | 
| 455 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 456 |  | |
| 457 | float returnMultiplier() | |
| 458 |     {
 | |
| 459 | return 2.0f; | |
| 460 | } | |
| 461 |  | |
| 462 | 411 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 463 | 412 | // PUBLIC API | 
| 464 | 413 |  | 
| src/main/java/org/distorted/objects/TwistyJing.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyJing extends TwistyObject
 | |
| 36 | public class TwistyJing extends Twisty4
 | |
| 37 | 37 | {
 | 
| 38 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 39 | 39 |          {
 | 
| ... | ... | |
| 43 | 43 | new Static3D(-SQ6/3,+SQ3/3, 0), | 
| 44 | 44 | }; | 
| 45 | 45 |  | 
| 46 | private static final int[] FACE_COLORS = new int[] | |
| 47 |          {
 | |
| 48 | COLOR_GREEN , COLOR_YELLOW, | |
| 49 | COLOR_BLUE , COLOR_RED | |
| 50 | }; | |
| 51 |  | |
| 52 | 46 | static final float F = 0.48f; // length of the edge of the corner cubit. Keep<0.5 | 
| 53 | 47 | // Assuming the length of the edge of the whole | 
| 54 | 48 | // tetrahedron is 2.0 (ie standard, equal to numLayers | 
| ... | ... | |
| 155 | 149 | return mQuats; | 
| 156 | 150 | } | 
| 157 | 151 |  | 
| 158 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 159 |  | |
| 160 | int getNumFaceColors() | |
| 161 |     {
 | |
| 162 | return FACE_COLORS.length; | |
| 163 | } | |
| 164 |  | |
| 165 | 152 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 166 | 153 |  | 
| 167 | 154 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 191 | 178 | return 6; | 
| 192 | 179 | } | 
| 193 | 180 |  | 
| 194 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 195 |  | |
| 196 | float getScreenRatio() | |
| 197 |     {
 | |
| 198 | return 0.88f; | |
| 199 | } | |
| 200 |  | |
| 201 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 202 |  | |
| 203 | boolean shouldResetTextureMaps() | |
| 204 |     {
 | |
| 205 | return false; | |
| 206 | } | |
| 207 |  | |
| 208 | 181 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 209 | 182 |  | 
| 210 | 183 | int getFaceColor(int cubit, int cubitface, int size) | 
| ... | ... | |
| 370 | 343 | return cubit<4 ? 0 : (cubit<10?1:2); | 
| 371 | 344 | } | 
| 372 | 345 |  | 
| 373 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 374 |  | |
| 375 | int getColor(int face) | |
| 376 |     {
 | |
| 377 | return FACE_COLORS[face]; | |
| 378 | } | |
| 379 |  | |
| 380 | 346 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 381 | 347 |  | 
| 382 | 348 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 406 | 372 | return mStickers[face/NUM_FACE_COLORS]; | 
| 407 | 373 | } | 
| 408 | 374 |  | 
| 409 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 410 | // SQ6/3 = height of the tetrahedron | |
| 411 |  | |
| 412 | float returnMultiplier() | |
| 413 |     {
 | |
| 414 | return getNumLayers()/(SQ6/3); | |
| 415 | } | |
| 416 |  | |
| 417 | 375 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 418 | 376 | // PUBLIC API | 
| 419 | 377 |  | 
| src/main/java/org/distorted/objects/TwistyKilominx.java | ||
|---|---|---|
| 86 | 86 | return numLayers<5 ? 1 : numLayers/2 + 1; | 
| 87 | 87 | } | 
| 88 | 88 |  | 
| 89 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 90 |  | |
| 91 | float getScreenRatio() | |
| 92 |     {
 | |
| 93 | return 0.33f; | |
| 94 | } | |
| 95 |  | |
| 96 | 89 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 97 | 90 |  | 
| 98 | 91 | float[][] getCuts(int numLayers) | 
| ... | ... | |
| 657 | 650 | } | 
| 658 | 651 | } | 
| 659 | 652 |  | 
| 660 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 661 |  | |
| 662 | int getColor(int face) | |
| 663 |     {
 | |
| 664 | return FACE_COLORS[face]; | |
| 665 | } | |
| 666 |  | |
| 667 | 653 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 668 | 654 |  | 
| 669 | 655 | ObjectSticker retSticker(int face) | 
| src/main/java/org/distorted/objects/TwistyMegaminx.java | ||
|---|---|---|
| 66 | 66 | return numLayers-2; | 
| 67 | 67 | } | 
| 68 | 68 |  | 
| 69 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 70 |  | |
| 71 | float getScreenRatio() | |
| 72 |     {
 | |
| 73 | return 0.356f; | |
| 74 | } | |
| 75 |  | |
| 76 | 69 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 77 | 70 |  | 
| 78 | 71 | int getNumStickerTypes(int numLayers) | 
| ... | ... | |
| 562 | 555 | } | 
| 563 | 556 | } | 
| 564 | 557 |  | 
| 565 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 566 |  | |
| 567 | int getColor(int face) | |
| 568 |     {
 | |
| 569 | return FACE_COLORS[face]; | |
| 570 | } | |
| 571 |  | |
| 572 | 558 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 573 | 559 |  | 
| 574 | 560 | ObjectSticker retSticker(int face) | 
| src/main/java/org/distorted/objects/TwistyMinx.java | ||
|---|---|---|
| 31 | 31 |  | 
| 32 | 32 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 33 | 33 |  | 
| 34 | abstract class TwistyMinx extends TwistyObject
 | |
| 34 | abstract class TwistyMinx extends Twisty12
 | |
| 35 | 35 | {
 | 
| 36 | private static final int FACES_PER_CUBIT =6; | |
| 37 |  | |
| 38 | 36 | static final int NUM_CORNERS = 20; | 
| 39 | 37 | static final int NUM_CENTERS = 12; | 
| 40 | 38 | static final int NUM_EDGES = 30; | 
| ... | ... | |
| 59 | 57 | new Static3D( SIN54/LEN, 0 , -C2/LEN ) | 
| 60 | 58 | }; | 
| 61 | 59 |  | 
| 62 | static final int MINX_LGREEN = 0xff53aa00; | |
| 63 | static final int MINX_PINK = 0xfffd7ab7; | |
| 64 | static final int MINX_SANDY = 0xffefd48b; | |
| 65 | static final int MINX_LBLUE = 0xff00a2d7; | |
| 66 | static final int MINX_ORANGE = 0xffff6200; | |
| 67 | static final int MINX_VIOLET = 0xff7d59a4; | |
| 68 | static final int MINX_DGREEN = 0xff007a47; | |
| 69 | static final int MINX_DRED = 0xffbd0000; | |
| 70 | static final int MINX_DBLUE = 0xff1a29b2; | |
| 71 | static final int MINX_DYELLOW= 0xffffc400; | |
| 72 | static final int MINX_WHITE = 0xffffffff; | |
| 73 | static final int MINX_GREY = 0xff727c7b; | |
| 74 |  | |
| 75 | static final int[] FACE_COLORS = new int[] | |
| 76 |          {
 | |
| 77 | MINX_LGREEN, MINX_PINK , MINX_SANDY , MINX_LBLUE, | |
| 78 | MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED , | |
| 79 | MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY | |
| 80 | }; | |
| 81 |  | |
| 82 | 60 | private ScrambleState[] mStates; | 
| 83 | 61 | private int[] mBasicAngle; | 
| 84 | 62 | private int[] mFaceMap; | 
| ... | ... | |
| 527 | 505 | return mQuats; | 
| 528 | 506 | } | 
| 529 | 507 |  | 
| 530 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 531 |  | |
| 532 | int getNumFaceColors() | |
| 533 |     {
 | |
| 534 | return FACE_COLORS.length; | |
| 535 | } | |
| 536 |  | |
| 537 | 508 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 538 | 509 |  | 
| 539 | 510 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 541 | 512 | return 0; | 
| 542 | 513 | } | 
| 543 | 514 |  | 
| 544 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 545 |  | |
| 546 | boolean shouldResetTextureMaps() | |
| 547 |     {
 | |
| 548 | return false; | |
| 549 | } | |
| 550 |  | |
| 551 | 515 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 552 | 516 |  | 
| 553 | 517 | int getNumCubitFaces() | 
| 554 | 518 |     {
 | 
| 555 | return FACES_PER_CUBIT; | |
| 556 | } | |
| 557 |  | |
| 558 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 559 |  | |
| 560 | float returnMultiplier() | |
| 561 |     {
 | |
| 562 | return 2.0f; | |
| 519 | return 6; | |
| 563 | 520 | } | 
| 564 | 521 |  | 
| 565 | 522 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| src/main/java/org/distorted/objects/TwistyMirror.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | class TwistyMirror extends TwistyObject
 | |
| 36 | class TwistyMirror extends Twisty6
 | |
| 37 | 37 | {
 | 
| 38 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 39 | 39 |          {
 | 
| ... | ... | |
| 580 | 580 | return mQuats; | 
| 581 | 581 | } | 
| 582 | 582 |  | 
| 583 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 584 |  | |
| 585 | boolean shouldResetTextureMaps() | |
| 586 |     {
 | |
| 587 | return false; | |
| 588 | } | |
| 589 |  | |
| 590 | 583 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 591 | 584 |  | 
| 592 | 585 | int getNumFaceColors() | 
| 593 | 586 |     {
 | 
| 594 |     return FACE_COLORS.length;
 | |
| 587 |     return 1;
 | |
| 595 | 588 | } | 
| 596 | 589 |  | 
| 597 | 590 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 625 | 618 | return 6; | 
| 626 | 619 | } | 
| 627 | 620 |  | 
| 628 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 629 |  | |
| 630 | float getScreenRatio() | |
| 631 |     {
 | |
| 632 | return 0.5f; | |
| 633 | } | |
| 634 |  | |
| 635 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 636 |  | |
| 637 | float returnMultiplier() | |
| 638 |     {
 | |
| 639 | return getNumLayers(); | |
| 640 | } | |
| 641 |  | |
| 642 | 621 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 643 | 622 | // PUBLIC API | 
| 644 | 623 |  | 
| src/main/java/org/distorted/objects/TwistyObject.java | ||
|---|---|---|
| 388 | 388 | return nonBlackIndex; | 
| 389 | 389 | } | 
| 390 | 390 |  | 
| 391 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 392 |  | |
| 393 | boolean shouldResetTextureMaps() | |
| 394 |     {
 | |
| 395 | return false; | |
| 396 | } | |
| 397 |  | |
| 391 | 398 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 392 | 399 |  | 
| 393 | 400 | int[] buildSolvedQuats(Static3D faceAx, Static4D[] quats) | 
| ... | ... | |
| 1293 | 1300 | abstract int getFaceColor(int cubit, int cubitface, int numLayers); | 
| 1294 | 1301 | abstract float returnMultiplier(); | 
| 1295 | 1302 | abstract float[][] getCuts(int numLayers); | 
| 1296 | abstract boolean shouldResetTextureMaps(); | |
| 1297 | 1303 | abstract int getCubitVariant(int cubit, int numLayers); | 
| 1298 | 1304 | abstract int getNumCubitVariants(int numLayers); | 
| 1299 | 1305 | abstract Static4D getQuat(int cubit, int numLayers); | 
| src/main/java/org/distorted/objects/TwistyPyraminx.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyPyraminx extends TwistyObject
 | |
| 36 | public class TwistyPyraminx extends Twisty4
 | |
| 37 | 37 | {
 | 
| 38 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 39 | 39 |          {
 | 
| ... | ... | |
| 43 | 43 | new Static3D(-SQ6/3,+SQ3/3, 0), | 
| 44 | 44 | }; | 
| 45 | 45 |  | 
| 46 | private static final int[] FACE_COLORS = new int[] | |
| 47 |          {
 | |
| 48 | COLOR_GREEN , COLOR_YELLOW, | |
| 49 | COLOR_BLUE , COLOR_RED | |
| 50 | }; | |
| 51 |  | |
| 52 | 46 | private ScrambleState[] mStates; | 
| 53 | 47 | private int[] mBasicAngle; | 
| 54 | 48 | private Static4D[] mQuats; | 
| ... | ... | |
| 202 | 196 | return mQuats; | 
| 203 | 197 | } | 
| 204 | 198 |  | 
| 205 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 206 |  | |
| 207 | int getNumFaceColors() | |
| 208 |     {
 | |
| 209 | return FACE_COLORS.length; | |
| 210 | } | |
| 211 |  | |
| 212 | 199 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 213 | 200 |  | 
| 214 | 201 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 248 | 235 | return 8; | 
| 249 | 236 | } | 
| 250 | 237 |  | 
| 251 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 252 |  | |
| 253 | float getScreenRatio() | |
| 254 |     {
 | |
| 255 | return 0.88f; | |
| 256 | } | |
| 257 |  | |
| 258 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 259 |  | |
| 260 | boolean shouldResetTextureMaps() | |
| 261 |     {
 | |
| 262 | return false; | |
| 263 | } | |
| 264 |  | |
| 265 | 238 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 266 | 239 |  | 
| 267 | 240 | private int getNumOctahedrons(int numLayers) | 
| ... | ... | |
| 355 | 328 | return cubit<getNumOctahedrons(numLayers) ? 0:1; | 
| 356 | 329 | } | 
| 357 | 330 |  | 
| 358 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 359 |  | |
| 360 | int getColor(int face) | |
| 361 |     {
 | |
| 362 | return FACE_COLORS[face]; | |
| 363 | } | |
| 364 |  | |
| 365 | 331 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 366 | 332 |  | 
| 367 | 333 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 379 | 345 | return mStickers[face/NUM_FACE_COLORS]; | 
| 380 | 346 | } | 
| 381 | 347 |  | 
| 382 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 383 | // SQ6/3 = height of the tetrahedron | |
| 384 |  | |
| 385 | float returnMultiplier() | |
| 386 |     {
 | |
| 387 | return getNumLayers()/(SQ6/3); | |
| 388 | } | |
| 389 |  | |
| 390 | 348 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 391 | 349 | // public API | 
| 392 | 350 |  | 
| src/main/java/org/distorted/objects/TwistyRedi.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyRedi extends TwistyObject
 | |
| 36 | public class TwistyRedi extends Twisty6
 | |
| 37 | 37 | {
 | 
| 38 | // the four rotation axis of a Redi. Must be normalized. | |
| 39 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 40 | 39 |          {
 | 
| 41 | 40 | new Static3D(+SQ3/3,+SQ3/3,+SQ3/3), | 
| ... | ... | |
| 44 | 43 | new Static3D(+SQ3/3,-SQ3/3,-SQ3/3) | 
| 45 | 44 | }; | 
| 46 | 45 |  | 
| 47 | private static final int[] FACE_COLORS = new int[] | |
| 48 |          {
 | |
| 49 | COLOR_YELLOW, COLOR_WHITE, | |
| 50 | COLOR_BLUE , COLOR_GREEN, | |
| 51 | COLOR_RED , COLOR_ORANGE | |
| 52 | }; | |
| 53 |  | |
| 54 | private static final int FACES_PER_CUBIT =9; | |
| 55 |  | |
| 56 | 46 | private ScrambleState[] mStates; | 
| 57 | 47 | private int[] mBasicAngle; | 
| 58 | 48 | private Static4D[] mQuats; | 
| ... | ... | |
| 123 | 113 | return status<0 ? null : buildSolvedQuats(MovementCornerTwisting.FACE_AXIS[status],mQuats); | 
| 124 | 114 | } | 
| 125 | 115 |  | 
| 126 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 127 |  | |
| 128 | float getScreenRatio() | |
| 129 |     {
 | |
| 130 | return 0.50f; | |
| 131 | } | |
| 132 |  | |
| 133 | 116 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 134 | 117 |  | 
| 135 | 118 | Static4D[] getQuats() | 
| ... | ... | |
| 138 | 121 | return mQuats; | 
| 139 | 122 | } | 
| 140 | 123 |  | 
| 141 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 142 |  | |
| 143 | int getNumFaceColors() | |
| 144 |     {
 | |
| 145 | return FACE_COLORS.length; | |
| 146 | } | |
| 147 |  | |
| 148 | 124 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 149 | 125 |  | 
| 150 | 126 | int getSolvedFunctionIndex() | 
| ... | ... | |
| 152 | 128 | return 0; | 
| 153 | 129 | } | 
| 154 | 130 |  | 
| 155 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 156 |  | |
| 157 | boolean shouldResetTextureMaps() | |
| 158 |     {
 | |
| 159 | return false; | |
| 160 | } | |
| 161 |  | |
| 162 | 131 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 163 | 132 |  | 
| 164 | 133 | int getNumStickerTypes(int numLayers) | 
| ... | ... | |
| 179 | 148 |  | 
| 180 | 149 | int getNumCubitFaces() | 
| 181 | 150 |     {
 | 
| 182 |     return FACES_PER_CUBIT;
 | |
| 151 |     return 9;
 | |
| 183 | 152 | } | 
| 184 | 153 |  | 
| 185 | 154 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| ... | ... | |
| 382 | 351 | return cubitface<3 ? mFaceMap[cubit][cubitface] : NUM_TEXTURES; | 
| 383 | 352 | } | 
| 384 | 353 |  | 
| 385 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 386 |  | |
| 387 | int getColor(int face) | |
| 388 |     {
 | |
| 389 | return FACE_COLORS[face]; | |
| 390 | } | |
| 391 |  | |
| 392 | 354 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 393 | 355 |  | 
| 394 | 356 | ObjectSticker retSticker(int face) | 
| ... | ... | |
| 417 | 379 | return mStickers[face/NUM_FACE_COLORS]; | 
| 418 | 380 | } | 
| 419 | 381 |  | 
| 420 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 421 |  | |
| 422 | float returnMultiplier() | |
| 423 |     {
 | |
| 424 | return 2.0f; | |
| 425 | } | |
| 426 |  | |
| 427 | 382 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 428 | 383 | // PUBLIC API | 
| 429 | 384 |  | 
| src/main/java/org/distorted/objects/TwistyRex.java | ||
|---|---|---|
| 33 | 33 |  | 
| 34 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 35 | 35 |  | 
| 36 | public class TwistyRex extends TwistyObject
 | |
| 36 | public class TwistyRex extends Twisty6
 | |
| 37 | 37 | {
 | 
| 38 | // the four rotation axis of a RubikRex. Must be normalized. | |
| 39 | 38 | static final Static3D[] ROT_AXIS = new Static3D[] | 
| 40 | 39 |          {
 | 
| 41 | 40 | new Static3D(+SQ3/3,+SQ3/3,+SQ3/3), | 
Also available in: Unified diff
Introduce abstract 4,6,8 adn 12 classes.