1 |
fdec60a3
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 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 |
1f9772f3
|
Leszek Koltunski
|
package org.distorted.objects;
|
21 |
fdec60a3
|
Leszek Koltunski
|
|
22 |
27a70eae
|
Leszek Koltunski
|
import android.content.SharedPreferences;
|
23 |
ccf9fec5
|
Leszek Koltunski
|
import android.content.res.Resources;
|
24 |
411c6285
|
Leszek Koltunski
|
import android.graphics.Bitmap;
|
25 |
|
|
import android.graphics.Canvas;
|
26 |
|
|
import android.graphics.Paint;
|
27 |
27a70eae
|
Leszek Koltunski
|
|
28 |
27e6c301
|
Leszek Koltunski
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
29 |
|
|
|
30 |
27a70eae
|
Leszek Koltunski
|
import org.distorted.library.effect.Effect;
|
31 |
19f0f767
|
Leszek Koltunski
|
import org.distorted.library.effect.MatrixEffectMove;
|
32 |
27a70eae
|
Leszek Koltunski
|
import org.distorted.library.effect.MatrixEffectQuaternion;
|
33 |
|
|
import org.distorted.library.effect.MatrixEffectScale;
|
34 |
10585385
|
Leszek Koltunski
|
import org.distorted.library.effect.VertexEffectQuaternion;
|
35 |
27e6c301
|
Leszek Koltunski
|
import org.distorted.library.effect.VertexEffectRotate;
|
36 |
27a70eae
|
Leszek Koltunski
|
import org.distorted.library.main.DistortedEffects;
|
37 |
|
|
import org.distorted.library.main.DistortedNode;
|
38 |
|
|
import org.distorted.library.main.DistortedTexture;
|
39 |
b32444ee
|
Leszek Koltunski
|
import org.distorted.library.mesh.MeshBase;
|
40 |
ccf9fec5
|
Leszek Koltunski
|
import org.distorted.library.mesh.MeshFile;
|
41 |
19f0f767
|
Leszek Koltunski
|
import org.distorted.library.mesh.MeshJoined;
|
42 |
efa8aa48
|
Leszek Koltunski
|
import org.distorted.library.mesh.MeshSquare;
|
43 |
27a70eae
|
Leszek Koltunski
|
import org.distorted.library.message.EffectListener;
|
44 |
27e6c301
|
Leszek Koltunski
|
import org.distorted.library.type.Dynamic1D;
|
45 |
27a70eae
|
Leszek Koltunski
|
import org.distorted.library.type.Static1D;
|
46 |
|
|
import org.distorted.library.type.Static3D;
|
47 |
|
|
import org.distorted.library.type.Static4D;
|
48 |
4f9f99a2
|
Leszek Koltunski
|
|
49 |
ccf9fec5
|
Leszek Koltunski
|
import java.io.DataInputStream;
|
50 |
|
|
import java.io.IOException;
|
51 |
|
|
import java.io.InputStream;
|
52 |
7c969a6d
|
Leszek Koltunski
|
import java.util.Random;
|
53 |
ccf9fec5
|
Leszek Koltunski
|
|
54 |
0333d81e
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
55 |
|
|
|
56 |
27a70eae
|
Leszek Koltunski
|
public abstract class RubikObject extends DistortedNode
|
57 |
fdec60a3
|
Leszek Koltunski
|
{
|
58 |
c7b00dfb
|
Leszek Koltunski
|
private static final float NODE_RATIO = 1.32f;
|
59 |
|
|
private static final float MAX_SIZE_CHANGE = 1.3f;
|
60 |
|
|
private static final float MIN_SIZE_CHANGE = 0.8f;
|
61 |
|
|
|
62 |
44f95b2a
|
Leszek Koltunski
|
private static boolean mCreateFromDMesh = true;
|
63 |
19f0f767
|
Leszek Koltunski
|
|
64 |
8cccfb10
|
Leszek Koltunski
|
private static final Static3D CENTER = new Static3D(0,0,0);
|
65 |
14bd7976
|
Leszek Koltunski
|
static final int INTERIOR_COLOR = 0xff000000;
|
66 |
27e6c301
|
Leszek Koltunski
|
private static final int POST_ROTATION_MILLISEC = 500;
|
67 |
fb377dae
|
Leszek Koltunski
|
private static final int TEXTURE_HEIGHT = 256;
|
68 |
27e6c301
|
Leszek Koltunski
|
|
69 |
efef689c
|
Leszek Koltunski
|
final Static3D[] ROTATION_AXIS;
|
70 |
98904e45
|
Leszek Koltunski
|
final Static4D[] QUATS;
|
71 |
6b6504fe
|
Leszek Koltunski
|
final Cubit[] CUBITS;
|
72 |
470820a7
|
Leszek Koltunski
|
final int NUM_FACES;
|
73 |
eab9d8f8
|
Leszek Koltunski
|
final int NUM_TEXTURES;
|
74 |
8f53e513
|
Leszek Koltunski
|
final int NUM_CUBIT_FACES;
|
75 |
1ebc4767
|
Leszek Koltunski
|
final int NUM_AXIS;
|
76 |
6b6504fe
|
Leszek Koltunski
|
final int NUM_CUBITS;
|
77 |
7403cdfa
|
Leszek Koltunski
|
final float BASIC_STEP;
|
78 |
27a70eae
|
Leszek Koltunski
|
|
79 |
c7b00dfb
|
Leszek Koltunski
|
private static float mInitScreenRatio,mObjectScreenRatio;
|
80 |
f0fa83ae
|
Leszek Koltunski
|
|
81 |
5b893eee
|
Leszek Koltunski
|
private final int mNodeSize;
|
82 |
9224ffd2
|
Leszek Koltunski
|
private int mRotRowBitmap;
|
83 |
efef689c
|
Leszek Koltunski
|
private int mRotAxis;
|
84 |
49f67f9b
|
Leszek Koltunski
|
private Static3D[] mOrigPos;
|
85 |
fb6a40c8
|
Leszek Koltunski
|
private Static3D mNodeScale;
|
86 |
4da7d87a
|
Leszek Koltunski
|
private Static4D mQuat;
|
87 |
49f67f9b
|
Leszek Koltunski
|
private int mSize;
|
88 |
aa171dee
|
Leszek Koltunski
|
private RubikObjectList mList;
|
89 |
470820a7
|
Leszek Koltunski
|
private MeshBase mMesh;
|
90 |
|
|
private DistortedEffects mEffects;
|
91 |
27e6c301
|
Leszek Koltunski
|
private VertexEffectRotate mRotateEffect;
|
92 |
|
|
private Dynamic1D mRotationAngle;
|
93 |
|
|
private Static3D mRotationAxis;
|
94 |
c7b00dfb
|
Leszek Koltunski
|
private Static3D mObjectScale;
|
95 |
27a70eae
|
Leszek Koltunski
|
|
96 |
e844c116
|
Leszek Koltunski
|
float mStart, mStep;
|
97 |
7c969a6d
|
Leszek Koltunski
|
float[] mRowChances;
|
98 |
fdec60a3
|
Leszek Koltunski
|
|
99 |
27a70eae
|
Leszek Koltunski
|
Static1D mRotationAngleStatic, mRotationAngleMiddle, mRotationAngleFinal;
|
100 |
|
|
DistortedTexture mTexture;
|
101 |
|
|
|
102 |
|
|
MatrixEffectScale mScaleEffect;
|
103 |
4da7d87a
|
Leszek Koltunski
|
MatrixEffectQuaternion mQuatEffect;
|
104 |
27a70eae
|
Leszek Koltunski
|
|
105 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
106 |
fdec60a3
|
Leszek Koltunski
|
|
107 |
efa8aa48
|
Leszek Koltunski
|
RubikObject(int size, int fov, Static4D quat, DistortedTexture nodeTexture, MeshSquare nodeMesh,
|
108 |
5b893eee
|
Leszek Koltunski
|
DistortedEffects nodeEffects, int[][] moves, RubikObjectList list, Resources res, int screenWidth)
|
109 |
fdec60a3
|
Leszek Koltunski
|
{
|
110 |
411c6285
|
Leszek Koltunski
|
super(nodeTexture,nodeEffects,nodeMesh);
|
111 |
fdec60a3
|
Leszek Koltunski
|
|
112 |
5b893eee
|
Leszek Koltunski
|
mNodeSize = screenWidth;
|
113 |
|
|
|
114 |
c7b00dfb
|
Leszek Koltunski
|
resizeFBO(mNodeSize, (int)(NODE_RATIO*mNodeSize));
|
115 |
d41742f7
|
Leszek Koltunski
|
|
116 |
aa171dee
|
Leszek Koltunski
|
mList = list;
|
117 |
49f67f9b
|
Leszek Koltunski
|
mOrigPos = getCubitPositions(size);
|
118 |
10a2e360
|
Leszek Koltunski
|
|
119 |
98904e45
|
Leszek Koltunski
|
QUATS = getQuats();
|
120 |
49f67f9b
|
Leszek Koltunski
|
NUM_CUBITS = mOrigPos.length;
|
121 |
efef689c
|
Leszek Koltunski
|
ROTATION_AXIS = getRotationAxis();
|
122 |
1ebc4767
|
Leszek Koltunski
|
NUM_AXIS = ROTATION_AXIS.length;
|
123 |
c7b00dfb
|
Leszek Koltunski
|
mObjectScreenRatio = getScreenRatio();
|
124 |
|
|
mInitScreenRatio = mObjectScreenRatio;
|
125 |
470820a7
|
Leszek Koltunski
|
NUM_FACES = getNumFaces();
|
126 |
8f53e513
|
Leszek Koltunski
|
NUM_CUBIT_FACES = getNumCubitFaces();
|
127 |
eab9d8f8
|
Leszek Koltunski
|
NUM_TEXTURES = getNumStickerTypes()*NUM_FACES;
|
128 |
7403cdfa
|
Leszek Koltunski
|
BASIC_STEP = getBasicStep();
|
129 |
a10ada2a
|
Leszek Koltunski
|
|
130 |
27a70eae
|
Leszek Koltunski
|
mSize = size;
|
131 |
49f67f9b
|
Leszek Koltunski
|
computeStartAndStep(mOrigPos);
|
132 |
c7b00dfb
|
Leszek Koltunski
|
mNodeScale= new Static3D(1,NODE_RATIO,1);
|
133 |
4da7d87a
|
Leszek Koltunski
|
mQuat = quat;
|
134 |
e844c116
|
Leszek Koltunski
|
|
135 |
7c969a6d
|
Leszek Koltunski
|
mRowChances = getRowChances();
|
136 |
|
|
|
137 |
27e6c301
|
Leszek Koltunski
|
mRotationAngle= new Dynamic1D();
|
138 |
|
|
mRotationAxis = new Static3D(1,0,0);
|
139 |
8cccfb10
|
Leszek Koltunski
|
mRotateEffect = new VertexEffectRotate(mRotationAngle, mRotationAxis, CENTER);
|
140 |
27e6c301
|
Leszek Koltunski
|
|
141 |
27a70eae
|
Leszek Koltunski
|
mRotationAngleStatic = new Static1D(0);
|
142 |
|
|
mRotationAngleMiddle = new Static1D(0);
|
143 |
|
|
mRotationAngleFinal = new Static1D(0);
|
144 |
|
|
|
145 |
19f0f767
|
Leszek Koltunski
|
float scale = mObjectScreenRatio*mNodeSize/mSize;
|
146 |
|
|
mObjectScale = new Static3D(scale,scale,scale);
|
147 |
c7b00dfb
|
Leszek Koltunski
|
mScaleEffect = new MatrixEffectScale(mObjectScale);
|
148 |
4da7d87a
|
Leszek Koltunski
|
mQuatEffect = new MatrixEffectQuaternion(quat, CENTER);
|
149 |
27a70eae
|
Leszek Koltunski
|
|
150 |
|
|
MatrixEffectScale nodeScaleEffect = new MatrixEffectScale(mNodeScale);
|
151 |
411c6285
|
Leszek Koltunski
|
nodeEffects.apply(nodeScaleEffect);
|
152 |
a10ada2a
|
Leszek Koltunski
|
|
153 |
6b6504fe
|
Leszek Koltunski
|
CUBITS = new Cubit[NUM_CUBITS];
|
154 |
19f0f767
|
Leszek Koltunski
|
createMeshAndCubits(list,res);
|
155 |
7381193e
|
Leszek Koltunski
|
|
156 |
19f0f767
|
Leszek Koltunski
|
mTexture = new DistortedTexture();
|
157 |
470820a7
|
Leszek Koltunski
|
mEffects = new DistortedEffects();
|
158 |
10585385
|
Leszek Koltunski
|
|
159 |
98904e45
|
Leszek Koltunski
|
int num_quats = QUATS.length;
|
160 |
10585385
|
Leszek Koltunski
|
for(int q=0; q<num_quats; q++)
|
161 |
|
|
{
|
162 |
98904e45
|
Leszek Koltunski
|
VertexEffectQuaternion vq = new VertexEffectQuaternion(QUATS[q],CENTER);
|
163 |
10585385
|
Leszek Koltunski
|
vq.setMeshAssociation(0,q);
|
164 |
|
|
mEffects.apply(vq);
|
165 |
|
|
}
|
166 |
|
|
|
167 |
27e6c301
|
Leszek Koltunski
|
mEffects.apply(mRotateEffect);
|
168 |
4da7d87a
|
Leszek Koltunski
|
mEffects.apply(mQuatEffect);
|
169 |
470820a7
|
Leszek Koltunski
|
mEffects.apply(mScaleEffect);
|
170 |
|
|
|
171 |
dfbb340a
|
Leszek Koltunski
|
// Now postprocessed effects (the glow when you solve an object) require component centers. In
|
172 |
b376bfd7
|
Leszek Koltunski
|
// order for the effect to be in front of the object, we need to set the center to be behind it.
|
173 |
dfbb340a
|
Leszek Koltunski
|
getMesh().setComponentCenter(0,0,0,-0.1f);
|
174 |
|
|
|
175 |
470820a7
|
Leszek Koltunski
|
attach( new DistortedNode(mTexture,mEffects,mMesh) );
|
176 |
|
|
|
177 |
aa171dee
|
Leszek Koltunski
|
setupPosition(moves);
|
178 |
|
|
|
179 |
4888e97c
|
Leszek Koltunski
|
setProjection(fov, 0.1f);
|
180 |
27a70eae
|
Leszek Koltunski
|
}
|
181 |
|
|
|
182 |
19f0f767
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
183 |
|
|
|
184 |
|
|
private void createMeshAndCubits(RubikObjectList list, Resources res)
|
185 |
|
|
{
|
186 |
|
|
if( mCreateFromDMesh )
|
187 |
|
|
{
|
188 |
|
|
int sizeIndex = RubikObjectList.getSizeIndex(list.ordinal(),mSize);
|
189 |
|
|
int resourceID= list.getResourceIDs()[sizeIndex];
|
190 |
|
|
|
191 |
|
|
InputStream is = res.openRawResource(resourceID);
|
192 |
|
|
DataInputStream dos = new DataInputStream(is);
|
193 |
|
|
mMesh = new MeshFile(dos);
|
194 |
|
|
|
195 |
|
|
try
|
196 |
|
|
{
|
197 |
|
|
is.close();
|
198 |
|
|
}
|
199 |
|
|
catch(IOException e)
|
200 |
|
|
{
|
201 |
|
|
android.util.Log.e("meshFile", "Error closing InputStream: "+e.toString());
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
for(int i=0; i<NUM_CUBITS; i++)
|
205 |
|
|
{
|
206 |
6b6504fe
|
Leszek Koltunski
|
CUBITS[i] = new Cubit(this,mOrigPos[i]);
|
207 |
|
|
mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(), 0);
|
208 |
19f0f767
|
Leszek Koltunski
|
}
|
209 |
|
|
}
|
210 |
|
|
else
|
211 |
|
|
{
|
212 |
|
|
MeshBase[] cubitMesh = new MeshBase[NUM_CUBITS];
|
213 |
|
|
|
214 |
|
|
for(int i=0; i<NUM_CUBITS; i++)
|
215 |
|
|
{
|
216 |
6b6504fe
|
Leszek Koltunski
|
CUBITS[i] = new Cubit(this,mOrigPos[i]);
|
217 |
19f0f767
|
Leszek Koltunski
|
cubitMesh[i] = createCubitMesh(i);
|
218 |
|
|
cubitMesh[i].apply(new MatrixEffectMove(mOrigPos[i]),1,0);
|
219 |
6b6504fe
|
Leszek Koltunski
|
cubitMesh[i].setEffectAssociation(0, CUBITS[i].computeAssociation(), 0);
|
220 |
19f0f767
|
Leszek Koltunski
|
}
|
221 |
|
|
|
222 |
|
|
mMesh = new MeshJoined(cubitMesh);
|
223 |
|
|
resetAllTextureMaps();
|
224 |
|
|
}
|
225 |
|
|
}
|
226 |
|
|
|
227 |
c7b00dfb
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
228 |
|
|
|
229 |
|
|
public void setObjectRatio(float sizeChange)
|
230 |
|
|
{
|
231 |
|
|
mObjectScreenRatio *= (1.0f+sizeChange)/2;
|
232 |
|
|
|
233 |
|
|
if( mObjectScreenRatio > MAX_SIZE_CHANGE*mInitScreenRatio)
|
234 |
|
|
{
|
235 |
|
|
mObjectScreenRatio = MAX_SIZE_CHANGE*mInitScreenRatio;
|
236 |
|
|
}
|
237 |
|
|
if( mObjectScreenRatio < MIN_SIZE_CHANGE*mInitScreenRatio)
|
238 |
|
|
{
|
239 |
|
|
mObjectScreenRatio = MIN_SIZE_CHANGE*mInitScreenRatio;
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
float scale = mObjectScreenRatio*mNodeSize/mSize;
|
243 |
|
|
mObjectScale.set(scale,scale,scale);
|
244 |
|
|
}
|
245 |
|
|
|
246 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
247 |
|
|
|
248 |
|
|
static float getObjectRatio()
|
249 |
|
|
{
|
250 |
|
|
return mObjectScreenRatio;
|
251 |
|
|
}
|
252 |
|
|
|
253 |
e844c116
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
254 |
97d2f701
|
Leszek Koltunski
|
// Cast centers of all Cubits on the first rotation Axis and compute the leftmost and rightmost
|
255 |
|
|
// one. From there compute the 'start' (i.e. the leftmost) and 'step' (i.e. distance between two
|
256 |
|
|
// consecutive).
|
257 |
|
|
// it is assumed that other rotation axis have the same 'start' and 'step' - this is the case with
|
258 |
|
|
// the Cube and the Pyraminx.
|
259 |
|
|
// Start and Step are then needed to compute which rotation row (with respect to a given axis) a
|
260 |
|
|
// given Cubit belongs to.
|
261 |
e844c116
|
Leszek Koltunski
|
|
262 |
|
|
private void computeStartAndStep(Static3D[] pos)
|
263 |
|
|
{
|
264 |
|
|
float min = Float.MAX_VALUE;
|
265 |
|
|
float max = Float.MIN_VALUE;
|
266 |
|
|
float axisX = ROTATION_AXIS[0].get0();
|
267 |
|
|
float axisY = ROTATION_AXIS[0].get1();
|
268 |
|
|
float axisZ = ROTATION_AXIS[0].get2();
|
269 |
|
|
float tmp;
|
270 |
|
|
|
271 |
|
|
for(int i=0; i<NUM_CUBITS; i++)
|
272 |
|
|
{
|
273 |
|
|
tmp = pos[i].get0()*axisX + pos[i].get1()*axisY + pos[i].get2()*axisZ;
|
274 |
|
|
if( tmp<min ) min=tmp;
|
275 |
|
|
if( tmp>max ) max=tmp;
|
276 |
|
|
}
|
277 |
|
|
|
278 |
|
|
mStart = min;
|
279 |
7403cdfa
|
Leszek Koltunski
|
mStep = (max-min+BASIC_STEP)/mSize;
|
280 |
e844c116
|
Leszek Koltunski
|
}
|
281 |
|
|
|
282 |
efef689c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
283 |
|
|
|
284 |
9224ffd2
|
Leszek Koltunski
|
private boolean belongsToRotation( int cubit, int axis, int rowBitmap)
|
285 |
efef689c
|
Leszek Koltunski
|
{
|
286 |
6b6504fe
|
Leszek Koltunski
|
int cubitRow = (int)(CUBITS[cubit].mRotationRow[axis]+0.5f);
|
287 |
9224ffd2
|
Leszek Koltunski
|
return ((1<<cubitRow)&rowBitmap)!=0;
|
288 |
66cbdd21
|
Leszek Koltunski
|
}
|
289 |
|
|
|
290 |
aa171dee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
291 |
a31d25de
|
Leszek Koltunski
|
// note the minus in front of the sin() - we rotate counterclockwise
|
292 |
|
|
// when looking towards the direction where the axis increases in values.
|
293 |
aa171dee
|
Leszek Koltunski
|
|
294 |
a31d25de
|
Leszek Koltunski
|
private Static4D makeQuaternion(int axisIndex, int angleInDegrees)
|
295 |
aa171dee
|
Leszek Koltunski
|
{
|
296 |
a31d25de
|
Leszek Koltunski
|
Static3D axis = ROTATION_AXIS[axisIndex];
|
297 |
|
|
|
298 |
|
|
while( angleInDegrees<0 ) angleInDegrees += 360;
|
299 |
|
|
angleInDegrees %= 360;
|
300 |
|
|
|
301 |
|
|
float cosA = (float)Math.cos(Math.PI*angleInDegrees/360);
|
302 |
|
|
float sinA =-(float)Math.sqrt(1-cosA*cosA);
|
303 |
|
|
|
304 |
|
|
return new Static4D(axis.get0()*sinA, axis.get1()*sinA, axis.get2()*sinA, cosA);
|
305 |
|
|
}
|
306 |
|
|
|
307 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
308 |
|
|
|
309 |
8bbac3c2
|
Leszek Koltunski
|
private synchronized void setupPosition(int[][] moves)
|
310 |
a31d25de
|
Leszek Koltunski
|
{
|
311 |
|
|
if( moves!=null )
|
312 |
|
|
{
|
313 |
|
|
Static4D quat;
|
314 |
818431ed
|
Leszek Koltunski
|
int index, axis, rowBitmap, angle;
|
315 |
a31d25de
|
Leszek Koltunski
|
int corr = (360/getBasicAngle());
|
316 |
|
|
|
317 |
|
|
for(int[] move: moves)
|
318 |
|
|
{
|
319 |
|
|
axis = move[0];
|
320 |
|
|
rowBitmap= move[1];
|
321 |
|
|
angle = move[2]*corr;
|
322 |
|
|
quat = makeQuaternion(axis,angle);
|
323 |
|
|
|
324 |
|
|
for(int j=0; j<NUM_CUBITS; j++)
|
325 |
|
|
if( belongsToRotation(j,axis,rowBitmap) )
|
326 |
|
|
{
|
327 |
6b6504fe
|
Leszek Koltunski
|
index = CUBITS[j].removeRotationNow(quat);
|
328 |
|
|
mMesh.setEffectAssociation(j, CUBITS[j].computeAssociation(),index);
|
329 |
a31d25de
|
Leszek Koltunski
|
}
|
330 |
|
|
}
|
331 |
|
|
}
|
332 |
aa171dee
|
Leszek Koltunski
|
}
|
333 |
|
|
|
334 |
f6d06256
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
335 |
|
|
// we cannot use belongsToRotation for deciding if to texture a face. Counterexample: the 'rotated'
|
336 |
|
|
// tetrahedrons of Pyraminx nearby the edge: they belong to rotation but their face which is rotated
|
337 |
|
|
// away from the face of the Pyraminx shouldn't be textured.
|
338 |
|
|
|
339 |
|
|
boolean isOnFace( int cubit, int axis, int row)
|
340 |
|
|
{
|
341 |
|
|
final float MAX_ERROR = 0.0001f;
|
342 |
6b6504fe
|
Leszek Koltunski
|
float diff = CUBITS[cubit].mRotationRow[axis] - row;
|
343 |
f6d06256
|
Leszek Koltunski
|
return diff*diff < MAX_ERROR;
|
344 |
|
|
}
|
345 |
|
|
|
346 |
fa0f7a56
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
347 |
|
|
|
348 |
|
|
int getCubitFaceColorIndex(int cubit, int face)
|
349 |
|
|
{
|
350 |
470820a7
|
Leszek Koltunski
|
Static4D texMap = mMesh.getTextureMap(NUM_FACES*cubit + face);
|
351 |
|
|
return (int)(texMap.get0() / texMap.get2());
|
352 |
fa0f7a56
|
Leszek Koltunski
|
}
|
353 |
|
|
|
354 |
49f67f9b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
355 |
|
|
// Clamp all rotated positions to one of those original ones to avoid accumulating errors.
|
356 |
|
|
|
357 |
|
|
void clampPos(Static3D pos)
|
358 |
|
|
{
|
359 |
|
|
float currError, minError = Float.MAX_VALUE;
|
360 |
|
|
int minErrorIndex= -1;
|
361 |
|
|
float x = pos.get0();
|
362 |
|
|
float y = pos.get1();
|
363 |
|
|
float z = pos.get2();
|
364 |
|
|
float xo,yo,zo;
|
365 |
|
|
|
366 |
|
|
for(int i=0; i<NUM_CUBITS; i++)
|
367 |
|
|
{
|
368 |
|
|
xo = mOrigPos[i].get0();
|
369 |
|
|
yo = mOrigPos[i].get1();
|
370 |
|
|
zo = mOrigPos[i].get2();
|
371 |
|
|
|
372 |
|
|
currError = (xo-x)*(xo-x) + (yo-y)*(yo-y) + (zo-z)*(zo-z);
|
373 |
|
|
|
374 |
|
|
if( currError<minError )
|
375 |
|
|
{
|
376 |
|
|
minError = currError;
|
377 |
|
|
minErrorIndex = i;
|
378 |
|
|
}
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
pos.set( mOrigPos[minErrorIndex] );
|
382 |
|
|
}
|
383 |
|
|
|
384 |
411c6285
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
385 |
|
|
// the getFaceColors + final black in a horizontal strip.
|
386 |
|
|
|
387 |
|
|
public void createTexture()
|
388 |
|
|
{
|
389 |
|
|
Bitmap bitmap;
|
390 |
|
|
|
391 |
|
|
Paint paint = new Paint();
|
392 |
eab9d8f8
|
Leszek Koltunski
|
bitmap = Bitmap.createBitmap( (NUM_TEXTURES+1)*TEXTURE_HEIGHT, TEXTURE_HEIGHT, Bitmap.Config.ARGB_8888);
|
393 |
411c6285
|
Leszek Koltunski
|
Canvas canvas = new Canvas(bitmap);
|
394 |
|
|
|
395 |
|
|
paint.setAntiAlias(true);
|
396 |
|
|
paint.setTextAlign(Paint.Align.CENTER);
|
397 |
|
|
paint.setStyle(Paint.Style.FILL);
|
398 |
|
|
|
399 |
14bd7976
|
Leszek Koltunski
|
paint.setColor(INTERIOR_COLOR);
|
400 |
eab9d8f8
|
Leszek Koltunski
|
canvas.drawRect(0, 0, (NUM_TEXTURES+1)*TEXTURE_HEIGHT, TEXTURE_HEIGHT, paint);
|
401 |
411c6285
|
Leszek Koltunski
|
|
402 |
eab9d8f8
|
Leszek Koltunski
|
for(int i=0; i<NUM_TEXTURES; i++)
|
403 |
411c6285
|
Leszek Koltunski
|
{
|
404 |
ca292407
|
Leszek Koltunski
|
createFaceTexture(canvas, paint, i, i*TEXTURE_HEIGHT, 0, TEXTURE_HEIGHT);
|
405 |
411c6285
|
Leszek Koltunski
|
}
|
406 |
|
|
|
407 |
|
|
mTexture.setTexture(bitmap);
|
408 |
|
|
}
|
409 |
|
|
|
410 |
dd73fdab
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
411 |
|
|
|
412 |
27a70eae
|
Leszek Koltunski
|
public int getSize()
|
413 |
fdec60a3
|
Leszek Koltunski
|
{
|
414 |
27a70eae
|
Leszek Koltunski
|
return mSize;
|
415 |
fdec60a3
|
Leszek Koltunski
|
}
|
416 |
|
|
|
417 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
418 |
|
|
|
419 |
27a70eae
|
Leszek Koltunski
|
public void continueRotation(float angleInDegrees)
|
420 |
fdec60a3
|
Leszek Koltunski
|
{
|
421 |
27a70eae
|
Leszek Koltunski
|
mRotationAngleStatic.set0(angleInDegrees);
|
422 |
fdec60a3
|
Leszek Koltunski
|
}
|
423 |
|
|
|
424 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
425 |
|
|
|
426 |
27a70eae
|
Leszek Koltunski
|
public Static4D getRotationQuat()
|
427 |
|
|
{
|
428 |
4da7d87a
|
Leszek Koltunski
|
return mQuat;
|
429 |
27a70eae
|
Leszek Koltunski
|
}
|
430 |
|
|
|
431 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
432 |
|
|
|
433 |
5ba13c05
|
Leszek Koltunski
|
public void recomputeScaleFactor(int scrWidth, int scrHeight)
|
434 |
fdec60a3
|
Leszek Koltunski
|
{
|
435 |
f0fa83ae
|
Leszek Koltunski
|
float factor = Math.min(scrWidth,scrHeight);
|
436 |
c7b00dfb
|
Leszek Koltunski
|
mNodeScale.set(factor,NODE_RATIO*factor,factor);
|
437 |
fdec60a3
|
Leszek Koltunski
|
}
|
438 |
27a70eae
|
Leszek Koltunski
|
|
439 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
440 |
|
|
|
441 |
a10ada2a
|
Leszek Koltunski
|
public void savePreferences(SharedPreferences.Editor editor)
|
442 |
|
|
{
|
443 |
6b6504fe
|
Leszek Koltunski
|
for(int i=0; i<NUM_CUBITS; i++) CUBITS[i].savePreferences(editor);
|
444 |
a10ada2a
|
Leszek Koltunski
|
}
|
445 |
f16ff19d
|
Leszek Koltunski
|
|
446 |
a10ada2a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
447 |
27a70eae
|
Leszek Koltunski
|
|
448 |
8bbac3c2
|
Leszek Koltunski
|
public synchronized void restorePreferences(SharedPreferences preferences)
|
449 |
a10ada2a
|
Leszek Koltunski
|
{
|
450 |
2fcad75d
|
Leszek Koltunski
|
for(int i=0; i<NUM_CUBITS; i++)
|
451 |
|
|
{
|
452 |
6b6504fe
|
Leszek Koltunski
|
int index = CUBITS[i].restorePreferences(preferences);
|
453 |
|
|
mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(),index);
|
454 |
2fcad75d
|
Leszek Koltunski
|
}
|
455 |
a10ada2a
|
Leszek Koltunski
|
}
|
456 |
27a70eae
|
Leszek Koltunski
|
|
457 |
a10ada2a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
458 |
|
|
|
459 |
|
|
public void releaseResources()
|
460 |
|
|
{
|
461 |
|
|
mTexture.markForDeletion();
|
462 |
|
|
}
|
463 |
|
|
|
464 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
465 |
|
|
|
466 |
|
|
public void apply(Effect effect, int position)
|
467 |
|
|
{
|
468 |
8cccfb10
|
Leszek Koltunski
|
mEffects.apply(effect, position);
|
469 |
a10ada2a
|
Leszek Koltunski
|
}
|
470 |
|
|
|
471 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
472 |
|
|
|
473 |
|
|
public void remove(long effectID)
|
474 |
|
|
{
|
475 |
8cccfb10
|
Leszek Koltunski
|
mEffects.abortById(effectID);
|
476 |
a10ada2a
|
Leszek Koltunski
|
}
|
477 |
74686c71
|
Leszek Koltunski
|
|
478 |
a10ada2a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
479 |
|
|
|
480 |
8bbac3c2
|
Leszek Koltunski
|
public synchronized void solve()
|
481 |
a10ada2a
|
Leszek Koltunski
|
{
|
482 |
98904e45
|
Leszek Koltunski
|
for(int i=0; i<NUM_CUBITS; i++)
|
483 |
|
|
{
|
484 |
6b6504fe
|
Leszek Koltunski
|
CUBITS[i].solve();
|
485 |
|
|
mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(), 0);
|
486 |
a10ada2a
|
Leszek Koltunski
|
}
|
487 |
|
|
}
|
488 |
|
|
|
489 |
1f9772f3
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
490 |
|
|
|
491 |
|
|
public void resetAllTextureMaps()
|
492 |
|
|
{
|
493 |
eab9d8f8
|
Leszek Koltunski
|
final float ratio = 1.0f/(NUM_TEXTURES+1);
|
494 |
f6d06256
|
Leszek Koltunski
|
int color;
|
495 |
380162cb
|
Leszek Koltunski
|
|
496 |
ad73edd5
|
Leszek Koltunski
|
for(int cubit=0; cubit<NUM_CUBITS; cubit++)
|
497 |
1f9772f3
|
Leszek Koltunski
|
{
|
498 |
8f53e513
|
Leszek Koltunski
|
final Static4D[] maps = new Static4D[NUM_CUBIT_FACES];
|
499 |
ad73edd5
|
Leszek Koltunski
|
|
500 |
f6d06256
|
Leszek Koltunski
|
for(int cubitface=0; cubitface<NUM_CUBIT_FACES; cubitface++)
|
501 |
ad73edd5
|
Leszek Koltunski
|
{
|
502 |
f6d06256
|
Leszek Koltunski
|
color = getFaceColor(cubit,cubitface,mSize);
|
503 |
|
|
maps[cubitface] = new Static4D( color*ratio, 0.0f, ratio, 1.0f);
|
504 |
ad73edd5
|
Leszek Koltunski
|
}
|
505 |
|
|
|
506 |
8f53e513
|
Leszek Koltunski
|
mMesh.setTextureMap(maps,NUM_CUBIT_FACES*cubit);
|
507 |
1f9772f3
|
Leszek Koltunski
|
}
|
508 |
|
|
}
|
509 |
|
|
|
510 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
511 |
|
|
|
512 |
|
|
public void setTextureMap(int cubit, int face, int newColor)
|
513 |
|
|
{
|
514 |
eab9d8f8
|
Leszek Koltunski
|
final float ratio = 1.0f/(NUM_TEXTURES+1);
|
515 |
8f53e513
|
Leszek Koltunski
|
final Static4D[] maps = new Static4D[NUM_CUBIT_FACES];
|
516 |
1f9772f3
|
Leszek Koltunski
|
|
517 |
e03e0352
|
Leszek Koltunski
|
maps[face] = new Static4D( newColor*ratio, 0.0f, ratio, 1.0f);
|
518 |
8f53e513
|
Leszek Koltunski
|
mMesh.setTextureMap(maps,NUM_CUBIT_FACES*cubit);
|
519 |
1f9772f3
|
Leszek Koltunski
|
}
|
520 |
|
|
|
521 |
a10ada2a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
522 |
|
|
|
523 |
8bbac3c2
|
Leszek Koltunski
|
public synchronized void beginNewRotation(int axis, int row )
|
524 |
a10ada2a
|
Leszek Koltunski
|
{
|
525 |
9cd7695f
|
Leszek Koltunski
|
if( axis<0 || axis>=ROTATION_AXIS.length )
|
526 |
|
|
{
|
527 |
|
|
android.util.Log.e("object", "invalid rotation axis: "+axis);
|
528 |
|
|
return;
|
529 |
|
|
}
|
530 |
|
|
if( row<0 || row>=mSize )
|
531 |
|
|
{
|
532 |
|
|
android.util.Log.e("object", "invalid rotation row: "+row);
|
533 |
|
|
return;
|
534 |
|
|
}
|
535 |
|
|
|
536 |
27e6c301
|
Leszek Koltunski
|
mRotAxis = axis;
|
537 |
|
|
mRotRowBitmap= (1<<row);
|
538 |
a10ada2a
|
Leszek Koltunski
|
mRotationAngleStatic.set0(0.0f);
|
539 |
27e6c301
|
Leszek Koltunski
|
mRotationAxis.set( ROTATION_AXIS[axis] );
|
540 |
|
|
mRotationAngle.add(mRotationAngleStatic);
|
541 |
8cccfb10
|
Leszek Koltunski
|
mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*RubikObjectList.MAX_OBJECT_SIZE) , -1);
|
542 |
27e6c301
|
Leszek Koltunski
|
}
|
543 |
a10ada2a
|
Leszek Koltunski
|
|
544 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
545 |
|
|
|
546 |
8bbac3c2
|
Leszek Koltunski
|
public synchronized long addNewRotation( int axis, int rowBitmap, int angle, long durationMillis, EffectListener listener )
|
547 |
27e6c301
|
Leszek Koltunski
|
{
|
548 |
|
|
mRotAxis = axis;
|
549 |
|
|
mRotRowBitmap= rowBitmap;
|
550 |
a10ada2a
|
Leszek Koltunski
|
|
551 |
27e6c301
|
Leszek Koltunski
|
mRotationAngleStatic.set0(0.0f);
|
552 |
|
|
mRotationAxis.set( ROTATION_AXIS[axis] );
|
553 |
|
|
mRotationAngle.setDuration(durationMillis);
|
554 |
|
|
mRotationAngle.resetToBeginning();
|
555 |
|
|
mRotationAngle.add(new Static1D(0));
|
556 |
|
|
mRotationAngle.add(new Static1D(angle));
|
557 |
8cccfb10
|
Leszek Koltunski
|
mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*RubikObjectList.MAX_OBJECT_SIZE) , -1);
|
558 |
27e6c301
|
Leszek Koltunski
|
mRotateEffect.notifyWhenFinished(listener);
|
559 |
|
|
|
560 |
|
|
return mRotateEffect.getID();
|
561 |
|
|
}
|
562 |
a10ada2a
|
Leszek Koltunski
|
|
563 |
27e6c301
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
564 |
a10ada2a
|
Leszek Koltunski
|
|
565 |
168b6b56
|
Leszek Koltunski
|
public long finishRotationNow(EffectListener listener, int nearestAngleInDegrees)
|
566 |
27e6c301
|
Leszek Koltunski
|
{
|
567 |
|
|
float angle = getAngle();
|
568 |
|
|
mRotationAngleStatic.set0(angle);
|
569 |
|
|
mRotationAngleFinal.set0(nearestAngleInDegrees);
|
570 |
|
|
mRotationAngleMiddle.set0( nearestAngleInDegrees + (nearestAngleInDegrees-angle)*0.2f );
|
571 |
|
|
|
572 |
|
|
mRotationAngle.setDuration(POST_ROTATION_MILLISEC);
|
573 |
|
|
mRotationAngle.resetToBeginning();
|
574 |
|
|
mRotationAngle.removeAll();
|
575 |
|
|
mRotationAngle.add(mRotationAngleStatic);
|
576 |
|
|
mRotationAngle.add(mRotationAngleMiddle);
|
577 |
|
|
mRotationAngle.add(mRotationAngleFinal);
|
578 |
|
|
mRotateEffect.notifyWhenFinished(listener);
|
579 |
|
|
|
580 |
|
|
return mRotateEffect.getID();
|
581 |
|
|
}
|
582 |
001cc0e4
|
Leszek Koltunski
|
|
583 |
a10ada2a
|
Leszek Koltunski
|
|
584 |
001cc0e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
585 |
|
|
|
586 |
27e6c301
|
Leszek Koltunski
|
private float getAngle()
|
587 |
001cc0e4
|
Leszek Koltunski
|
{
|
588 |
27e6c301
|
Leszek Koltunski
|
int pointNum = mRotationAngle.getNumPoints();
|
589 |
001cc0e4
|
Leszek Koltunski
|
|
590 |
27e6c301
|
Leszek Koltunski
|
if( pointNum>=1 )
|
591 |
001cc0e4
|
Leszek Koltunski
|
{
|
592 |
27e6c301
|
Leszek Koltunski
|
return mRotationAngle.getPoint(pointNum-1).get0();
|
593 |
|
|
}
|
594 |
|
|
else
|
595 |
|
|
{
|
596 |
|
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
597 |
|
|
crashlytics.log("points in RotationAngle: "+pointNum);
|
598 |
|
|
return 0;
|
599 |
001cc0e4
|
Leszek Koltunski
|
}
|
600 |
|
|
}
|
601 |
|
|
|
602 |
a10ada2a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
603 |
|
|
|
604 |
8bbac3c2
|
Leszek Koltunski
|
public synchronized void removeRotationNow()
|
605 |
168b6b56
|
Leszek Koltunski
|
{
|
606 |
|
|
float angle = getAngle();
|
607 |
|
|
double nearestAngleInRadians = angle*Math.PI/180;
|
608 |
|
|
float sinA =-(float)Math.sin(nearestAngleInRadians*0.5);
|
609 |
|
|
float cosA = (float)Math.cos(nearestAngleInRadians*0.5);
|
610 |
|
|
float axisX = ROTATION_AXIS[mRotAxis].get0();
|
611 |
|
|
float axisY = ROTATION_AXIS[mRotAxis].get1();
|
612 |
|
|
float axisZ = ROTATION_AXIS[mRotAxis].get2();
|
613 |
|
|
Static4D quat = new Static4D( axisX*sinA, axisY*sinA, axisZ*sinA, cosA);
|
614 |
|
|
|
615 |
|
|
mRotationAngle.removeAll();
|
616 |
|
|
mRotationAngleStatic.set0(0);
|
617 |
|
|
|
618 |
|
|
for(int i=0; i<NUM_CUBITS; i++)
|
619 |
|
|
if( belongsToRotation(i,mRotAxis,mRotRowBitmap) )
|
620 |
|
|
{
|
621 |
6b6504fe
|
Leszek Koltunski
|
int index = CUBITS[i].removeRotationNow(quat);
|
622 |
|
|
mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(),index);
|
623 |
168b6b56
|
Leszek Koltunski
|
}
|
624 |
|
|
}
|
625 |
a10ada2a
|
Leszek Koltunski
|
|
626 |
aa171dee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
627 |
|
|
|
628 |
a31d25de
|
Leszek Koltunski
|
public void initializeObject(int[][] moves)
|
629 |
aa171dee
|
Leszek Koltunski
|
{
|
630 |
|
|
solve();
|
631 |
|
|
setupPosition(moves);
|
632 |
|
|
}
|
633 |
|
|
|
634 |
9621255f
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
635 |
|
|
|
636 |
|
|
public int getCubit(float[] point3D)
|
637 |
|
|
{
|
638 |
418aa554
|
Leszek Koltunski
|
float dist, minDist = Float.MAX_VALUE;
|
639 |
9621255f
|
Leszek Koltunski
|
int currentBest=-1;
|
640 |
|
|
float multiplier = returnMultiplier();
|
641 |
|
|
|
642 |
|
|
point3D[0] *= multiplier;
|
643 |
|
|
point3D[1] *= multiplier;
|
644 |
|
|
point3D[2] *= multiplier;
|
645 |
|
|
|
646 |
|
|
for(int i=0; i<NUM_CUBITS; i++)
|
647 |
|
|
{
|
648 |
6b6504fe
|
Leszek Koltunski
|
dist = CUBITS[i].getDistSquared(point3D);
|
649 |
9621255f
|
Leszek Koltunski
|
if( dist<minDist )
|
650 |
|
|
{
|
651 |
|
|
minDist = dist;
|
652 |
|
|
currentBest = i;
|
653 |
|
|
}
|
654 |
|
|
}
|
655 |
|
|
|
656 |
|
|
return currentBest;
|
657 |
|
|
}
|
658 |
|
|
|
659 |
0e5ad27c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
660 |
|
|
|
661 |
168b6b56
|
Leszek Koltunski
|
public int computeNearestAngle(float angle, float speed)
|
662 |
0e5ad27c
|
Leszek Koltunski
|
{
|
663 |
|
|
final int NEAREST = 360/getBasicAngle();
|
664 |
|
|
|
665 |
4c864c68
|
Leszek Koltunski
|
int tmp = (int)((angle+NEAREST/2)/NEAREST);
|
666 |
|
|
if( angle< -(NEAREST*0.5) ) tmp-=1;
|
667 |
168b6b56
|
Leszek Koltunski
|
|
668 |
4c864c68
|
Leszek Koltunski
|
if( tmp!=0 ) return NEAREST*tmp;
|
669 |
168b6b56
|
Leszek Koltunski
|
|
670 |
c7b00dfb
|
Leszek Koltunski
|
return speed> 1.2f ? NEAREST*(angle>0 ? 1:-1) : 0;
|
671 |
0e5ad27c
|
Leszek Koltunski
|
}
|
672 |
|
|
|
673 |
5b893eee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
674 |
|
|
|
675 |
|
|
public int getNodeSize()
|
676 |
|
|
{
|
677 |
|
|
return mNodeSize;
|
678 |
|
|
}
|
679 |
|
|
|
680 |
aa171dee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
681 |
|
|
|
682 |
|
|
public RubikObjectList getObjectList()
|
683 |
|
|
{
|
684 |
|
|
return mList;
|
685 |
|
|
}
|
686 |
|
|
|
687 |
10a2e360
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
688 |
|
|
|
689 |
f0fa83ae
|
Leszek Koltunski
|
abstract float getScreenRatio();
|
690 |
10a2e360
|
Leszek Koltunski
|
abstract Static3D[] getCubitPositions(int size);
|
691 |
10585385
|
Leszek Koltunski
|
abstract Static4D[] getQuats();
|
692 |
411c6285
|
Leszek Koltunski
|
abstract int getNumFaces();
|
693 |
eab9d8f8
|
Leszek Koltunski
|
abstract int getNumStickerTypes();
|
694 |
8f53e513
|
Leszek Koltunski
|
abstract int getNumCubitFaces();
|
695 |
14bd7976
|
Leszek Koltunski
|
abstract MeshBase createCubitMesh(int cubit);
|
696 |
7289fd6c
|
Leszek Koltunski
|
abstract void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top, int side);
|
697 |
f6d06256
|
Leszek Koltunski
|
abstract int getFaceColor(int cubit, int cubitface, int size);
|
698 |
fb377dae
|
Leszek Koltunski
|
abstract float returnMultiplier();
|
699 |
7c969a6d
|
Leszek Koltunski
|
abstract float[] getRowChances();
|
700 |
7403cdfa
|
Leszek Koltunski
|
abstract float getBasicStep();
|
701 |
7c969a6d
|
Leszek Koltunski
|
|
702 |
6b6504fe
|
Leszek Koltunski
|
public abstract boolean isSolved();
|
703 |
12ad3fca
|
Leszek Koltunski
|
public abstract Static3D[] getRotationAxis();
|
704 |
e844c116
|
Leszek Koltunski
|
public abstract int getBasicAngle();
|
705 |
fb377dae
|
Leszek Koltunski
|
public abstract int computeRowFromOffset(float offset);
|
706 |
e46e17fb
|
Leszek Koltunski
|
public abstract float returnRotationFactor(float offset);
|
707 |
20931cf6
|
Leszek Koltunski
|
public abstract String retObjectString();
|
708 |
7c969a6d
|
Leszek Koltunski
|
public abstract int randomizeNewRotAxis(Random rnd, int oldRotAxis);
|
709 |
|
|
public abstract int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis);
|
710 |
fdec60a3
|
Leszek Koltunski
|
}
|