Revision bdbbb4c5
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistyPyraminx.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.objects; |
21 | 21 |
|
22 |
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
|
|
22 |
import static org.distorted.objectlb.Movement.TYPE_NOT_SPLIT;
|
|
23 | 23 |
|
24 | 24 |
import android.content.res.Resources; |
25 | 25 |
|
26 |
import org.distorted.helpers.ObjectShape;
|
|
27 |
import org.distorted.helpers.ObjectSticker;
|
|
28 |
import org.distorted.helpers.ScrambleState;
|
|
26 |
import org.distorted.objectlb.ObjectShape;
|
|
27 |
import org.distorted.objectlb.ObjectSticker;
|
|
28 |
import org.distorted.objectlb.ScrambleState;
|
|
29 | 29 |
import org.distorted.library.main.DistortedEffects; |
30 | 30 |
import org.distorted.library.main.DistortedTexture; |
31 | 31 |
import org.distorted.library.mesh.MeshSquare; |
32 | 32 |
import org.distorted.library.type.Static3D; |
33 | 33 |
import org.distorted.library.type.Static4D; |
34 | 34 |
import org.distorted.main.R; |
35 |
import org.distorted.objectlb.Movement; |
|
36 |
import org.distorted.objectlb.Movement4; |
|
37 |
import org.distorted.objectlb.ObjectList; |
|
38 |
import org.distorted.objectlb.Twisty4; |
|
35 | 39 |
|
36 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 41 |
|
... | ... | |
60 | 64 |
|
61 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
62 | 66 |
|
63 |
TwistyPyraminx(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh, |
|
64 |
DistortedEffects effects, int[][] moves, Resources res, int scrWidth) |
|
67 |
public TwistyPyraminx(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
|
|
68 |
DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
|
65 | 69 |
{ |
66 | 70 |
super(size, size, quat, texture, mesh, effects, moves, ObjectList.PYRA, res, scrWidth); |
67 | 71 |
} |
68 | 72 |
|
69 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
70 | 74 |
|
71 |
ScrambleState[] getScrambleStates() |
|
75 |
protected ScrambleState[] getScrambleStates()
|
|
72 | 76 |
{ |
73 | 77 |
if( mStates==null ) |
74 | 78 |
{ |
... | ... | |
138 | 142 |
|
139 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
140 | 144 |
|
141 |
int[] getSolvedQuats(int cubit, int numLayers) |
|
145 |
protected int[] getSolvedQuats(int cubit, int numLayers)
|
|
142 | 146 |
{ |
143 | 147 |
if( mQuats==null ) initializeQuats(); |
144 | 148 |
int status = retCubitSolvedStatus(cubit,numLayers); |
... | ... | |
185 | 189 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
186 | 190 |
// there are (n^3-n)/6 octahedrons and ((n+1)^3 - (n+1))/6 tetrahedrons |
187 | 191 |
|
188 |
float[][] getCubitPositions(int size) |
|
192 |
protected float[][] getCubitPositions(int size)
|
|
189 | 193 |
{ |
190 | 194 |
int numOcta = (size-1)*size*(size+1)/6; |
191 | 195 |
int numTetra= size*(size+1)*(size+2)/6; |
... | ... | |
199 | 203 |
|
200 | 204 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
201 | 205 |
|
202 |
Static4D[] getQuats() |
|
206 |
protected Static4D[] getQuats()
|
|
203 | 207 |
{ |
204 | 208 |
if( mQuats==null ) initializeQuats(); |
205 | 209 |
return mQuats; |
... | ... | |
207 | 211 |
|
208 | 212 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
209 | 213 |
|
210 |
int getSolvedFunctionIndex() |
|
214 |
protected int getSolvedFunctionIndex()
|
|
211 | 215 |
{ |
212 | 216 |
return 0; |
213 | 217 |
} |
214 | 218 |
|
215 | 219 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
216 | 220 |
|
217 |
int getNumStickerTypes(int numLayers) |
|
221 |
protected int getNumStickerTypes(int numLayers)
|
|
218 | 222 |
{ |
219 | 223 |
return 1; |
220 | 224 |
} |
221 | 225 |
|
222 | 226 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
223 | 227 |
|
224 |
float[][] getCuts(int numLayers) |
|
228 |
protected float[][] getCuts(int numLayers)
|
|
225 | 229 |
{ |
226 | 230 |
if( mCuts==null ) |
227 | 231 |
{ |
... | ... | |
256 | 260 |
|
257 | 261 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
258 | 262 |
|
259 |
int getNumCubitFaces() |
|
263 |
protected int getNumCubitFaces()
|
|
260 | 264 |
{ |
261 | 265 |
return 8; |
262 | 266 |
} |
... | ... | |
272 | 276 |
|
273 | 277 |
private int faceColor(int cubit, int axis) |
274 | 278 |
{ |
275 |
return CUBITS[cubit].mRotationRow[axis] == 1 ? axis : NUM_TEXTURES;
|
|
279 |
return CUBITS[cubit].getRotRow(axis) == 1 ? axis : NUM_TEXTURES;
|
|
276 | 280 |
} |
277 | 281 |
|
278 | 282 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
279 | 283 |
|
280 |
int getFaceColor(int cubit, int cubitface, int size) |
|
284 |
protected int getFaceColor(int cubit, int cubitface, int size)
|
|
281 | 285 |
{ |
282 | 286 |
if( cubit< (size-1)*size*(size+1)/6 ) |
283 | 287 |
{ |
... | ... | |
298 | 302 |
|
299 | 303 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
300 | 304 |
|
301 |
ObjectShape getObjectShape(int cubit, int numLayers) |
|
305 |
protected ObjectShape getObjectShape(int cubit, int numLayers)
|
|
302 | 306 |
{ |
303 | 307 |
int variant = getCubitVariant(cubit,numLayers); |
304 | 308 |
|
... | ... | |
334 | 338 |
|
335 | 339 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
336 | 340 |
|
337 |
Static4D getQuat(int cubit, int numLayers) |
|
341 |
protected Static4D getQuat(int cubit, int numLayers)
|
|
338 | 342 |
{ |
339 | 343 |
if( mQuats==null ) initializeQuats(); |
340 | 344 |
return mQuats[0]; |
... | ... | |
342 | 346 |
|
343 | 347 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
344 | 348 |
|
345 |
int getNumCubitVariants(int numLayers) |
|
349 |
protected int getNumCubitVariants(int numLayers)
|
|
346 | 350 |
{ |
347 | 351 |
return 2; |
348 | 352 |
} |
349 | 353 |
|
350 | 354 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
351 | 355 |
|
352 |
int getCubitVariant(int cubit, int numLayers) |
|
356 |
protected int getCubitVariant(int cubit, int numLayers)
|
|
353 | 357 |
{ |
354 | 358 |
return cubit<getNumOctahedrons(numLayers) ? 0:1; |
355 | 359 |
} |
356 | 360 |
|
357 | 361 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
358 | 362 |
|
359 |
ObjectSticker retSticker(int face) |
|
363 |
protected ObjectSticker retSticker(int face)
|
|
360 | 364 |
{ |
361 | 365 |
if( mStickers==null ) |
362 | 366 |
{ |
Also available in: Unified diff
Refactoring: split the 'objects' package into two, 'objects' and 'objectlib'.
The point: we're going to need to move the 'objectlib' stuff into its own library module, and that's because we're going to create a new app module which needs access to it.