Project

General

Profile

« Previous | Next » 

Revision c1452814

Added by Leszek Koltunski over 1 year ago

Progress with Masterball - the whole object gets drawn more or less correctly now.
Remaining: issue with Sink effect not fully inflating the ball and TouchControl.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectType.java
23 23

  
24 24
public enum ObjectType
25 25
  {
26
  BALL_4 ( TwistyMasterball.class    , 28, R.drawable.mixp_3, true , false, new InitData(new int[] {4,2,2,2,2})),
27

  
26 28
  CUBE_2 ( TwistyCuboid.class        , 12, R.drawable.cube_2, true, true,  new InitData(new int[] {2,2,2})),
27 29
  CUBE_3 ( TwistyCuboid.class        , 17, R.drawable.cube_3, true, true,  new InitData(new int[] {3,3,3})),
28 30
  CUBE_4 ( TwistyCuboid.class        , 24, R.drawable.cube_4, true, false, new InitData(new int[] {4,4,4})),
......
84 86
  MIXU_3 ( TwistyMixup3x3.class      , 24, R.drawable.mixu_3, true, false, new InitData(new int[] {3,3,3})),
85 87

  
86 88
  MIXP_3 ( TwistyMixup3x3Plus.class  , 28, R.drawable.mixp_3, true , false, new InitData(new int[] {3,3,3})),
87
  BALL_4 ( TwistyMasterball.class    , 28, R.drawable.mixp_3, true , false, new InitData(new int[] {4,2,2,2,2})),
88 89
  PDUO_2 ( TwistyPyraminxDuo.class   ,  4, R.drawable.pduo_2, false, false, new InitData(new int[] {2,2,2,2})),
89 90
  MORP_3 ( TwistyMorphix.class       , 17, R.drawable.morp_3, false, false, new InitData(new int[] {3,3,3})),
90 91
  MORP_4 ( TwistyMorphix.class       , 24, R.drawable.morp_4, false, false, new InitData(new int[] {4,4,4})),
src/main/java/org/distorted/objectlib/main/ShapeDiamond.java
20 20
{
21 21
  public static final Static4D DEFAULT_ROT = new Static4D(-0.31521368f, 0.36868167f, -0.6488994f, 0.5862124f);
22 22

  
23
  public static final int COLOR_BALL_1 = 0xff0157ba;
23
  public static final int COLOR_BALL_1 = 0xffff0000;
24 24
  public static final int COLOR_BALL_2 = 0xffcb2d6a;
25 25
  public static final int COLOR_BALL_3 = 0xff4ec9d0;
26 26
  public static final int COLOR_BALL_4 = 0xff4678ab;
......
43 43

  
44 44
  static final int NUM_FACES = 16;
45 45
  static final int FOV = 40;
46
  static final float RATIO = 0.68f;
46
  static final float RATIO = 0.75f;
47 47

  
48 48
///////////////////////////////////////////////////////////////////////////////////////////////////
49 49

  
src/main/java/org/distorted/objectlib/main/TwistyObject.java
1719 1719
      case  6: return (SQ3/2)*mSize;
1720 1720
      case  8: return (SQ2/2)*mSize;
1721 1721
      case 12: return (SQ3/2)*((SQ5+1)/2)*mSize;
1722
      case 16: return 0.50f*mSize;
1722 1723
      }
1723 1724

  
1724 1725
    return 0.0f;
src/main/java/org/distorted/objectlib/objects/TwistyMasterball.java
50 50
    super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
51 51
    }
52 52

  
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

  
55
  @Override
56
  public float getPillowCoeff()
57
    {
58
    return 1000f;
59
    }
60

  
53 61
///////////////////////////////////////////////////////////////////////////////////////////////////
54 62

  
55 63
  public ScrambleState[] getScrambleStates()
......
127 135

  
128 136
  public float[] getDist3D(int[] numLayers)
129 137
    {
130
    final float D = (float)Math.sqrt((2*SQ2+5)/17);
138
    final float D = 0.5f*(float)Math.sqrt((2*SQ2+5)/17);
131 139
    return new float[] { D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D };
132 140
    }
133 141

  
......
139 147
    final float sinA = (float)(0.5f*Math.sqrt(2-SQ2));
140 148
    final float cosA = (float)(0.5f*Math.sqrt(2+SQ2));
