Project

General

Profile

« Previous | Next » 

Revision 4b4c217e

Added by Leszek Koltunski almost 4 years ago

Progress with the Kilominx - rotations.

View differences:

src/main/java/org/distorted/main/RubikRenderer.java
40 40
{
41 41
   public static final float BRIGHTNESS = 0.30f;
42 42

  
43
   private RubikSurfaceView mView;
44
   private DistortedScreen mScreen;
45
   private Fps mFPS;
43
   private final RubikSurfaceView mView;
44
   private final DistortedScreen mScreen;
45
   private final Fps mFPS;
46 46
   private boolean mErrorShown;
47 47

  
48 48
   private static class Fps
......
122 122
   @Override
123 123
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
124 124
      {
125
      DistortedLibrary.setMax(EffectType.VERTEX,25);    // 24 Cube Quats + Rotate
125
      DistortedLibrary.setMax(EffectType.VERTEX,61);    // 60 Minx Quats + Rotate
126 126
      VertexEffectRotate.enable();
127 127
      VertexEffectQuaternion.enable();
128 128
      BaseEffect.Type.enableEffects();
src/main/java/org/distorted/objects/Cubit.java
30 30
class Cubit
31 31
  {
32 32
  private final Static3D mOrigPosition;
33

  
34
  private TwistyObject mParent;
35
  private Static3D mCurrentPosition;
36
  private int mNumAxis;
33
  private final Static3D mCurrentPosition;
34
  private final TwistyObject mParent;
35
  private final int mNumAxis;
37 36

  
38 37
  int mQuatIndex;
39 38
  int[] mRotationRow;
src/main/java/org/distorted/objects/FactoryCubit.java
698 698
    float Y4= MINX_SC*H*(1/(2*MINX_C4) - MINX_C4);
699 699

  
700 700
    float[] vertices0 = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 };
701
    float[] bands0 = computeBands(0.04f,20,0.3f,0.2f,5);
701
    float[] bands0 = computeBands(0.04f,17,0.3f,0.2f,5);
702 702
    float[] vertices1 = { -X2, Y4, 0, -Y3, X2, Y4, 0, Y3 };
703
    float[] bands1 = computeBands(0.00f, 0,0.25f,0.5f,2);
703
    float[] bands1 = computeBands(0.00f, 0,0.25f,0.5f,5);
704 704

  
705 705
    meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1);
706 706
    meshes[0].setEffectAssociation(0, 1,0);
......
708 708
    meshes[1].setEffectAssociation(0, 2,0);
709 709
    meshes[2] = meshes[0].copy(true);
710 710
    meshes[2].setEffectAssociation(0, 4,0);
711
    meshes[3] = new MeshPolygon(vertices1, bands1, 0, 0);
711
    meshes[3] = new MeshPolygon(vertices1, bands1, 1, 1);
712 712
    meshes[3].setEffectAssociation(0, 8,0);
713 713
    meshes[4] = meshes[3].copy(true);
714 714
    meshes[4].setEffectAssociation(0,16,0);
src/main/java/org/distorted/objects/TwistyMinx.java
45 45
  static final float C0 = (SQ5-1)/4;                       // cos(72 deg)
46 46
  static final float C1 = (SQ5+1)/4;                       // cos(36 deg)
47 47
  static final float C2 = (SQ5+3)/4;
48
  static final float C3 = (float)(Math.sqrt(10-2*SQ5)/4);  // cos(54 deg)
48
  static final float LEN= (float)(Math.sqrt(1.25f+0.5f*SQ5));
49 49

  
50 50
  // the six rotation axis of a RubikMegaminx. Must be normalized.
51 51
  static final Static3D[] ROT_AXIS = new Static3D[]
52 52
         {
53
           new Static3D( C1/(2*C3), 1/(2*C3) , 0        ),
54
           new Static3D(-C1/(2*C3), 1/(2*C3) , 0        ),
55
           new Static3D( 0        , C1/(2*C3), 1/(2*C3) ),
56
           new Static3D( 0        ,-C1/(2*C3), 1/(2*C3) ),
57
           new Static3D( 1/(2*C3) , 0        , C1/(2*C3)),
58
           new Static3D( 1/(2*C3) , 0        ,-C1/(2*C3))
53
           new Static3D( C2/LEN, C1/LEN, 0      ),
54
           new Static3D(-C2/LEN, C1/LEN, 0      ),
55
           new Static3D( 0     , C2/LEN, C1/LEN ),
56
           new Static3D( 0     ,-C2/LEN, C1/LEN ),
57
           new Static3D( C1/LEN, 0     , C2/LEN ),
58
           new Static3D( C1/LEN, 0     ,-C2/LEN )
59 59
         };
60 60

  
61 61
  private static final int MINX_LGREEN = 0xff53aa00;
......
319 319
    float S = 0.07f;
320 320
    float R = 0.09f;
321 321

  
322
    float A = 0.86f;
322 323
    float X1= (SQ5+1)/8;
323 324
    float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
324 325
    float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8);
325 326

  
326
    float[] vertices = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 };
327
    float[] vertices = { -X1, Y2, 0, -A*Y1, X1, Y2, 0, Y1 };
327 328

  
328 329
    FactorySticker factory = FactorySticker.getInstance();
329 330
    factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face], R);
331

  
332
    float MID = TEXTURE_HEIGHT*0.5f;
333
    float WID = TEXTURE_HEIGHT*0.1f;
334
    float HEI = TEXTURE_HEIGHT*(0.47f+Y1);
335
    canvas.drawLine(left+MID-WID,top+HEI,left+MID+WID,top+HEI,paint);
330 336
    }
331 337

  
332 338
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff