Project

General

Profile

« Previous | Next » 

Revision 769409d2

Added by Leszek Koltunski over 4 years ago

The Pyraminx itself finished - now its movements!

View differences:

src/main/java/org/distorted/object/RubikObject.java
97 97
    mQuatAccumulated = quatAcc;
98 98

  
99 99
    Static3D center = new Static3D(0,0,0);
100
    Static4D region = new Static4D(0,0,0,0.72f);
100
    Static4D region = new Static4D(0,0,0,0.65f); // 0.72 for a Cube  // TODO
101 101

  
102 102
    mSinkEffect = new VertexEffectSink( new Static1D(getSinkStrength()), center, region );
103 103
    mScaleEffect = new MatrixEffectScale(mScale);
src/main/java/org/distorted/object/RubikPyraminx.java
107 107
    {
108 108
    int added = 0;
109 109

  
110
    emitRow( x      +0.5f, y+SQ3*SQ2/9, z+ SQ3/18,  1.0f, 0,     0, n-1, 1, array, added);
111
    added += (n-1);
112
    emitRow( x    +1.0f/3, y+SQ3*SQ2/9, z+2*SQ3/9,  0.5f, 0, SQ3/2, n-1, 3, array, added);
113
    added += (n-1);
114
    emitRow( x+n-1-1.0f/3, y+SQ3*SQ2/9, z+2*SQ3/9, -0.5f, 0, SQ3/2, n-1, 2, array, added);
115
    added += (n-1);
116

  
110 117
    for(int i=n; i>=1; i--)
111 118
      {
112
      emitRow(x,y,z, 1,0,0, i, -1, array, added);
119
      emitRow(x     , y, z      , 1,0,0, i  , -1, array, added);
113 120
      added += i;
121
      emitRow(x+0.5f, y, z+SQ3/6, 1,0,0, i-1,  0, array, added);
122
      added += (i-1);
114 123
      x += 0.5f;
115 124
      y += 0.0f;
116 125
      z += SQ3/2;
......
125 134
    {
126 135
    if( n>1 )
127 136
      {
128
      emitRow( x     , y, z      ,  1.0f, 0,     0, n-1, -1, array, index);
137
      emitRow( x           , y          , z        ,  1.0f, 0,     0, n-1, -1, array, index);
138
      index += (n-1);
139
      emitRow( x+0.5f      , y+SQ3*SQ2/9, z+SQ3/18 ,  1.0f, 0,     0, n-1,  1, array, index);
140
      index += (n-1);
141
      emitRow( x+0.5f      , y          , z+SQ3/2  ,  0.5f, 0, SQ3/2, n-1, -1, array, index);
142
      index += (n-1);
143
      emitRow( x    +1.0f/3, y+SQ3*SQ2/9, z+2*SQ3/9,  0.5f, 0, SQ3/2, n-1,  3, array, index);
129 144
      index += (n-1);
130
      emitRow( x+0.5f, y, z+SQ3/2,  0.5f, 0, SQ3/2, n-1, -1, array, index);
145
      emitRow( x+n-1       , y          , z        , -0.5f, 0, SQ3/2, n-1, -1, array, index);
131 146
      index += (n-1);
132
      emitRow( x+n-1 , y, z      , -0.5f, 0, SQ3/2, n-1, -1, array, index);
147
      emitRow( x+n-1-1.0f/3, y+SQ3*SQ2/9, z+2*SQ3/9, -0.5f, 0, SQ3/2, n-1,  2, array, index);
133 148
      index += (n-1);
134 149
      }
135 150
    else
......
148 163

  
149 164
  Static3D[] getCubitPositions(int size)
150 165
    {
151
    int numCubits = size>1 ? 2*size*size-4*size+4:1;//4*size*size - 6*size +4 : 1;
166
    int numCubits = size>1 ? 4*size*size - 6*size +4 : 1;
152 167
    Static3D[] tmp = new Static3D[numCubits];
153 168
    mRotArray = new int[numCubits];
154 169

  
......
192 207
    float OFF = STROKE/2 -1;
193 208
    float OFF2 = 0.5f*TEXTURE_HEIGHT + OFF;
194 209
    float HEIGHT = TEXTURE_HEIGHT - OFF;
195
    float RADIUS = TEXTURE_HEIGHT/12;
210
    float RADIUS = TEXTURE_HEIGHT/12.0f;
196 211
    float ARC1_H = 0.2f*TEXTURE_HEIGHT;
197 212
    float ARC1_W = TEXTURE_HEIGHT*0.5f;
198 213
    float ARC2_W = 0.153f*TEXTURE_HEIGHT;
......
231 246
    MatrixEffect[] effects0 = new MatrixEffect[3];
232 247
    effects0[0] = new MatrixEffectScale( new Static3D(1,SQ3/2,1) );
233 248
    effects0[1] = new MatrixEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) );
234
    effects0[2] = new MatrixEffectMove( new Static3D(0,-SQ3/6,SQ3/12) );
249
    effects0[2] = new MatrixEffectMove( new Static3D(0,-SQ3*SQ2/12,SQ3/12) );
235 250

  
236 251
    meshes[0].apply(effects0);
237 252

  
238 253
    Static1D angle = new Static1D(angleFaces);
239 254
    Static3D axis  = new Static3D(-1,0,0);
240
    Static3D center= new Static3D(0,-SQ3/6,-SQ3/6);
255
    Static3D center= new Static3D(0,-SQ3*SQ2/12,-SQ3/6);
241 256

  
242 257
    MatrixEffect[] effects1 = new MatrixEffect[5];
243 258
    effects1[0] = effects0[0];

Also available in: Unified diff