141 149

  
142
    final float X = sinA*cosA/(1+cosA*cosA);
143
    final float Y = cosA*cosA/(1+cosA*cosA);
144
    final float Z = cosA*cosA/(1+cosA*cosA);
150
    float X = sinA*cosA/(1+cosA*cosA);
151
    float Y = cosA*cosA/(1+cosA*cosA);
152
    float Z = cosA*cosA/(1+cosA*cosA);
153

  
154
    float LEN = (float)Math.sqrt(X*X + Y*Y + Z*Z);
155
    X /= LEN;
156
    Y /= LEN;
157
    Z /= LEN;
145 158

  
146 159
    return new Static3D[]
147 160
        {
......
170 183
    {
171 184
    if( mCenters==null )
172 185
      {
186
      final float X1 = 3*SQ2/8;
187
      final float Y1 = 0.5f;
188
      final float Z1 = 0.750f+3*SQ2/8;
189
      final float X2 = SQ2/8;
190
      final float Y2 = 1.5f;
191
      final float Z2 = 0.25f+SQ2/8;
192

  
173 193
      mCenters = new float[][]
174 194
         {
175
           { 0.0f, 0.0f, 0.0f },  // TODO
176
           { 0.0f, 0.0f, 0.0f },
177
           { 0.0f, 0.0f, 0.0f },
178
           { 0.0f, 0.0f, 0.0f },
179
           { 0.0f, 0.0f, 0.0f },
180
           { 0.0f, 0.0f, 0.0f },
181
           { 0.0f, 0.0f, 0.0f },
182
           { 0.0f, 0.0f, 0.0f },
183
           { 0.0f, 0.0f, 0.0f },
184
           { 0.0f, 0.0f, 0.0f },
185
           { 0.0f, 0.0f, 0.0f },
186
           { 0.0f, 0.0f, 0.0f },
187
           { 0.0f, 0.0f, 0.0f },
188
           { 0.0f, 0.0f, 0.0f },
189
           { 0.0f, 0.0f, 0.0f },
190
           { 0.0f, 0.0f, 0.0f },
191

  
192
           { 0.0f, 0.0f, 0.0f },
193
           { 0.0f, 0.0f, 0.0f },
194
           { 0.0f, 0.0f, 0.0f },
195
           { 0.0f, 0.0f, 0.0f },
196
           { 0.0f, 0.0f, 0.0f },
197
           { 0.0f, 0.0f, 0.0f },
198
           { 0.0f, 0.0f, 0.0f },
199
           { 0.0f, 0.0f, 0.0f },
200
           { 0.0f, 0.0f, 0.0f },
201
           { 0.0f, 0.0f, 0.0f },
202
           { 0.0f, 0.0f, 0.0f },
203
           { 0.0f, 0.0f, 0.0f },
204
           { 0.0f, 0.0f, 0.0f },
205
           { 0.0f, 0.0f, 0.0f },
206
           { 0.0f, 0.0f, 0.0f },
207
           { 0.0f, 0.0f, 0.0f },
195
             { X1, Y1, Z1 },
196
             { X1,-Y1, Z1 },
197
             { Z1, Y1, X1 },
198
             { Z1,-Y1, X1 },
199
             { Z1, Y1,-X1 },
200
             { Z1,-Y1,-X1 },
201
             { X1, Y1,-Z1 },
202
             { X1,-Y1,-Z1 },
203
             {-X1, Y1,-Z1 },
204
             {-X1,-Y1,-Z1 },
205
             {-Z1, Y1,-X1 },
206
             {-Z1,-Y1,-X1 },
207
             {-Z1, Y1, X1 },
208
             {-Z1,-Y1, X1 },
209
             {-X1, Y1, Z1 },
210
             {-X1,-Y1, Z1 },
211

  
212
             { X2, Y2, Z2 },
213
             { X2,-Y2, Z2 },
214
             { Z2, Y2, X2 },
215
             { Z2,-Y2, X2 },
216
             { Z2, Y2,-X2 },
217
             { Z2,-Y2,-X2 },
218
             { X2, Y2,-Z2 },
219
             { X2,-Y2,-Z2 },
220
             {-X2, Y2,-Z2 },
221
             {-X2,-Y2,-Z2 },
222
             {-Z2, Y2,-X2 },
223
             {-Z2,-Y2,-X2 },
224
             {-Z2, Y2, X2 },
225
             {-Z2,-Y2, X2 },
226
             {-X2, Y2, Z2 },
227
             {-X2,-Y2, Z2 },
208 228
         };
209 229
      }
210 230

  
......
215 235

  
216 236
  public Static4D getCubitQuats(int cubit, int[] numLayers)
217 237
    {
218
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,    // TODO
219
                                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
238
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,13,7,9,6,12,5,8,4,15,3,11,2,14,1,10,
239
                                                    0,13,7,9,6,12,5,8,4,15,3,11,2,14,1,10 };
220 240
    return mObjectQuats[mQuatIndex[cubit]];
221 241
    }
222 242

  
......
228 248
      {
229 249
      float[][] vertices =
230 250
          {
231
              { -3*SQ2/16, -0.5f, 0.625f-3*SQ2/16 },
232
              {  5*SQ2/16, -0.5f,-0.375f+5*SQ2/16 },
233
              { -3*SQ2/16,  0.5f, 0.125f-3*SQ2/16 },
234
              {    SQ2/16,  0.5f,-0.375f+  SQ2/16 },
235
              { -3*SQ2/16, -0.5f,-0.375f-3*SQ2/16 },
236
              { -3*SQ2/16,  0.5f,-0.375f-3*SQ2/16 },
251
              { -3*SQ2/8, -0.5f, 1.250f-3*SQ2/8 },
252
              {  5*SQ2/8, -0.5f,-0.750f+5*SQ2/8 },
253
              { -3*SQ2/8,  0.5f, 0.250f-3*SQ2/8 },
254
              {    SQ2/8,  0.5f,-0.750f+  SQ2/8 },
255
              { -3*SQ2/8, -0.5f,-0.750f-3*SQ2/8 },
256
              { -3*SQ2/8,  0.5f,-0.750f-3*SQ2/8 },
237 257
          };
238 258
      int[][] indices =
239 259
          {
......
273 293
    {
274 294
    if( variant==0 )
275 295
      {
296
      int N = 7;
276 297
      float height = isInIconMode() ? 0.001f : 0.015f;
277
      float[][] bands     = { {height,35,0.25f,0.5f,5,1,0},{0.001f,35,0.25f,0.5f,5,1,0} };
298
      float[][] bands     = { {height,35,0.25f,0.5f,N,0,0},{0.001f,35,0.25f,0.5f,N,0,0} };
278 299
      int[] bandIndices   = { 0,1,1,1,1 };
279 300
      float[][] corners   = { {0.04f,0.10f} };
280
      int[] cornerIndices = { 0,0,0,0,-1,-1 };
301
      int[] cornerIndices = { -1,-1,-1,-1,-1,-1 };
281 302
      float[][] centers   = { { -3*SQ2/16, -0.5f,-0.375f-3*SQ2/16 } };
282 303
      int[] centerIndices = { 0,0,0,0,-1,-1 };
283 304
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
284 305
      }
285 306
    else
286 307
      {
308
      int N = 7;
287 309
      float height = isInIconMode() ? 0.001f : 0.020f;
288
      float[][] bands     = { {height,35,0.20f,0.6f,5,0,0}, {0.001f,35,0.20f,0.6f,5,0,0} };
310
      float[][] bands     = { {height,35,0.20f,0.6f,N,0,0}, {0.001f,35,0.20f,0.6f,N,0,0} };
289 311
      int[] bandIndices   = { 0,1,1,1 };
290 312
      float[][] corners   = { {0.02f,0.10f} };
291
      int[] cornerIndices = { 0,0,-1,0 };
313
      int[] cornerIndices = { -1,-1,-1,-1 };
292 314
      float[][] centers   = {  { -SQ2/8, -0.5f, -SQ2/8-0.25f } };
293 315
      int[] centerIndices = { 0,0,-1,0 };
294 316
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
......
313 335

  
314 336
  public float getStickerRadius()
315 337
    {
316
    return 0.07f;
338
    return 0.10f;
317 339
    }
318 340

  
319 341
///////////////////////////////////////////////////////////////////////////////////////////////////
320 342

  
321 343
  public float getStickerStroke()
322 344
    {
323
    return isInIconMode() ? 0.07f : 0.06f;
345
    return isInIconMode() ? 0.09f : 0.07f;
324 346
    }
325 347

  
326 348
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff