Revision 7ba38dd4
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/automator/ObjectAutomator.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
DistortedFramebuffer getFramebuffer() |
52 | 52 |
{ |
53 |
ObjectLibInterface inter = mObjectControl.getInterface(); |
|
54 |
return inter.getFramebuffer(); |
|
53 |
return mObjectControl.getNode().getFramebuffer(); |
|
55 | 54 |
} |
56 | 55 |
|
57 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
113 | 112 |
for (DistortedNode node : screenNodes) frame.attach(node); |
114 | 113 |
} |
115 | 114 |
|
116 |
DistortedNode object = mObjectControl.getObject(); |
|
115 |
DistortedNode object = mObjectControl.getObject().getNode();
|
|
117 | 116 |
DistortedNode[] objectNodes = mRotate.getObjectNodes(); |
118 | 117 |
|
119 | 118 |
if( object!=null && objectNodes!=null ) |
... | ... | |
134 | 133 |
for (DistortedNode node : screenNodes) frame.detach(node); |
135 | 134 |
} |
136 | 135 |
|
137 |
DistortedNode object = mObjectControl.getObject(); |
|
136 |
DistortedNode object = mObjectControl.getObject().getNode();
|
|
138 | 137 |
DistortedNode[] objectNodes = mRotate.returnObjectNodes(); |
139 | 138 |
|
140 | 139 |
if( object!=null && objectNodes!=null ) |
src/main/java/org/distorted/objectlib/effects/BaseEffect.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import org.distorted.library.main.DistortedFramebuffer; |
27 | 27 |
|
28 |
import org.distorted.library.main.DistortedNode; |
|
28 | 29 |
import org.distorted.objectlib.effects.scramble.ScrambleEffect; |
29 | 30 |
import org.distorted.objectlib.effects.objectchange.ObjectChangeEffect; |
30 | 31 |
import org.distorted.objectlib.effects.solve.SolveEffect; |
... | ... | |
198 | 199 |
|
199 | 200 |
//////////////////////////////////////////////////////////////////////////////// |
200 | 201 |
|
201 |
public long startEffect(DistortedFramebuffer frame, ObjectPreRender pre) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
|
|
202 |
public long startEffect(ObjectPreRender pre) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException |
|
202 | 203 |
{ |
203 | 204 |
Method method1 = mClass.getDeclaredMethod("create", int.class); |
204 | 205 |
|
205 | 206 |
Object value1 = method1.invoke(null,mCurrentType); |
206 | 207 |
BaseEffect baseEffect = (BaseEffect)value1; |
207 | 208 |
|
208 |
Method method2 = mClass.getDeclaredMethod("start", int.class, DistortedFramebuffer.class, ObjectPreRender.class);
|
|
209 |
Method method2 = mClass.getDeclaredMethod("start", int.class, ObjectPreRender.class); |
|
209 | 210 |
|
210 | 211 |
Integer translated = translatePos(mCurrentPos)+1; |
211 |
Object value2 = method2.invoke(baseEffect,translated,frame,pre);
|
|
212 |
Object value2 = method2.invoke(baseEffect,translated,pre); |
|
212 | 213 |
return (Long)value2; |
213 | 214 |
} |
214 | 215 |
|
src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffect.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.distorted.library.effect.Effect; |
25 | 25 |
import org.distorted.library.main.DistortedEffects; |
26 |
import org.distorted.library.main.DistortedFramebuffer; |
|
27 | 26 |
import org.distorted.library.message.EffectListener; |
28 | 27 |
|
29 | 28 |
import org.distorted.objectlib.main.ObjectPreRender; |
30 | 29 |
import org.distorted.objectlib.main.TwistyObject; |
31 | 30 |
import org.distorted.objectlib.effects.BaseEffect; |
31 |
import org.distorted.objectlib.main.TwistyObjectNode; |
|
32 | 32 |
|
33 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 34 |
|
... | ... | |
75 | 75 |
|
76 | 76 |
ObjectPreRender mPre; |
77 | 77 |
TwistyObject[] mObject; |
78 |
DistortedFramebuffer mFrame;
|
|
78 |
TwistyObjectNode mObjectNode;
|
|
79 | 79 |
Effect[][] mCubeEffects; |
80 | 80 |
int[][] mCubeEffectPosition; |
81 | 81 |
Effect[][] mNodeEffects; |
... | ... | |
124 | 124 |
if( effectID == id ) |
125 | 125 |
{ |
126 | 126 |
effectReturned(phase); |
127 |
mObject[phase].getEffects().abortById(id);
|
|
127 |
mObjectNode.getEffects().abortById(id);
|
|
128 | 128 |
return; |
129 | 129 |
} |
130 | 130 |
} |
... | ... | |
143 | 143 |
case 0: mPhaseActive[1] = true; |
144 | 144 |
mEffectFinished[1] = createEffectsPhase1(mDuration); |
145 | 145 |
assignEffects(1); |
146 |
mFrame.attach(mObject[1]); |
|
146 |
mObjectNode.attach(mObject[1].getNode()); |
|
147 |
mObjectNode.setFOV(mObject[1].getFOV()); |
|
147 | 148 |
break; |
148 | 149 |
case 1: mPre.effectFinished(FAKE_EFFECT_ID); |
149 | 150 |
break; |
... | ... | |
154 | 155 |
switch(phase) |
155 | 156 |
{ |
156 | 157 |
case 0: mPhaseActive[0] = false; |
157 |
mFrame.detach(mObject[0]);
|
|
158 |
mObjectNode.detach(mObject[0].getNode());
|
|
158 | 159 |
break; |
159 | 160 |
case 1: mPhaseActive[1] = false; |
160 | 161 |
break; |
... | ... | |
180 | 181 |
mCubeEffects[phase][i].notifyWhenFinished(this); |
181 | 182 |
} |
182 | 183 |
|
183 |
DistortedEffects nodeEffects = mObject[phase].getEffects();
|
|
184 |
DistortedEffects nodeEffects = mObjectNode.getEffects();
|
|
184 | 185 |
|
185 | 186 |
for(int i=0; i<mNodeEffectNumber[phase]; i++) |
186 | 187 |
{ |
... | ... | |
225 | 226 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
226 | 227 |
|
227 | 228 |
@SuppressWarnings("unused") |
228 |
public long start(int duration, DistortedFramebuffer frame, ObjectPreRender pre)
|
|
229 |
public long start(int duration, ObjectPreRender pre) |
|
229 | 230 |
{ |
230 |
mFrame = frame; |
|
231 | 231 |
mObject[0] = pre.getOldObject(); |
232 | 232 |
mObject[1] = pre.getObject(); |
233 |
mObjectNode= pre.getObjectNode(); |
|
233 | 234 |
mPre = pre; |
234 | 235 |
mDuration = duration; |
235 | 236 |
|
... | ... | |
244 | 245 |
mPhaseActive[1] = true; |
245 | 246 |
mEffectFinished[1] = createEffectsPhase1(mDuration); |
246 | 247 |
assignEffects(1); |
247 |
mFrame.attach(mObject[1]);
|
|
248 |
mObjectNode.attach(mObject[1].getNode());
|
|
248 | 249 |
} |
249 | 250 |
|
250 | 251 |
return FAKE_EFFECT_ID; |
src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffectMove.java | ||
---|---|---|
30 | 30 |
{ |
31 | 31 |
public int createEffectsPhase0(int duration) |
32 | 32 |
{ |
33 |
int w = mFrame.getWidth();
|
|
34 |
int h = mFrame.getHeight();
|
|
33 |
int w = mObjectNode.getWidth();
|
|
34 |
int h = mObjectNode.getHeight();
|
|
35 | 35 |
int xmove = w/2 + (w<h?w:h)/2; |
36 | 36 |
|
37 | 37 |
mNodeEffectPosition[0] = new int[] {1}; |
... | ... | |
49 | 49 |
|
50 | 50 |
public int createEffectsPhase1(int duration) |
51 | 51 |
{ |
52 |
int w = mFrame.getWidth();
|
|
53 |
int h = mFrame.getHeight();
|
|
52 |
int w = mObjectNode.getWidth();
|
|
53 |
int h = mObjectNode.getHeight();
|
|
54 | 54 |
int xmove = w/2 + (w<h?w:h)/2; |
55 | 55 |
|
56 | 56 |
mNodeEffectPosition[1] = new int[] {1}; |
src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffectRound.java | ||
---|---|---|
32 | 32 |
{ |
33 | 33 |
public int createEffectsPhase0(int duration) |
34 | 34 |
{ |
35 |
float X = mObject[0].getNodeWidth()/3.0f;
|
|
35 |
float X = mObjectNode.getWidth()/3.0f;
|
|
36 | 36 |
|
37 | 37 |
mCubeEffectPosition[0] = new int[] {2,3}; |
38 | 38 |
mCubeEffects[0] = new Effect[mCubeEffectPosition[0].length]; |
... | ... | |
56 | 56 |
|
57 | 57 |
public int createEffectsPhase1(int duration) |
58 | 58 |
{ |
59 |
float X = mObject[0].getNodeWidth()/3.0f;
|
|
59 |
float X = mObjectNode.getWidth()/3.0f;
|
|
60 | 60 |
|
61 | 61 |
mCubeEffectPosition[1] = new int[] {2,3}; |
62 | 62 |
mCubeEffects[1] = new Effect[mCubeEffectPosition[1].length]; |
src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java | ||
---|---|---|
32 | 32 |
import org.distorted.objectlib.main.TwistyObject; |
33 | 33 |
import org.distorted.objectlib.effects.BaseEffect; |
34 | 34 |
import org.distorted.objectlib.helpers.MovesFinished; |
35 |
import org.distorted.objectlib.main.TwistyObjectNode; |
|
35 | 36 |
|
36 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 38 |
|
... | ... | |
76 | 77 |
|
77 | 78 |
ObjectPreRender mPre; |
78 | 79 |
TwistyObject mObject; |
80 |
TwistyObjectNode mObjectNode; |
|
79 | 81 |
Effect[] mNodeEffects; |
80 | 82 |
int[] mNodeEffectPosition; |
81 | 83 |
Effect[] mCubeEffects; |
... | ... | |
154 | 156 |
mCubeEffects[i].notifyWhenFinished(this); |
155 | 157 |
} |
156 | 158 |
|
157 |
DistortedEffects nodeEffects = mObject.getEffects(); |
|
159 |
DistortedEffects nodeEffects = mObjectNode.getEffects();
|
|
158 | 160 |
|
159 | 161 |
for(int i=0; i<mNodeEffectNumber; i++) |
160 | 162 |
{ |
... | ... | |
172 | 174 |
mObject.remove(mCubeEffects[i].getID()); |
173 | 175 |
} |
174 | 176 |
|
175 |
DistortedEffects nodeEffects = mObject.getEffects(); |
|
177 |
DistortedEffects nodeEffects = mObjectNode.getEffects();
|
|
176 | 178 |
|
177 | 179 |
for(int i=0; i<mNodeEffectNumber; i++) |
178 | 180 |
{ |
... | ... | |
258 | 260 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
259 | 261 |
|
260 | 262 |
@SuppressWarnings("unused") |
261 |
public long start(int duration, DistortedFramebuffer frame, ObjectPreRender pre)
|
|
263 |
public long start(int duration, ObjectPreRender pre) |
|
262 | 264 |
{ |
263 |
mObject= pre.getObject(); |
|
264 |
mPre = pre; |
|
265 |
mObject = pre.getObject(); |
|
266 |
mObjectNode = pre.getObjectNode(); |
|
267 |
mPre = pre; |
|
265 | 268 |
|
266 | 269 |
// NOT mController.solve() !! This would be a very subtle bug. We need to do this immediately, |
267 | 270 |
// because here we are already inside the mController.preRender() function (doing 'scrambleObjectNow') |
src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffectRotations.java | ||
---|---|---|
76 | 76 |
|
77 | 77 |
mCubeEffects[0] = new MatrixEffectQuaternion(dq, new Static3D(0,0,0)); |
78 | 78 |
|
79 |
float Z = mObject.getNodeWidth()/3.0f;
|
|
79 |
float Z = mObjectNode.getWidth()/3.0f;
|
|
80 | 80 |
|
81 | 81 |
Dynamic3D d0 = new Dynamic3D(duration, 0.5f); |
82 | 82 |
d0.setMode(Dynamic.MODE_PATH); |
src/main/java/org/distorted/objectlib/effects/solve/SolveEffect.java | ||
---|---|---|
30 | 30 |
import org.distorted.objectlib.main.TwistyObject; |
31 | 31 |
|
32 | 32 |
import org.distorted.objectlib.effects.BaseEffect; |
33 |
import org.distorted.objectlib.main.TwistyObjectNode; |
|
33 | 34 |
|
34 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
35 | 36 |
|
... | ... | |
72 | 73 |
|
73 | 74 |
ObjectPreRender mPre; |
74 | 75 |
TwistyObject mObject; |
75 |
DistortedFramebuffer mFrame;
|
|
76 |
TwistyObjectNode mObjectNode;
|
|
76 | 77 |
Effect[][] mCubeEffects; |
77 | 78 |
int[][] mCubeEffectPosition; |
78 | 79 |
Effect[][] mNodeEffects; |
... | ... | |
115 | 116 |
mCubeEffects[phase][i].notifyWhenFinished(this); |
116 | 117 |
} |
117 | 118 |
|
118 |
DistortedEffects nodeEffects = mObject.getEffects(); |
|
119 |
DistortedEffects nodeEffects = mObjectNode.getEffects();
|
|
119 | 120 |
|
120 | 121 |
for(int i=0; i<mNodeEffectNumber[phase]; i++) |
121 | 122 |
{ |
... | ... | |
190 | 191 |
if( effectID == id ) |
191 | 192 |
{ |
192 | 193 |
if( ++mEffectReturned == total ) effectAction(mPhase); |
193 |
mObject.getEffects().abortById(id); |
|
194 |
mObjectNode.getEffects().abortById(id);
|
|
194 | 195 |
return; |
195 | 196 |
} |
196 | 197 |
} |
... | ... | |
199 | 200 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
200 | 201 |
|
201 | 202 |
@SuppressWarnings("unused") |
202 |
public long start(int duration, DistortedFramebuffer frame, ObjectPreRender pre)
|
|
203 |
public long start(int duration, ObjectPreRender pre) |
|
203 | 204 |
{ |
204 |
mFrame = frame;
|
|
205 |
mObject = pre.getObject();
|
|
206 |
mPre = pre; |
|
207 |
mDuration= duration; |
|
205 |
mObject = pre.getObject();
|
|
206 |
mObjectNode = pre.getObjectNode();
|
|
207 |
mPre = pre;
|
|
208 |
mDuration = duration;
|
|
208 | 209 |
|
209 | 210 |
createEffectsPhase0(mDuration); |
210 | 211 |
assignEffects(mPhase); |
src/main/java/org/distorted/objectlib/effects/win/WinEffect.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.distorted.library.effect.Effect; |
25 | 25 |
import org.distorted.library.main.DistortedEffects; |
26 |
import org.distorted.library.main.DistortedFramebuffer; |
|
27 | 26 |
import org.distorted.library.message.EffectListener; |
28 | 27 |
|
29 | 28 |
import org.distorted.objectlib.main.ObjectPreRender; |
30 | 29 |
import org.distorted.objectlib.main.TwistyObject; |
31 | 30 |
import org.distorted.objectlib.effects.BaseEffect; |
31 |
import org.distorted.objectlib.main.TwistyObjectNode; |
|
32 | 32 |
|
33 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 34 |
|
... | ... | |
69 | 69 |
|
70 | 70 |
ObjectPreRender mPre; |
71 | 71 |
TwistyObject mObject; |
72 |
DistortedFramebuffer mFrame;
|
|
72 |
TwistyObjectNode mObjectNode;
|
|
73 | 73 |
Effect[] mCubeEffects; |
74 | 74 |
int[] mCubeEffectPosition; |
75 | 75 |
Effect[] mNodeEffects; |
... | ... | |
97 | 97 |
mCubeEffects[i].notifyWhenFinished(this); |
98 | 98 |
} |
99 | 99 |
|
100 |
DistortedEffects nodeEffects = mObject.getEffects(); |
|
100 |
DistortedEffects nodeEffects = mObjectNode.getEffects();
|
|
101 | 101 |
|
102 | 102 |
for(int i=0; i<mNodeEffectNumber; i++) |
103 | 103 |
{ |
... | ... | |
155 | 155 |
if( effectID == id ) |
156 | 156 |
{ |
157 | 157 |
if( ++mEffectReturned == total ) mPre.effectFinished(FAKE_EFFECT_ID); |
158 |
mObject.getEffects().abortById(id); |
|
158 |
mObjectNode.getEffects().abortById(id);
|
|
159 | 159 |
return; |
160 | 160 |
} |
161 | 161 |
} |
... | ... | |
164 | 164 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
165 | 165 |
|
166 | 166 |
@SuppressWarnings("unused") |
167 |
public long start(int duration, DistortedFramebuffer frame, ObjectPreRender pre)
|
|
167 |
public long start(int duration, ObjectPreRender pre) |
|
168 | 168 |
{ |
169 |
mFrame = frame;
|
|
170 |
mObject = pre.getObject();
|
|
171 |
mPre = pre; |
|
172 |
mDuration = duration; |
|
169 |
mObject = pre.getObject();
|
|
170 |
mObjectNode = pre.getObjectNode();
|
|
171 |
mPre = pre;
|
|
172 |
mDuration = duration;
|
|
173 | 173 |
|
174 | 174 |
createEffects(mDuration); |
175 | 175 |
assignEffects(); |
src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java | ||
---|---|---|
69 | 69 |
|
70 | 70 |
float moveX = mPre.getMoveX(); |
71 | 71 |
float moveY = mPre.getMoveY(); |
72 |
int width = mFrame.getWidth();
|
|
73 |
int height = mFrame.getHeight();
|
|
72 |
int width = mObjectNode.getWidth();
|
|
73 |
int height = mObjectNode.getHeight();
|
|
74 | 74 |
Static3D center = new Static3D(moveX/width, moveY/height, 0); |
75 | 75 |
float ratio = 0.5f*mObject.getRatio(); |
76 | 76 |
|
src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java | ||
---|---|---|
39 | 39 |
// objectlib calls those to figure out app's state |
40 | 40 |
int getCurrentColor(); |
41 | 41 |
int cubitIsLocked(ObjectType type, int cubit); |
42 |
DistortedFramebuffer getFramebuffer(); |
|
43 | 42 |
} |
src/main/java/org/distorted/objectlib/main/ObjectControl.java | ||
---|---|---|
54 | 54 |
private final ObjectLibInterface mInterface; |
55 | 55 |
private final ObjectPreRender mPreRender; |
56 | 56 |
private Movement mMovement; |
57 |
private TwistyObjectNode mObjectNode; |
|
57 | 58 |
private boolean mDragging, mBeginningRotation, mContinuingRotation; |
58 | 59 |
private int mScreenWidth, mScreenHeight, mScreenMin; |
59 | 60 |
private float mMoveX, mMoveY; |
... | ... | |
169 | 170 |
else |
170 | 171 |
{ |
171 | 172 |
TwistyObject object = mPreRender.getObject(); |
172 |
CAMERA_POINT.set2( object==null ? 1.21f : object.getCameraDist() );
|
|
173 |
CAMERA_POINT.set2( object==null ? 1.21f : mObjectNode.getCameraDist() );
|
|
173 | 174 |
|
174 | 175 |
Static4D touchPoint = new Static4D(x, y, 0, 0); |
175 | 176 |
Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat); |
... | ... | |
231 | 232 |
float distQuot = mInitDistance<0 ? 1.0f : distNow/ mInitDistance; |
232 | 233 |
mInitDistance = distNow; |
233 | 234 |
TwistyObject object = mPreRender.getObject(); |
234 |
if( object!=null ) object.setObjectRatio(distQuot); |
|
235 |
if( object!=null ) object.setObjectRatio(distQuot,mObjectNode.getMinSize() );
|
|
235 | 236 |
} |
236 | 237 |
else |
237 | 238 |
{ |
... | ... | |
559 | 560 |
mInterface = actioner; |
560 | 561 |
} |
561 | 562 |
|
563 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
564 |
|
|
565 |
public TwistyObjectNode getNode() |
|
566 |
{ |
|
567 |
return mObjectNode; |
|
568 |
} |
|
569 |
|
|
570 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
571 |
|
|
572 |
public void createNode(int width, int height) |
|
573 |
{ |
|
574 |
if( mObjectNode==null ) mObjectNode = new TwistyObjectNode(width,height); |
|
575 |
} |
|
576 |
|
|
562 | 577 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
563 | 578 |
|
564 | 579 |
public void setScreenSize(int width, int height) |
565 | 580 |
{ |
566 | 581 |
mScreenWidth = width; |
567 | 582 |
mScreenHeight= height; |
568 |
mScreenMin = Math.min(width,height); |
|
569 |
mPreRender.setScreenSize(width,height); |
|
583 |
mScreenMin = Math.min(width,height); |
|
584 |
|
|
585 |
mPreRender.setScreenSize(); |
|
586 |
if( mObjectNode!=null ) mObjectNode.setSize(width,height); |
|
570 | 587 |
} |
571 | 588 |
|
572 | 589 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
610 | 627 |
|
611 | 628 |
public void scaleNow(float scale) |
612 | 629 |
{ |
613 |
mPreRender.getObject().setObjectRatioNow(scale); |
|
630 |
mPreRender.getObject().setObjectRatioNow(scale,mObjectNode.getMinSize());
|
|
614 | 631 |
} |
615 | 632 |
|
616 | 633 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/main/ObjectPreRender.java | ||
---|---|---|
24 | 24 |
import android.app.Activity; |
25 | 25 |
import android.content.SharedPreferences; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedFramebuffer; |
|
28 | 27 |
import org.distorted.library.message.EffectListener; |
29 | 28 |
|
30 | 29 |
import org.distorted.library.type.Static3D; |
... | ... | |
55 | 54 |
private boolean mUIBlocked, mTouchBlocked, mIsSolved; |
56 | 55 |
private long mRotationFinishedID; |
57 | 56 |
private final long[] mEffectID; |
58 |
private int mScreenWidth, mScreenHeight; |
|
59 | 57 |
private int[][] mNextMoves; |
60 | 58 |
private int mScrambleObjectNum; |
61 | 59 |
private int mAddRotationAxis, mAddRotationRowBitmap, mAddRotationAngle; |
... | ... | |
88 | 86 |
mNewObject = null; |
89 | 87 |
|
90 | 88 |
mDebug = ""; |
91 |
|
|
92 |
mScreenWidth = 0; |
|
93 |
mScreenHeight = 0; |
|
94 | 89 |
mScrambleObjectNum = 0; |
95 | 90 |
|
96 | 91 |
mEffectID = new long[BaseEffect.Type.LENGTH]; |
... | ... | |
109 | 104 |
mOldObject = mNewObject; |
110 | 105 |
Static3D move = new Static3D(mMoveX,mMoveY,0); |
111 | 106 |
|
112 |
mNewObject = object.create( mController.getQuat(), move, mAct.get().getResources(), mScreenWidth, mScreenHeight);
|
|
107 |
mNewObject = object.create( mController.getQuat(), move, mAct.get().getResources()); |
|
113 | 108 |
|
114 | 109 |
if( mNewObject!=null ) |
115 | 110 |
{ |
... | ... | |
127 | 122 |
try |
128 | 123 |
{ |
129 | 124 |
int index = type.ordinal(); |
130 |
DistortedFramebuffer frame = mController.getInterface().getFramebuffer(); |
|
131 |
mEffectID[index] = type.startEffect(frame,this); |
|
125 |
mEffectID[index] = type.startEffect(this); |
|
132 | 126 |
} |
133 | 127 |
catch( Exception ex ) |
134 | 128 |
{ |
... | ... | |
374 | 368 |
// PUBLIC API |
375 | 369 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
376 | 370 |
|
377 |
public void setScreenSize(int width, int height)
|
|
371 |
public void setScreenSize() |
|
378 | 372 |
{ |
379 |
if( mNewObject!=null ) |
|
380 |
{ |
|
381 |
mNewObject.createTexture(); |
|
382 |
mNewObject.recomputeScaleFactor(width,height); |
|
383 |
} |
|
384 |
mScreenWidth = width; |
|
385 |
mScreenHeight= height; |
|
373 |
if( mNewObject!=null ) mNewObject.createTexture(); |
|
386 | 374 |
} |
387 | 375 |
|
388 | 376 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
570 | 558 |
return mNewObject; |
571 | 559 |
} |
572 | 560 |
|
561 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
562 |
|
|
563 |
public TwistyObjectNode getObjectNode() |
|
564 |
{ |
|
565 |
return mController.getNode(); |
|
566 |
} |
|
567 |
|
|
573 | 568 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
574 | 569 |
|
575 | 570 |
public void effectFinished(final long effectID) |
src/main/java/org/distorted/objectlib/main/ObjectType.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
158 | 155 |
|
159 | 156 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
160 | 157 |
|
161 |
public TwistyObject create(Static4D quat, Static3D move, Resources res, int surfaceW, int surfaceH)
|
|
158 |
public TwistyObject create(Static4D quat, Static3D move, Resources res) |
|
162 | 159 |
{ |
163 |
DistortedTexture texture = new DistortedTexture(); |
|
164 |
DistortedEffects effects = new DistortedEffects(); |
|
165 |
MeshSquare mesh = new MeshSquare(20,20); // mesh of the node, not of the cubits |
|
166 |
|
|
167 | 160 |
int ord = ordinal(); |
168 | 161 |
int[] numL= objects[ord].mNumLayers; |
169 | 162 |
|
... | ... | |
172 | 165 |
case 0: |
173 | 166 |
case 1: |
174 | 167 |
case 2: |
175 |
case 3: return new TwistyCuboid (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
176 |
case 4: return new TwistyJing (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
168 |
case 3: return new TwistyCuboid (numL, quat, move, res);
|
|
169 |
case 4: return new TwistyJing (numL, quat, move, res);
|
|
177 | 170 |
case 5: |
178 | 171 |
case 6: |
179 |
case 7: return new TwistyPyraminx (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
172 |
case 7: return new TwistyPyraminx (numL, quat, move, res);
|
|
180 | 173 |
case 8: |
181 |
case 9: return new TwistyKilominx (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
174 |
case 9: return new TwistyKilominx (numL, quat, move, res);
|
|
182 | 175 |
case 10: |
183 |
case 11: return new TwistyMegaminx (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
184 |
case 12: return new TwistyUltimate (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
176 |
case 11: return new TwistyMegaminx (numL, quat, move, res);
|
|
177 |
case 12: return new TwistyUltimate (numL, quat, move, res);
|
|
185 | 178 |
case 13: |
186 | 179 |
case 14: |
187 |
case 15: return new TwistyDiamond (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
188 |
case 16: return new TwistyDino6 (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
189 |
case 17: return new TwistyDino4 (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
190 |
case 18: return new TwistyRedi (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
191 |
case 19: return new TwistyHelicopter (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
180 |
case 15: return new TwistyDiamond (numL, quat, move, res);
|
|
181 |
case 16: return new TwistyDino6 (numL, quat, move, res);
|
|
182 |
case 17: return new TwistyDino4 (numL, quat, move, res);
|
|
183 |
case 18: return new TwistyRedi (numL, quat, move, res);
|
|
184 |
case 19: return new TwistyHelicopter (numL, quat, move, res);
|
|
192 | 185 |
case 20: |
193 |
case 21: return new TwistySkewb (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
194 |
case 22: return new TwistyIvy (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
195 |
case 23: return new TwistyRex (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
196 |
case 24: return new TwistyBandagedFused (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
197 |
case 25: return new TwistyBandaged2Bar (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
198 |
case 26: return new TwistyBandaged3Plate(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
199 |
case 27: return new TwistyBandagedEvil (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
200 |
case 28: return new TwistySquare1 (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
201 |
case 29: return new TwistySquare2 (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
186 |
case 21: return new TwistySkewb (numL, quat, move, res);
|
|
187 |
case 22: return new TwistyIvy (numL, quat, move, res);
|
|
188 |
case 23: return new TwistyRex (numL, quat, move, res);
|
|
189 |
case 24: return new TwistyBandagedFused (numL, quat, move, res);
|
|
190 |
case 25: return new TwistyBandaged2Bar (numL, quat, move, res);
|
|
191 |
case 26: return new TwistyBandaged3Plate(numL, quat, move, res);
|
|
192 |
case 27: return new TwistyBandagedEvil (numL, quat, move, res);
|
|
193 |
case 28: return new TwistySquare1 (numL, quat, move, res);
|
|
194 |
case 29: return new TwistySquare2 (numL, quat, move, res);
|
|
202 | 195 |
case 30: |
203 |
case 31: return new TwistyMirror (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
196 |
case 31: return new TwistyMirror (numL, quat, move, res);
|
|
204 | 197 |
case 32: |
205 | 198 |
case 33: |
206 |
case 34: return new TwistyCuboid (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
199 |
case 34: return new TwistyCuboid (numL, quat, move, res);
|
|
207 | 200 |
} |
208 | 201 |
|
209 | 202 |
return null; |
src/main/java/org/distorted/objectlib/main/Twisty12.java | ||
---|---|---|
53 | 53 |
|
54 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
55 | 55 |
|
56 |
public Twisty12(int[] numLayers, float realSize, Static4D quat, Static3D move, DistortedTexture texture, |
|
57 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
56 |
public Twisty12(int[] numLayers, float realSize, Static4D quat, Static3D move, Resources res) |
|
58 | 57 |
{ |
59 |
super(numLayers, realSize, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
58 |
super(numLayers, realSize, quat, move, res);
|
|
60 | 59 |
} |
61 | 60 |
|
62 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
82 | 81 |
|
83 | 82 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
84 | 83 |
|
85 |
protected int getFOV()
|
|
84 |
public int getFOV()
|
|
86 | 85 |
{ |
87 | 86 |
return 30; |
88 | 87 |
} |
src/main/java/org/distorted/objectlib/main/Twisty4.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
39 | 36 |
|
40 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 38 |
|
42 |
public Twisty4(int[] numLayers, float realSize, Static4D quat, Static3D move, DistortedTexture texture, |
|
43 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
39 |
public Twisty4(int[] numLayers, float realSize, Static4D quat, Static3D move, Resources res) |
|
44 | 40 |
{ |
45 |
super(numLayers, realSize, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
41 |
super(numLayers, realSize, quat, move, res);
|
|
46 | 42 |
} |
47 | 43 |
|
48 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
68 | 64 |
|
69 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
70 | 66 |
|
71 |
protected int getFOV()
|
|
67 |
public int getFOV()
|
|
72 | 68 |
{ |
73 | 69 |
return 30; |
74 | 70 |
} |
src/main/java/org/distorted/objectlib/main/Twisty6.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 42 |
|
43 |
public Twisty6(int[] numLayers, float realSize, Static4D quat, Static3D move, DistortedTexture texture, |
|
44 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
43 |
public Twisty6(int[] numLayers, float realSize, Static4D quat, Static3D move, Resources res) |
|
45 | 44 |
{ |
46 |
super(numLayers, realSize, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
45 |
super(numLayers, realSize, quat, move, res);
|
|
47 | 46 |
} |
48 | 47 |
|
49 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
69 | 68 |
|
70 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
71 | 70 |
|
72 |
protected int getFOV()
|
|
71 |
public int getFOV()
|
|
73 | 72 |
{ |
74 | 73 |
return 60; |
75 | 74 |
} |
src/main/java/org/distorted/objectlib/main/Twisty8.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 43 |
|
44 |
public Twisty8(int[] numLayers, float realSize, Static4D quat, Static3D move, DistortedTexture texture, |
|
45 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
44 |
public Twisty8(int[] numLayers, float realSize, Static4D quat, Static3D move, Resources res) |
|
46 | 45 |
{ |
47 |
super(numLayers, realSize, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
46 |
super(numLayers, realSize, quat, move, res);
|
|
48 | 47 |
} |
49 | 48 |
|
50 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
70 | 69 |
|
71 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 71 |
|
73 |
protected int getFOV()
|
|
72 |
public int getFOV()
|
|
74 | 73 |
{ |
75 | 74 |
return 60; |
76 | 75 |
} |
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
41 | 41 |
import org.distorted.library.mesh.MeshBase; |
42 | 42 |
import org.distorted.library.mesh.MeshFile; |
43 | 43 |
import org.distorted.library.mesh.MeshJoined; |
44 |
import org.distorted.library.mesh.MeshSquare; |
|
45 | 44 |
import org.distorted.library.message.EffectListener; |
46 | 45 |
import org.distorted.library.type.Dynamic1D; |
47 | 46 |
import org.distorted.library.type.Static1D; |
... | ... | |
68 | 67 |
|
69 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
70 | 69 |
|
71 |
public abstract class TwistyObject extends DistortedNode
|
|
70 |
public abstract class TwistyObject |
|
72 | 71 |
{ |
73 | 72 |
public static final int COLOR_YELLOW = 0xffffff00; |
74 | 73 |
public static final int COLOR_WHITE = 0xffffffff; |
... | ... | |
108 | 107 |
private final Static3D[] mAxis; |
109 | 108 |
private final float[][] mCuts; |
110 | 109 |
private final int[] mNumCuts; |
111 |
private final int mNodeW, mNodeH; |
|
112 | 110 |
private final float[][] mOrigPos; |
113 |
private final Static3D mNodeScale; |
|
114 | 111 |
private final Static4D mQuat; |
115 | 112 |
private final int[] mNumLayers; |
116 | 113 |
private final float mSize; |
... | ... | |
120 | 117 |
private final Static3D mRotationAxis; |
121 | 118 |
private final Static3D mObjectScale; |
122 | 119 |
private final int[] mQuatDebug; |
123 |
private final float mCameraDist; |
|
124 | 120 |
private final Static1D mRotationAngleStatic, mRotationAngleMiddle, mRotationAngleFinal; |
125 | 121 |
private final DistortedTexture mTexture; |
126 | 122 |
private final float mInitScreenRatio; |
... | ... | |
138 | 134 |
private Movement mMovement; |
139 | 135 |
private boolean[][] mLayerRotatable; |
140 | 136 |
private int[][][] mEnabled; |
137 |
private DistortedNode mNode; |
|
141 | 138 |
|
142 | 139 |
//////////////////// SOLVED1 //////////////////////// |
143 | 140 |
|
... | ... | |
147 | 144 |
|
148 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
149 | 146 |
|
150 |
TwistyObject(int[] numLayers, float size, Static4D quat, Static3D move, DistortedTexture nodeTexture, |
|
151 |
MeshSquare nodeMesh, DistortedEffects nodeEffects, Resources res, int surfaceW, int surfaceH) |
|
147 |
TwistyObject(int[] numLayers, float size, Static4D quat, Static3D move, Resources res) |
|
152 | 148 |
{ |
153 |
super(nodeTexture,nodeEffects,nodeMesh); |
|
154 |
|
|
155 |
mNodeW = surfaceW; |
|
156 |
mNodeH = surfaceH; |
|
157 |
|
|
158 |
resizeFBO(mNodeW,mNodeH); |
|
159 |
|
|
160 | 149 |
mNumLayers = numLayers; |
161 | 150 |
mSize = size; |
162 | 151 |
mOrigPos = getCubitPositions(mNumLayers); |
... | ... | |
195 | 184 |
} |
196 | 185 |
|
197 | 186 |
mIsBandaged = bandaged; |
198 |
|
|
199 | 187 |
mQuatDebug = new int[NUM_CUBITS]; |
200 |
|
|
201 |
mNodeScale= new Static3D(surfaceW,surfaceH,surfaceW); |
|
202 | 188 |
mQuat = quat; |
203 | 189 |
|
204 | 190 |
mRotationAngle= new Dynamic1D(); |
... | ... | |
210 | 196 |
mRotationAngleFinal = new Static1D(0); |
211 | 197 |
|
212 | 198 |
mObjectScale = new Static3D(1,1,1); |
213 |
setObjectRatioNow(1.0f); |
|
199 |
setObjectRatioNow(1.0f,720);
|
|
214 | 200 |
|
215 | 201 |
MatrixEffectScale scaleEffect = new MatrixEffectScale(mObjectScale); |
216 | 202 |
MatrixEffectQuaternion quatEffect = new MatrixEffectQuaternion(quat, CENTER); |
217 | 203 |
MatrixEffectMove moveEffect = new MatrixEffectMove(move); |
218 | 204 |
|
219 |
MatrixEffectScale nodeScaleEffect = new MatrixEffectScale(mNodeScale); |
|
220 |
nodeEffects.apply(nodeScaleEffect); |
|
221 |
|
|
222 | 205 |
mNumTexCols = NUM_STICKERS_IN_ROW; |
223 | 206 |
mNumTexRows = (NUM_TEXTURES+1)/NUM_STICKERS_IN_ROW; |
224 | 207 |
|
... | ... | |
245 | 228 |
mEffects.apply(scaleEffect); |
246 | 229 |
mEffects.apply(moveEffect); |
247 | 230 |
|
248 |
// Now postprocessed effects (the glow when you solve an object) require component centers. In |
|
249 |
// order for the effect to be in front of the object, we need to set the center to be behind it. |
|
250 |
getMesh().setComponentCenter(0,0,0,-0.1f); |
|
251 |
|
|
252 |
attach( new DistortedNode(mTexture,mEffects,mMesh) ); |
|
253 |
|
|
254 |
float fov = getFOV(); |
|
255 |
double halfFOV = fov * (Math.PI/360); |
|
256 |
mCameraDist = (0.5f*mNodeH) / ((float)Math.tan(halfFOV)*mNodeW); |
|
257 |
|
|
258 |
setProjection( fov, 0.1f); |
|
231 |
mNode = new DistortedNode(mTexture,mEffects,mMesh); |
|
259 | 232 |
} |
260 | 233 |
|
261 | 234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
1108 | 1081 |
for(int i=0; i<NUM_CUBITS; i++) CUBITS[i].savePreferences(editor); |
1109 | 1082 |
} |
1110 | 1083 |
|
1111 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1112 |
|
|
1113 |
void recomputeScaleFactor(int surfaceW, int surfaceH) |
|
1114 |
{ |
|
1115 |
mNodeScale.set(surfaceW,surfaceH,surfaceW); |
|
1116 |
} |
|
1117 |
|
|
1118 | 1084 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1119 | 1085 |
// the getFaceColors + final black in a grid (so that we do not exceed the maximum texture size) |
1120 | 1086 |
|
... | ... | |
1156 | 1122 |
|
1157 | 1123 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1158 | 1124 |
|
1159 |
void setObjectRatioNow(float sc) |
|
1125 |
void setObjectRatioNow(float sc, int nodeMinSize)
|
|
1160 | 1126 |
{ |
1161 | 1127 |
mObjectScreenRatio = sc; |
1162 |
int nodeMinSize = Math.min(mNodeW,mNodeH); |
|
1163 | 1128 |
float scale = mObjectScreenRatio*mInitScreenRatio*nodeMinSize/mSize; |
1164 | 1129 |
mObjectScale.set(scale,scale,scale); |
1165 | 1130 |
} |
1166 | 1131 |
|
1167 | 1132 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1168 | 1133 |
|
1169 |
void setObjectRatio(float sizeChange) |
|
1134 |
void setObjectRatio(float sizeChange, int nodeMinSize)
|
|
1170 | 1135 |
{ |
1171 | 1136 |
mObjectScreenRatio *= (1.0f+sizeChange)/2; |
1172 | 1137 |
|
1173 | 1138 |
if( mObjectScreenRatio>MAX_SIZE_CHANGE) mObjectScreenRatio = MAX_SIZE_CHANGE; |
1174 | 1139 |
if( mObjectScreenRatio<MIN_SIZE_CHANGE) mObjectScreenRatio = MIN_SIZE_CHANGE; |
1175 | 1140 |
|
1176 |
setObjectRatioNow(mObjectScreenRatio); |
|
1141 |
setObjectRatioNow(mObjectScreenRatio, nodeMinSize);
|
|
1177 | 1142 |
} |
1178 | 1143 |
|
1179 | 1144 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
1245 | 1210 |
return speed> 1.2f ? nearestAngle*(angle>0 ? 1:-1) : 0; |
1246 | 1211 |
} |
1247 | 1212 |
|
1248 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1249 |
|
|
1250 |
float getCameraDist() |
|
1251 |
{ |
|
1252 |
return mCameraDist; |
|
1253 |
} |
|
1254 |
|
|
1255 | 1213 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1256 | 1214 |
// INTERNAL API - those are called from 'effects' package |
1257 | 1215 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
1261 | 1219 |
mScrambler.randomizeNewScramble(scramble,rnd,curr,total); |
1262 | 1220 |
} |
1263 | 1221 |
|
1264 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1265 |
|
|
1266 |
public int getNodeWidth() |
|
1267 |
{ |
|
1268 |
return mNodeW; |
|
1269 |
} |
|
1270 |
|
|
1271 | 1222 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1272 | 1223 |
|
1273 | 1224 |
public Static4D getRotationQuat() |
... | ... | |
1342 | 1293 |
} |
1343 | 1294 |
} |
1344 | 1295 |
|
1296 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1297 |
|
|
1298 |
public DistortedNode getNode() |
|
1299 |
{ |
|
1300 |
return mNode; |
|
1301 |
} |
|
1302 |
|
|
1345 | 1303 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1346 | 1304 |
|
1347 | 1305 |
public ObjectType getObjectType() |
... | ... | |
1383 | 1341 |
|
1384 | 1342 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1385 | 1343 |
|
1386 |
protected abstract int getFOV(); |
|
1387 | 1344 |
protected abstract float getScreenRatio(); |
1388 | 1345 |
protected abstract int getColor(int face); |
1389 | 1346 |
protected abstract int getResource(int[] numLayers); |
... | ... | |
1420 | 1377 |
public abstract int getInventor(int[] numLayers); |
1421 | 1378 |
public abstract int getYearOfInvention(int[] numLayers); |
1422 | 1379 |
public abstract int getComplexity(int[] numLayers); |
1380 |
public abstract int getFOV(); |
|
1423 | 1381 |
} |
src/main/java/org/distorted/objectlib/main/TwistyObjectNode.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2021 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 |
package org.distorted.objectlib.main; |
|
21 |
|
|
22 |
import org.distorted.library.effect.MatrixEffectScale; |
|
23 |
import org.distorted.library.main.DistortedEffects; |
|
24 |
import org.distorted.library.main.DistortedNode; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 |
import org.distorted.library.type.Static3D; |
|
28 |
|
|
29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
30 |
|
|
31 |
public class TwistyObjectNode extends DistortedNode |
|
32 |
{ |
|
33 |
private final Static3D mScale; |
|
34 |
private int mWidth, mHeight, mMinSize; |
|
35 |
private float mCameraDist; |
|
36 |
|
|
37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
38 |
|
|
39 |
public TwistyObjectNode(int surfaceW, int surfaceH) |
|
40 |
{ |
|
41 |
super(new DistortedTexture(),new DistortedEffects(),new MeshSquare(20,20)); |
|
42 |
|
|
43 |
mScale= new Static3D(1,1,1); |
|
44 |
setSize(surfaceW,surfaceH); |
|
45 |
MatrixEffectScale scaleEffect = new MatrixEffectScale(mScale); |
|
46 |
getEffects().apply(scaleEffect); |
|
47 |
getMesh().setComponentCenter(0,0,0,-0.1f); |
|
48 |
setFOV(60); |
|
49 |
} |
|
50 |
|
|
51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
52 |
|
|
53 |
void setSize(int surfaceW, int surfaceH) |
|
54 |
{ |
|
55 |
mWidth = surfaceW; |
|
56 |
mHeight = surfaceH; |
|
57 |
mMinSize= Math.min(mWidth,mHeight); |
|
58 |
|
|
59 |
resizeFBO(mWidth,mHeight); |
|
60 |
|
|
61 |
mScale.set(surfaceW,surfaceH,surfaceW); |
|
62 |
} |
|
63 |
|
|
64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
65 |
|
|
66 |
float getCameraDist() |
|
67 |
{ |
|
68 |
return mCameraDist; |
|
69 |
} |
|
70 |
|
|
71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
72 |
|
|
73 |
int getMinSize() |
|
74 |
{ |
|
75 |
return mMinSize; |
|
76 |
} |
|
77 |
|
|
78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
79 |
// PUBLIC API |
|
80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
81 |
|
|
82 |
public void setFOV(float fov) |
|
83 |
{ |
|
84 |
double halfFOV = fov * (Math.PI/360); |
|
85 |
mCameraDist = (0.5f*mHeight) / ((float)Math.tan(halfFOV)*mWidth); |
|
86 |
setProjection( fov, 0.1f); |
|
87 |
} |
|
88 |
|
|
89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
90 |
|
|
91 |
public int getWidth() |
|
92 |
{ |
|
93 |
return mWidth; |
|
94 |
} |
|
95 |
|
|
96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
97 |
|
|
98 |
public int getHeight() |
|
99 |
{ |
|
100 |
return mHeight; |
|
101 |
} |
|
102 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyBandaged2Bar.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
35 | 32 |
|
36 | 33 |
public class TwistyBandaged2Bar extends TwistyBandagedAbstract |
37 | 34 |
{ |
38 |
public TwistyBandaged2Bar(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
39 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
35 |
public TwistyBandaged2Bar(int[] numL, Static4D quat, Static3D move, Resources res) |
|
40 | 36 |
{ |
41 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
37 |
super(numL, quat, move, res);
|
|
42 | 38 |
} |
43 | 39 |
|
44 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyBandaged3Plate.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
35 | 32 |
|
36 | 33 |
public class TwistyBandaged3Plate extends TwistyBandagedAbstract |
37 | 34 |
{ |
38 |
public TwistyBandaged3Plate(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
39 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
35 |
public TwistyBandaged3Plate(int[] numL, Static4D quat, Static3D move, Resources res) |
|
40 | 36 |
{ |
41 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
37 |
super(numL, quat, move, res);
|
|
42 | 38 |
} |
43 | 39 |
|
44 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyBandagedAbstract.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
73 | 70 |
|
74 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
75 | 72 |
|
76 |
TwistyBandagedAbstract(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
77 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
73 |
TwistyBandagedAbstract(int[] numL, Static4D quat, Static3D move, Resources res) |
|
78 | 74 |
{ |
79 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
75 |
super(numL, numL[0], quat, move, res);
|
|
80 | 76 |
} |
81 | 77 |
|
82 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyBandagedEvil.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
35 | 32 |
|
36 | 33 |
public class TwistyBandagedEvil extends TwistyBandagedAbstract |
37 | 34 |
{ |
38 |
public TwistyBandagedEvil(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, MeshSquare mesh, |
|
39 |
DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
35 |
public TwistyBandagedEvil(int[] numL, Static4D quat, Static3D move, Resources res) |
|
40 | 36 |
{ |
41 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
37 |
super(numL, quat, move, res);
|
|
42 | 38 |
} |
43 | 39 |
|
44 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyBandagedFused.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
35 | 32 |
|
36 | 33 |
public class TwistyBandagedFused extends TwistyBandagedAbstract |
37 | 34 |
{ |
38 |
public TwistyBandagedFused(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
39 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
35 |
public TwistyBandagedFused(int[] numL, Static4D quat, Static3D move, Resources res) |
|
40 | 36 |
{ |
41 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
37 |
super(numL, quat, move, res);
|
|
42 | 38 |
} |
43 | 39 |
|
44 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
58 | 55 |
|
59 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
60 | 57 |
|
61 |
public TwistyCuboid(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
62 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
58 |
public TwistyCuboid(int[] numL, Static4D quat, Static3D move, Resources res) |
|
63 | 59 |
{ |
64 |
super(numL, (numL[0]+numL[1]+numL[2])/3.0f, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
60 |
super(numL, (numL[0]+numL[1]+numL[2])/3.0f, quat, move, res);
|
|
65 | 61 |
} |
66 | 62 |
|
67 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyDiamond.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 64 |
|
65 |
public TwistyDiamond(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
66 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
65 |
public TwistyDiamond(int[] numL, Static4D quat, Static3D move, Resources res) |
|
67 | 66 |
{ |
68 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
67 |
super(numL, numL[0], quat, move, res);
|
|
69 | 68 |
} |
70 | 69 |
|
71 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyDino.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
59 | 56 |
|
60 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 58 |
|
62 |
TwistyDino(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
63 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
59 |
TwistyDino(int[] numL, Static4D quat, Static3D move, Resources res) |
|
64 | 60 |
{ |
65 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
61 |
super(numL, numL[0], quat, move, res);
|
|
66 | 62 |
} |
67 | 63 |
|
68 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyDino4.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
39 | 36 |
|
40 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 38 |
|
42 |
public TwistyDino4(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
43 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
39 |
public TwistyDino4(int[] numL, Static4D quat, Static3D move, Resources res) |
|
44 | 40 |
{ |
45 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
41 |
super(numL, quat, move, res);
|
|
46 | 42 |
} |
47 | 43 |
|
48 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyDino6.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects; |
|
25 |
import org.distorted.library.main.DistortedTexture; |
|
26 |
import org.distorted.library.mesh.MeshSquare; |
|
27 | 24 |
import org.distorted.library.type.Static3D; |
28 | 25 |
import org.distorted.library.type.Static4D; |
29 | 26 |
|
... | ... | |
39 | 36 |
|
40 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 38 |
|
42 |
public TwistyDino6(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
43 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
39 |
public TwistyDino6(int[] numL, Static4D quat, Static3D move, Resources res) |
|
44 | 40 |
{ |
45 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
41 |
super(numL, quat, move, res);
|
|
46 | 42 |
} |
47 | 43 |
|
48 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyHelicopter.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
65 | 62 |
|
66 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
67 | 64 |
|
68 |
public TwistyHelicopter(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
69 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
65 |
public TwistyHelicopter(int[] numL, Static4D quat, Static3D move,Resources res) |
|
70 | 66 |
{ |
71 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
67 |
super(numL, numL[0], quat, move, res);
|
|
72 | 68 |
} |
73 | 69 |
|
74 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyIvy.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
64 | 61 |
|
65 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
66 | 63 |
|
67 |
public TwistyIvy(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
68 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
64 |
public TwistyIvy(int[] numL, Static4D quat, Static3D move, Resources res) |
|
69 | 65 |
{ |
70 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
66 |
super(numL, numL[0], quat, move, res);
|
|
71 | 67 |
} |
72 | 68 |
|
73 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyJing.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
66 | 63 |
|
67 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
68 | 65 |
|
69 |
public TwistyJing(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
70 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
66 |
public TwistyJing(int[] numL, Static4D quat, Static3D move, Resources res) |
|
71 | 67 |
{ |
72 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
68 |
super(numL, numL[0], quat, move, res);
|
|
73 | 69 |
} |
74 | 70 |
|
75 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyKilominx.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
import org.distorted.library.main.QuatHelper; |
... | ... | |
45 | 42 |
|
46 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 44 |
|
48 |
public TwistyKilominx(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
49 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
45 |
public TwistyKilominx(int[] numL, Static4D quat, Static3D move, Resources res) |
|
50 | 46 |
{ |
51 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
47 |
super(numL, quat, move, res);
|
|
52 | 48 |
} |
53 | 49 |
|
54 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyMegaminx.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
import org.distorted.library.main.QuatHelper; |
... | ... | |
46 | 43 |
|
47 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 45 |
|
49 |
public TwistyMegaminx(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, |
|
50 |
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH) |
|
46 |
public TwistyMegaminx(int[] numL, Static4D quat, Static3D move, Resources res) |
|
51 | 47 |
{ |
52 |
super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
|
48 |
super(numL, quat, move, res);
|
|
53 | 49 |
} |
54 | 50 |
|
55 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyMinx.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import android.content.res.Resources; |
29 | 29 |
|
30 |
import org.distorted.library.main.DistortedEffects; |
|
31 |
import org.distorted.library.main.DistortedTexture; |
|
32 |
import org.distorted.library.mesh.MeshSquare; |
|
33 | 30 |
import org.distorted.library.type.Static3D; |
Also available in: Unified diff
Major change: separate the notion of a TwistyObject and its Node. Now,
1) the Node stays when we change objects (this makes transitions faster)
2) it's possible to just create an Object without adding it to the Screen (now app needs to explicitly create the Node and add it to its Screen itself)