Revision fb6a40c8
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/effect/scramble/ScrambleEffectRotations.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import java.util.Random; |
32 | 32 |
|
33 |
import static org.distorted.magic.RubikRenderer.NODE_FBO_SIZE;
|
|
33 |
import static org.distorted.object.RubikObject.NODE_FBO_SIZE;
|
|
34 | 34 |
|
35 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 36 |
|
src/main/java/org/distorted/effect/sizechange/SizeChangeEffectRound.java | ||
---|---|---|
26 | 26 |
import org.distorted.library.type.Dynamic3D; |
27 | 27 |
import org.distorted.library.type.Static3D; |
28 | 28 |
|
29 |
import static org.distorted.magic.RubikRenderer.NODE_FBO_SIZE;
|
|
29 |
import static org.distorted.object.RubikObject.NODE_FBO_SIZE;
|
|
30 | 30 |
|
31 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 32 |
|
src/main/java/org/distorted/magic/RubikPostRender.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
private RubikSurfaceView mView; |
45 | 45 |
private boolean mFinishRotation, mRemoveRotation, mRemovePatternRotation, mAddRotation, |
46 |
mSetQuatCurrent, mSetQuatAccumulated;
|
|
47 |
private boolean mChangeObject, mSolveObject, mScrambleObject;
|
|
46 |
mSetQuatCurrent, mSetQuatAccumulated, mChangeObject, mSolveObject,
|
|
47 |
mScrambleObject, mInitializeObject;
|
|
48 | 48 |
private boolean mCanRotate, mCanDrag, mCanUI; |
49 | 49 |
private boolean mIsSolved; |
50 | 50 |
private RubikObjectList mNextObject; |
... | ... | |
62 | 62 |
private long mAddRotationDuration; |
63 | 63 |
private ActionFinishedListener mAddActionListener; |
64 | 64 |
private long mAddRotationID, mRemoveRotationID; |
65 |
private boolean mInitializeObject; |
|
66 | 65 |
|
67 | 66 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
68 | 67 |
|
... | ... | |
113 | 112 |
mNewObject.recomputeScaleFactor(mScreenWidth, mScreenHeight); |
114 | 113 |
} |
115 | 114 |
|
116 |
mIsSolved = true;
|
|
115 |
mIsSolved = mNewObject.isSolved();
|
|
117 | 116 |
} |
118 | 117 |
|
119 | 118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/magic/RubikRenderer.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
public class RubikRenderer implements GLSurfaceView.Renderer |
34 | 34 |
{ |
35 |
public static final int NODE_FBO_SIZE = 600; |
|
36 |
|
|
37 | 35 |
private RubikSurfaceView mView; |
38 | 36 |
private DistortedScreen mScreen; |
39 | 37 |
|
src/main/java/org/distorted/object/RubikObject.java | ||
---|---|---|
39 | 39 |
import org.distorted.library.type.Static3D; |
40 | 40 |
import org.distorted.library.type.Static4D; |
41 | 41 |
|
42 |
import static org.distorted.magic.RubikRenderer.NODE_FBO_SIZE; |
|
43 |
|
|
44 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 43 |
|
46 | 44 |
public abstract class RubikObject extends DistortedNode |
47 | 45 |
{ |
46 |
public static final int NODE_FBO_SIZE = 600; |
|
47 |
|
|
48 | 48 |
static final int TEXTURE_HEIGHT = 128; |
49 | 49 |
final float[] LEGAL_QUATS; |
50 | 50 |
final Static3D[] ROTATION_AXIS; |
... | ... | |
56 | 56 |
private int mRotRowBitmap; |
57 | 57 |
private int mRotAxis; |
58 | 58 |
private Static3D[] mOrigPos; |
59 |
private Static3D mScale, mNodeScale;
|
|
59 |
private Static3D mNodeScale; |
|
60 | 60 |
private Static4D mQuatAccumulated; |
61 | 61 |
private Cubit[] mCubits; |
62 | 62 |
private int mSize; |
... | ... | |
91 | 91 |
|
92 | 92 |
mSize = size; |
93 | 93 |
computeStartAndStep(mOrigPos); |
94 |
mNodeScale= new Static3D(1,1,1); |
|
95 |
mQuatAccumulated = quatAcc; |
|
96 |
mSinkEffect = getSink(mSize); |
|
94 | 97 |
|
95 | 98 |
mRotationAngleStatic = new Static1D(0); |
96 | 99 |
mRotationAngleMiddle = new Static1D(0); |
97 | 100 |
mRotationAngleFinal = new Static1D(0); |
98 | 101 |
|
99 |
mScale = new Static3D(1,1,1); |
|
100 |
mNodeScale= new Static3D(1,1,1); |
|
101 |
|
|
102 |
mQuatAccumulated = quatAcc; |
|
103 |
|
|
104 | 102 |
Static3D center = new Static3D(0,0,0); |
105 |
|
|
106 |
mSinkEffect = getSink(mSize); |
|
107 |
mScaleEffect = new MatrixEffectScale(mScale); |
|
103 |
float scale = OBJECT_SCREEN_RATIO*NODE_FBO_SIZE/mSize; |
|
104 |
mScaleEffect = new MatrixEffectScale(new Static3D(scale,scale,scale)); |
|
108 | 105 |
mQuatCEffect = new MatrixEffectQuaternion(quatCur, center); |
109 | 106 |
mQuatAEffect = new MatrixEffectQuaternion(quatAcc, center); |
110 | 107 |
|
... | ... | |
347 | 344 |
public void recomputeScaleFactor(int scrWidth, int scrHeight) |
348 | 345 |
{ |
349 | 346 |
float factor = Math.min(scrWidth,scrHeight); |
350 |
float scaleFactor = OBJECT_SCREEN_RATIO*NODE_FBO_SIZE/mSize; |
|
351 |
|
|
352 | 347 |
mNodeScale.set(factor,factor,factor); |
353 |
mScale.set(scaleFactor,scaleFactor,scaleFactor); |
|
354 | 348 |
} |
355 | 349 |
|
356 | 350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Minor.