Project

General

Profile

« Previous | Next » 

Revision 8e2295ad

Added by Leszek Koltunski about 4 years ago

Progress with object Movement.

View differences:

src/main/java/org/distorted/magic/RubikSurfaceView.java
302 302
                                           mRenderer.setQuatAccumulatedOnNextRender();
303 303
                                           }
304 304
                                         }
305
                                       else
305
                                       else if( mRenderer.canRotate() || mRenderer.canDrag() )
306 306
                                         {
307 307
                                         setUpDragOrRotate(x,y);
308 308
                                         }
src/main/java/org/distorted/object/RubikObjectList.java
86 86
    DistortedEffects effects = new DistortedEffects();
87 87
    MeshRectangles mesh      = new MeshRectangles(20,20);   // mesh of the node, not of the cubits
88 88

  
89
    return new RubikCube(mObjectSize, quatCur, quatAcc, texture, mesh, effects);
89
    return new RubikPyraminx(mObjectSize, quatCur, quatAcc, texture, mesh, effects);
90 90
    }
91 91

  
92 92
///////////////////////////////////////////////////////////////////////////////////////////////////
......
94 94

  
95 95
  public RubikObjectMovement getObjectMovementClass()
96 96
    {
97
    return new RubikCubeMovement();
97
    return new RubikPyraminxMovement();
98 98
    }
99 99
  }
src/main/java/org/distorted/object/RubikObjectMovement.java
135 135
    else
136 136
      {
137 137
      float norm = (float)(-a1/Math.sqrt(1-a1*a1));
138
      y0 = norm*a0; y1= norm*(a1-1/a1); y2=a2;
138
      y0 = norm*a0; y1= norm*(a1-1/a1); y2=norm*a2;
139 139
      }
140 140

  
141 141
    x0 = y1*a2 - y2*a1;  //
......
156 156
    output[1] = v0*y0 + v1*y1 + v2*y2;
157 157
    }
158 158

  
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

  
161
  private String getFaceColor(int axis)
162
    {
163
    switch(axis)
164
      {
165
      case 0: return "yellow ";
166
      case 1: return "green ";
167
      case 2: return "blue ";
168
      case 3: return "red ";
169
      }
170

  
171
    return null;
172
    }
173

  
159 174
///////////////////////////////////////////////////////////////////////////////////////////////////
160 175
// PUBLIC API
161 176
///////////////////////////////////////////////////////////////////////////////////////////////////
......
181 196

  
182 197
          if( isInsideFace(m2Dpoint) )
183 198
            {
184
 // android.util.Log.e("move", "touched "+mLastTouchedAxis+" touch point: ("+m2Dpoint[0]+","+m2Dpoint[1]+")");
199
            android.util.Log.e("move", "face "+getFaceColor(mLastTouchedAxis)+" ("+m2Dpoint[0]+","+m2Dpoint[1]+")");
185 200

  
186 201
            fillPossibleRotations(mLastTouchedAxis, mPossible);
187 202
            return true;

Also available in: Unified diff