Revision 8a40abf4
Added by Leszek Koltunski over 6 years ago
| src/main/java/org/distorted/examples/rubik/RubikCube.java | ||
|---|---|---|
| 87 | 87 |
Static3D center = new Static3D(TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f); |
| 88 | 88 |
Static4D region = new Static4D(0,0,0, TEXTURE_SIZE*0.72f); |
| 89 | 89 |
|
| 90 |
VertexEffectSink sinkEffect = new VertexEffectSink( new Static1D(3.0f - 1.8f/mSize), center, region );
|
|
| 90 |
VertexEffectSink sinkEffect = new VertexEffectSink( new Static1D(getSinkStrength()), center, region );
|
|
| 91 | 91 |
MatrixEffectMove moveEffect = new MatrixEffectMove(move); |
| 92 | 92 |
MatrixEffectScale scaleEffect = new MatrixEffectScale(scale); |
| 93 | 93 |
MatrixEffectQuaternion quatCEffect = new MatrixEffectQuaternion(quatC, center); |
| ... | ... | |
| 286 | 286 |
} |
| 287 | 287 |
} |
| 288 | 288 |
|
| 289 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 290 |
|
|
| 291 |
private float getSinkStrength() |
|
| 292 |
{
|
|
| 293 |
switch(mSize) |
|
| 294 |
{
|
|
| 295 |
case 1 : return 1.1f; |
|
| 296 |
case 2 : return 1.5f; |
|
| 297 |
case 3 : return 1.8f; |
|
| 298 |
case 4 : return 2.0f; |
|
| 299 |
default: return 3.0f - 4.0f/mSize; |
|
| 300 |
} |
|
| 301 |
} |
|
| 302 |
|
|
| 289 | 303 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 290 | 304 |
|
| 291 | 305 |
private boolean belongsToRotation(int x, int y, int z, int vector, int row) |
| src/main/java/org/distorted/examples/rubik/RubikRenderer.java | ||
|---|---|---|
| 38 | 38 |
{
|
| 39 | 39 |
private static final int NUM_CUBES = 4; |
| 40 | 40 |
private static final float CUBE_SCREEN_RATIO = 0.5f; |
| 41 |
private static final float CAMERA_DISTANCE = 0.5f; // 0.5 of the length of max(scrHeight,scrWidth)
|
|
| 41 |
private static final float CAMERA_DISTANCE = 0.6f; // 0.6 of the length of max(scrHeight,scrWidth)
|
|
| 42 | 42 |
|
| 43 | 43 |
private RubikSurfaceView mView; |
| 44 | 44 |
private DistortedScreen mScreen; |
| src/main/res/layout/rubiklayout.xml | ||
|---|---|---|
| 12 | 12 |
android:paddingBottom="10dp" |
| 13 | 13 |
android:paddingTop="10dp" > |
| 14 | 14 |
|
| 15 |
<Button |
|
| 15 |
<ImageButton
|
|
| 16 | 16 |
android:id="@+id/rubikSize2" |
| 17 | 17 |
android:layout_width="wrap_content" |
| 18 | 18 |
android:layout_height="wrap_content" |
| ... | ... | |
| 22 | 22 |
android:onClick="setSize" |
| 23 | 23 |
android:paddingLeft="5dp" |
| 24 | 24 |
android:paddingRight="5dp" |
| 25 |
android:text="@string/swirl" />
|
|
| 25 |
android:src="@drawable/button_rubik2"/>
|
|
| 26 | 26 |
|
| 27 |
<Button |
|
| 27 |
<ImageButton
|
|
| 28 | 28 |
android:id="@+id/rubikSize3" |
| 29 | 29 |
android:layout_width="wrap_content" |
| 30 | 30 |
android:layout_height="wrap_content" |
| ... | ... | |
| 34 | 34 |
android:onClick="setSize" |
| 35 | 35 |
android:paddingLeft="5dp" |
| 36 | 36 |
android:paddingRight="5dp" |
| 37 |
android:text="@string/bubble" />
|
|
| 37 |
android:src="@drawable/button_rubik3"/>
|
|
| 38 | 38 |
|
| 39 |
<Button |
|
| 39 |
<ImageButton
|
|
| 40 | 40 |
android:id="@+id/rubikSize4" |
| 41 | 41 |
android:layout_width="54dp" |
| 42 | 42 |
android:layout_height="wrap_content" |
| ... | ... | |
| 46 | 46 |
android:onClick="setSize" |
| 47 | 47 |
android:paddingLeft="5dp" |
| 48 | 48 |
android:paddingRight="5dp" |
| 49 |
android:text="@string/sink" />
|
|
| 49 |
android:src="@drawable/button_rubik4"/>
|
|
| 50 | 50 |
|
| 51 | 51 |
<Button |
| 52 | 52 |
android:id="@+id/rubikScramble" |
| ... | ... | |
| 58 | 58 |
android:onClick="Scramble" |
| 59 | 59 |
android:paddingLeft="5dp" |
| 60 | 60 |
android:paddingRight="5dp" |
| 61 |
android:text="@string/alpha" />
|
|
| 61 |
android:text="@string/scramble" />
|
|
| 62 | 62 |
|
| 63 | 63 |
</LinearLayout> |
| 64 | 64 |
|
| src/main/res/values/strings.xml | ||
|---|---|---|
| 80 | 80 |
<string name="none">None</string> |
| 81 | 81 |
<string name="effect_live">LIVE </string> |
| 82 | 82 |
<string name="effect_finished">FINISHED </string> |
| 83 |
<string name="scramble">Scramble</string> |
|
| 83 | 84 |
|
| 84 | 85 |
<string name="quality0">Highest</string> |
| 85 | 86 |
<string name="quality1">High</string> |
Also available in: Unified diff
Rubk App: improve 4 buttons in the top.