Revision 3e605536
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistyKilominx.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.helpers.FactoryCubit; |
|
25 | 24 |
import org.distorted.helpers.ObjectShape; |
26 | 25 |
import org.distorted.helpers.ObjectSticker; |
27 | 26 |
import org.distorted.helpers.QuatHelper; |
28 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
29 | 27 |
import org.distorted.library.main.DistortedEffects; |
30 | 28 |
import org.distorted.library.main.DistortedTexture; |
31 |
import org.distorted.library.mesh.MeshBase; |
|
32 | 29 |
import org.distorted.library.mesh.MeshSquare; |
33 |
import org.distorted.library.type.Static3D; |
|
34 | 30 |
import org.distorted.library.type.Static4D; |
35 | 31 |
import org.distorted.main.R; |
36 | 32 |
|
... | ... | |
539 | 535 |
|
540 | 536 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
541 | 537 |
|
542 |
private Static4D getQuat(int cubit, int numLayers)
|
|
538 |
Static4D getQuat(int cubit, int numLayers) |
|
543 | 539 |
{ |
544 | 540 |
int numCubitsPerCorner = numCubitsPerCorner(numLayers); |
545 | 541 |
int numCubitsPerEdge = numCubitsPerEdge(numLayers); |
... | ... | |
549 | 545 |
|
550 | 546 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
551 | 547 |
|
552 |
private int getNumCubitVariants(int numLayers)
|
|
548 |
int getNumCubitVariants(int numLayers) |
|
553 | 549 |
{ |
554 | 550 |
int[] sizes = ObjectList.KILO.getSizes(); |
555 | 551 |
int variants = sizes.length; |
... | ... | |
581 | 577 |
return highestSize-2; |
582 | 578 |
} |
583 | 579 |
|
584 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
585 |
|
|
586 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
587 |
{ |
|
588 |
int variant = getCubitVariant(cubit,numLayers); |
|
589 |
|
|
590 |
if( mMeshes==null ) |
|
591 |
{ |
|
592 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
593 |
factory.clear(); |
|
594 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
595 |
} |
|
596 |
|
|
597 |
if( mMeshes[variant]==null ) |
|
598 |
{ |
|
599 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
600 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
601 |
factory.createNewFaceTransform(shape); |
|
602 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
603 |
} |
|
604 |
|
|
605 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
606 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
607 |
mesh.apply(quat,0xffffffff,0); |
|
608 |
|
|
609 |
return mesh; |
|
610 |
} |
|
611 |
|
|
612 | 580 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
613 | 581 |
|
614 | 582 |
int getCornerColor(int cubit, int cubitface, int numLayers, int numCubitsPerCorner) |
Also available in: Unified diff
Finally remove cubit creation from the implementation classes and move it to the TwistyObject.