Revision 3d2493ea
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/helpers/FactoryCubit.java | ||
---|---|---|
854 | 854 |
|
855 | 855 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
856 | 856 |
|
857 |
public float[] getStickerScales(boolean all)
|
|
857 |
public float[] getStickerScales() |
|
858 | 858 |
{ |
859 | 859 |
int index=0,num=0,len = mStickerCoords.size(); |
860 | 860 |
|
861 |
if( !all ) |
|
862 |
{ |
|
863 |
for(int i=0; i<len; i++) if( mStickerCoords.get(i).outer ) num++; |
|
864 |
} |
|
865 |
else |
|
866 |
{ |
|
867 |
num = len; |
|
868 |
} |
|
861 |
for(int i=0; i<len; i++) if( mStickerCoords.get(i).outer ) num++; |
|
869 | 862 |
|
870 | 863 |
if( num>0 ) |
871 | 864 |
{ |
... | ... | |
874 | 867 |
for(int i=0; i<len; i++) |
875 | 868 |
{ |
876 | 869 |
StickerCoords sticker = mStickerCoords.get(i); |
877 |
if( all || sticker.outer ) scales[index++] = sticker.scale;
|
|
870 |
if( sticker.outer ) scales[index++] = sticker.scale; |
|
878 | 871 |
} |
879 | 872 |
|
880 | 873 |
return scales; |
... | ... | |
885 | 878 |
|
886 | 879 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
887 | 880 |
|
888 |
public float[][] getStickerCoords(boolean all)
|
|
881 |
public float[][] getStickerCoords() |
|
889 | 882 |
{ |
890 | 883 |
int index=0,num=0,len = mStickerCoords.size(); |
891 | 884 |
|
892 |
if( !all ) |
|
893 |
{ |
|
894 |
for(int i=0; i<len; i++) if( mStickerCoords.get(i).outer ) num++; |
|
895 |
} |
|
896 |
else |
|
897 |
{ |
|
898 |
num = len; |
|
899 |
} |
|
885 |
for(int i=0; i<len; i++) if( mStickerCoords.get(i).outer ) num++; |
|
900 | 886 |
|
901 | 887 |
if( num>0 ) |
902 | 888 |
{ |
... | ... | |
905 | 891 |
for(int i=0; i<len; i++) |
906 | 892 |
{ |
907 | 893 |
StickerCoords sticker = mStickerCoords.get(i); |
908 |
if( all || sticker.outer ) coords[index++] = sticker.vertices;
|
|
894 |
if( sticker.outer ) coords[index++] = sticker.vertices; |
|
909 | 895 |
} |
910 | 896 |
|
911 | 897 |
return coords; |
src/main/java/org/distorted/objectlib/main/ObjectType.java | ||
---|---|---|
72 | 72 |
REX_3 ( TwistyRex.class , new int[] {3,3,3,3} , 19, R.drawable.rex_3 , true), |
73 | 73 |
MIRR_2 ( TwistyMirror.class , new int[] {2,2,2} , 12, R.drawable.mirr_2, true), |
74 | 74 |
MIRR_3 ( TwistyMirror.class , new int[] {3,3,3} , 17, R.drawable.mirr_3, true), |
75 |
MIRR_4 ( TwistyMirror.class , new int[] {4,4,4} , 24, R.drawable.mirr_4, false),
|
|
76 |
FISH_3 ( TwistyFisher.class , new int[] {3,3,3} , 24, R.drawable.fish_3, false),
|
|
77 |
CONT_2 ( TwistyContainer.class , new int[] {2,2,2,2} , 12, R.drawable.cont_2, false),
|
|
78 |
MORP_2 ( TwistyMorphix.class , new int[] {2,2,2} , 12, R.drawable.morp_2, false),
|
|
75 |
MIRR_4 ( TwistyMirror.class , new int[] {4,4,4} , 24, R.drawable.mirr_4, true),
|
|
76 |
FISH_3 ( TwistyFisher.class , new int[] {3,3,3} , 24, R.drawable.fish_3, true),
|
|
77 |
CONT_2 ( TwistyContainer.class , new int[] {2,2,2,2} , 12, R.drawable.cont_2, true),
|
|
78 |
MORP_2 ( TwistyMorphix.class , new int[] {2,2,2} , 12, R.drawable.morp_2, true),
|
|
79 | 79 |
; |
80 | 80 |
|
81 | 81 |
public static int NUM_OBJECTS; |
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
413 | 413 |
} |
414 | 414 |
else |
415 | 415 |
{ |
416 |
boolean all = colorInternalStickers(); |
|
417 | 416 |
FactoryCubit factory = FactoryCubit.getInstance(); |
418 |
mStickerCoords = factory.getStickerCoords(all);
|
|
417 |
mStickerCoords = factory.getStickerCoords(); |
|
419 | 418 |
mStickerVariants = factory.getStickerVariants(); |
420 |
mStickerScales = factory.getStickerScales(all);
|
|
419 |
mStickerScales = factory.getStickerScales(); |
|
421 | 420 |
adjustStickerCoords(); |
422 | 421 |
mNumStickerTypes = mStickerCoords.length; |
423 | 422 |
} |
... | ... | |
1241 | 1240 |
|
1242 | 1241 |
} |
1243 | 1242 |
|
1244 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1245 |
// some objects (Container!) might want to have the internal surfaces of their cubits colored. |
|
1246 |
|
|
1247 |
public boolean colorInternalStickers() |
|
1248 |
{ |
|
1249 |
return false; |
|
1250 |
} |
|
1251 |
|
|
1252 | 1243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1253 | 1244 |
|
1254 | 1245 |
public Static4D[] getQuats() |
src/main/java/org/distorted/objectlib/objects/TwistyContainer.java | ||
---|---|---|
58 | 58 |
super(numL, meshState, numL[0], quat, move, scale, stream); |
59 | 59 |
} |
60 | 60 |
|
61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
62 |
|
|
63 |
@Override |
|
64 |
public int getInternalColor() |
|
65 |
{ |
|
66 |
return 0xff999999; |
|
67 |
} |
|
68 |
|
|
69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
70 |
|
|
71 |
@Override |
|
72 |
public void adjustStickerCoords() |
|
73 |
{ |
|
74 |
mStickerCoords = new float[][] |
|
75 |
{ |
|
76 |
{ -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f }, |
|
77 |
{ -0.43301272f, -0.25000003f, 0.43301272f, -0.25000003f, 0.0f, 0.5f }, |
|
78 |
{ 0.117851146f, -0.5f, 0.117851146f, 0.5f, -0.23570228f, 0.0f }, |
|
79 |
{ -0.26667872f, -0.122859366f, 0.092929296f, -0.37714064f, 0.1737494f, 0.5f }, |
|
80 |
{ -0.5f, -0.23570225f, 0.5f, -0.23570225f, 0.0f, 0.47140452f }, |
|
81 |
}; |
|
82 |
} |
|
83 |
|
|
84 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
85 | 62 |
// we want colorful insides |
86 | 63 |
|
... | ... | |
113 | 90 |
return mFaceMap[cubit][face]; |
114 | 91 |
} |
115 | 92 |
|
116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
117 |
|
|
118 |
@Override |
|
119 |
public boolean colorInternalStickers() |
|
120 |
{ |
|
121 |
return true; |
|
122 |
} |
|
123 |
|
|
124 | 93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 94 |
|
126 | 95 |
public ScrambleState[] getScrambleStates() |
Also available in: Unified diff
Simplify coloring internal stickers