Revision a57e6870
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
47 | 47 |
import org.distorted.library.type.Static1D; |
48 | 48 |
import org.distorted.library.type.Static3D; |
49 | 49 |
import org.distorted.library.type.Static4D; |
50 |
|
|
50 | 51 |
import org.distorted.objectlib.BuildConfig; |
51 | 52 |
import org.distorted.objectlib.helpers.FactoryCubit; |
52 | 53 |
import org.distorted.objectlib.helpers.FactorySticker; |
... | ... | |
106 | 107 |
private final float[][] mOrigPos; |
107 | 108 |
private final Static3D mNodeScale; |
108 | 109 |
private final Static4D mQuat; |
109 |
private final int mNumLayers, mRealSize; |
|
110 |
private final int[] mNumLayers; |
|
111 |
private final int mRealSize; |
|
110 | 112 |
private final DistortedEffects mEffects; |
111 | 113 |
private final VertexEffectRotate mRotateEffect; |
112 | 114 |
private final Dynamic1D mRotationAngle; |
... | ... | |
137 | 139 |
|
138 | 140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
139 | 141 |
|
140 |
TwistyObject(int numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture nodeTexture, |
|
142 |
TwistyObject(int[] numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture nodeTexture,
|
|
141 | 143 |
MeshSquare nodeMesh, DistortedEffects nodeEffects, Resources res, int screenWidth) |
142 | 144 |
{ |
143 | 145 |
super(nodeTexture,nodeEffects,nodeMesh); |
... | ... | |
320 | 322 |
|
321 | 323 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
322 | 324 |
|
323 |
private MeshBase createCubitMesh(int cubit, int numLayers) |
|
325 |
private MeshBase createCubitMesh(int cubit, int[] numLayers)
|
|
324 | 326 |
{ |
325 | 327 |
int variant = getCubitVariant(cubit,numLayers); |
326 | 328 |
|
... | ... | |
348 | 350 |
|
349 | 351 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
350 | 352 |
|
351 |
private void createDataStructuresForSolved(int numLayers) |
|
353 |
private void createDataStructuresForSolved(int[] numLayers)
|
|
352 | 354 |
{ |
353 | 355 |
mTmpQuats = new int[NUM_QUATS]; |
354 | 356 |
mSolvedQuats = new int[NUM_CUBITS][]; |
... | ... | |
387 | 389 |
// Color index, i.e. the index into the 'FACE_COLORS' table. |
388 | 390 |
// else (edge or corner cubit, more than one non-black face): return -2. |
389 | 391 |
|
390 |
protected int retCubitSolvedStatus(int cubit, int numLayers) |
|
392 |
protected int retCubitSolvedStatus(int cubit, int[] numLayers)
|
|
391 | 393 |
{ |
392 | 394 |
int numNonBlack=0, nonBlackIndex=-1, color; |
393 | 395 |
|
... | ... | |
987 | 989 |
android.util.Log.e("object", "invalid rotation axis: "+axis); |
988 | 990 |
return; |
989 | 991 |
} |
990 |
if( row<0 || row>=mNumLayers ) |
|
992 |
if( row<0 || row>=mNumLayers[axis] )
|
|
991 | 993 |
{ |
992 | 994 |
android.util.Log.e("object", "invalid rotation row: "+row); |
993 | 995 |
return; |
... | ... | |
1186 | 1188 |
} |
1187 | 1189 |
|
1188 | 1190 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1191 |
// only called with figuring out which cubit was touched in MODE_REPLACE, which is only used in |
|
1192 |
// during setting up the initial position in the solver. |
|
1189 | 1193 |
|
1190 | 1194 |
int getCubit(float[] point3D) |
1191 | 1195 |
{ |
1192 | 1196 |
float dist, minDist = Float.MAX_VALUE; |
1193 | 1197 |
int currentBest=-1; |
1194 |
float multiplier = returnMultiplier();
|
|
1198 |
float multiplier = mNumLayers[0];
|
|
1195 | 1199 |
|
1196 | 1200 |
point3D[0] *= multiplier; |
1197 | 1201 |
point3D[1] *= multiplier; |
... | ... | |
1300 | 1304 |
|
1301 | 1305 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1302 | 1306 |
|
1303 |
public int getNumLayers() |
|
1307 |
public int[] getNumLayers()
|
|
1304 | 1308 |
{ |
1305 | 1309 |
return mNumLayers; |
1306 | 1310 |
} |
... | ... | |
1326 | 1330 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1327 | 1331 |
|
1328 | 1332 |
protected abstract int getFOV(); |
1329 |
protected abstract float returnMultiplier(); |
|
1330 | 1333 |
protected abstract float getScreenRatio(); |
1331 | 1334 |
protected abstract int getNumFaceColors(); |
1332 | 1335 |
protected abstract int getColor(int face); |
1333 |
protected abstract float[][] getCuts(int numLayers); |
|
1336 |
protected abstract float[][] getCuts(int[] numLayers);
|
|
1334 | 1337 |
protected abstract int getNumCubitFaces(); |
1335 | 1338 |
protected abstract Static4D[] getQuats(); |
1336 |
protected abstract float[][] getCubitPositions(int numLayers); |
|
1337 |
protected abstract int getCubitVariant(int cubit, int numLayers); |
|
1338 |
protected abstract int getNumCubitVariants(int numLayers); |
|
1339 |
protected abstract Static4D getQuat(int cubit, int numLayers); |
|
1340 |
protected abstract ObjectShape getObjectShape(int cubit, int numLayers); |
|
1341 |
protected abstract int[] getSolvedQuats(int cubit, int numLayers); |
|
1339 |
protected abstract float[][] getCubitPositions(int[] numLayers);
|
|
1340 |
protected abstract int getCubitVariant(int cubit, int[] numLayers);
|
|
1341 |
protected abstract int getNumCubitVariants(int[] numLayers);
|
|
1342 |
protected abstract Static4D getQuat(int cubit, int[] numLayers);
|
|
1343 |
protected abstract ObjectShape getObjectShape(int cubit, int[] numLayers);
|
|
1344 |
protected abstract int[] getSolvedQuats(int cubit, int[] numLayers);
|
|
1342 | 1345 |
protected abstract int getSolvedFunctionIndex(); |
1343 | 1346 |
protected abstract ScrambleState[] getScrambleStates(); |
1344 |
protected abstract int getNumStickerTypes(int numLayers); |
|
1347 |
protected abstract int getNumStickerTypes(int[] numLayers);
|
|
1345 | 1348 |
protected abstract ObjectSticker retSticker(int face); |
1346 |
protected abstract int getFaceColor(int cubit, int cubitface, int numLayers); |
|
1347 |
protected abstract int getResource(int mNumLayers);
|
|
1348 |
protected abstract ObjectType intGetObjectType(int numLayers); |
|
1349 |
protected abstract int getFaceColor(int cubit, int cubitface, int[] numLayers);
|
|
1350 |
protected abstract int getResource(int[] numLayers);
|
|
1351 |
protected abstract ObjectType intGetObjectType(int[] numLayers);
|
|
1349 | 1352 |
protected abstract Movement getMovement(); |
1350 | 1353 |
|
1351 | 1354 |
public abstract Static3D[] getRotationAxis(); |
1352 | 1355 |
public abstract int[] getBasicAngle(); |
1353 | 1356 |
public abstract int getNumFaces(); |
1354 |
public abstract int getObjectName(int numLayers); |
|
1355 |
public abstract int getInventor(int numLayers); |
|
1356 |
public abstract int getComplexity(int numLayers); |
|
1357 |
public abstract int getObjectName(int[] numLayers);
|
|
1358 |
public abstract int getInventor(int[] numLayers);
|
|
1359 |
public abstract int getComplexity(int[] numLayers);
|
|
1357 | 1360 |
} |
Also available in: Unified diff
make numLayers into an int[] (preparation for Cuboids)
Caution: because of previous changes to cubit order in cube, the Solver is broken!