Project

General

Profile

« Previous | Next » 

Revision 649544b8

Added by Leszek Koltunski over 7 years ago

Completely redesign Noise in the Dynamics and move all the complexity to the parent class.

something does not work with it now :)

View differences:

src/main/java/org/distorted/library/type/Dynamic4D.java
29 29

  
30 30
public class Dynamic4D extends Dynamic implements Data4D
31 31
  {
32
 
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34
// the coefficients of the X(t), Y(t), Z(t), W(t) polynomials: X(t) = ax*T^3 + bx*T^2 + cx*t + dx  etc.
35
// (x,y,z,w) is the vector tangent to the path.
36
// (vx,vy,vz,vw) is the original vector from vv (copied here so when interpolating we can see if it is 
37
// still valid and if not - rebuild the Cache
38
  
39
  private class VectorCache
40
    {
41
    float ax, bx, cx, dx;
42
    float ay, by, cy, dy;
43
    float az, bz, cz, dz;
44
    float aw, bw, cw, dw;
45
   
46
    float x,y,z,w;
47
    float vx,vy,vz,vw;
48
    }
49

  
50
  private Vector<VectorCache> vc;
51
  private VectorCache tmp1, tmp2;
52

  
53 32
  private Vector<Static4D> vv;
54 33
  private Static4D prev, curr, next;
55 34

  
56
  private float vec1X,vec1Y,vec1Z,vec1W;      // vector perpendicular to v(t) and in the same plane as v(t) and a(t) (for >2 points only, in case of 2 points this is calculated differently)
57
  private float vec2X,vec2Y,vec2Z,vec2W;      // vector perpendicular to v(t) and to vec1.
58
  private float vec3X,vec3Y,vec3Z,vec3W;      // vector perpendicular to v(t) and to vec1.
59

  
60 35
///////////////////////////////////////////////////////////////////////////////////////////////////
61 36
// no array bounds checking!
62 37
  
......
88 63
      
89 64
      if( q>1 )
90 65
        {
91
        tmp1.x = nx+px/q;
92
        tmp1.y = ny+py/q;
93
        tmp1.z = nz+pz/q;
94
        tmp1.w = nw+pw/q;
66
        tmp1.tangent[0] = nx+px/q;
67
        tmp1.tangent[1] = ny+py/q;
68
        tmp1.tangent[2] = nz+pz/q;
69
        tmp1.tangent[3] = nw+pw/q;
95 70
        }
96 71
      else
97 72
        {
98
        tmp1.x = px+nx*q;
99
        tmp1.y = py+ny*q;
100
        tmp1.z = pz+nz*q;
101
        tmp1.w = pw+nw*q;
73
        tmp1.tangent[0] = px+nx*q;
74
        tmp1.tangent[1] = py+ny*q;
75
        tmp1.tangent[2] = pz+nz*q;
76
        tmp1.tangent[3] = pw+nw*q;
102 77
        }
103 78
      }
104 79
    else
105 80
      {
106
      tmp1.x = 0.0f;
107
      tmp1.y = 0.0f;
108
      tmp1.z = 0.0f;  
109
      tmp1.w = 0.0f;
81
      tmp1.tangent[0] = 0.0f;
82
      tmp1.tangent[1] = 0.0f;
83
      tmp1.tangent[2] = 0.0f;
84
      tmp1.tangent[3] = 0.0f;
110 85
      }
111 86
    }
112 87
    
......
119 94
      tmp1= vc.elementAt(0);
120 95
      curr= vv.elementAt(0);
121 96
        
122
      tmp1.ax = tmp1.ay = tmp1.az = tmp1.aw = 0.0f;
123
      tmp1.bx = tmp1.by = tmp1.bz = tmp1.bw = 0.0f;
124
      tmp1.cx = curr.x;
125
      tmp1.cy = curr.y;
126
      tmp1.cz = curr.z;
127
      tmp1.cw = curr.w;
128
      tmp1.dx = tmp1.dy = tmp1.dz = tmp1.dw = 0.0f;
97
      tmp1.a[0] = tmp1.a[1] = tmp1.a[2] = tmp1.a[3] = 0.0f;
98
      tmp1.b[0] = tmp1.b[1] = tmp1.b[2] = tmp1.b[3] = 0.0f;
99
      tmp1.c[0] = curr.x;
100
      tmp1.c[1] = curr.y;
101
      tmp1.c[2] = curr.z;
102
      tmp1.c[3] = curr.w;
103
      tmp1.d[0] = tmp1.d[1] = tmp1.d[3] = tmp1.d[3] = 0.0f;
129 104
      }
130 105
    else if( numPoints==2 )
131 106
      {
......
134 109
      curr= vv.elementAt(0);
135 110
      next= vv.elementAt(1);
136 111
      
137
      tmp1.ax = tmp1.ay = tmp1.az = tmp1.aw = 0.0f;
138
      tmp1.bx = tmp1.by = tmp1.bz = tmp1.bw = 0.0f;
139
      tmp1.cx = next.x - curr.x;
140
      tmp1.cy = next.y - curr.y;
141
      tmp1.cz = next.z - curr.z;
142
      tmp1.cw = next.w - curr.w;
143
      tmp1.dx = curr.x;
144
      tmp1.dy = curr.y;
145
      tmp1.dz = curr.z;
146
      tmp1.dw = curr.w;
112
      tmp1.a[0] = tmp1.a[1] = tmp1.a[2] = tmp1.a[3] = 0.0f;
113
      tmp1.b[0] = tmp1.b[1] = tmp1.b[2] = tmp1.b[3] = 0.0f;
114
      tmp1.c[0] = next.x - curr.x;
115
      tmp1.c[1] = next.y - curr.y;
116
      tmp1.c[2] = next.z - curr.z;
117
      tmp1.c[3] = next.w - curr.w;
118
      tmp1.d[0] = curr.x;
119
      tmp1.d[1] = curr.y;
120
      tmp1.d[2] = curr.z;
121
      tmp1.d[3] = curr.w;
147 122
      
148
      tmp2.ax = tmp2.ay = tmp2.az = tmp2.aw = 0.0f;
149
      tmp2.bx = tmp2.by = tmp2.bz = tmp2.bw = 0.0f;
150
      tmp2.cx = curr.x - next.x;
151
      tmp2.cy = curr.y - next.y;
152
      tmp2.cz = curr.z - next.z;
153
      tmp2.cw = curr.w - next.w;
154
      tmp2.dx = next.x;
155
      tmp2.dy = next.y;
156
      tmp2.dz = next.z;
157
      tmp2.dw = next.w;
123
      tmp2.a[0] = tmp2.a[1] = tmp2.a[2] = tmp2.a[3] = 0.0f;
124
      tmp2.b[0] = tmp2.b[1] = tmp2.b[2] = tmp2.b[3] = 0.0f;
125
      tmp2.c[0] = curr.x - next.x;
126
      tmp2.c[1] = curr.y - next.y;
127
      tmp2.c[2] = curr.z - next.z;
128
      tmp2.c[3] = curr.w - next.w;
129
      tmp2.d[0] = next.x;
130
      tmp2.d[1] = next.y;
131
      tmp2.d[2] = next.z;
132
      tmp2.d[3] = next.w;
158 133
      }
159 134
    else
160 135
      {
......
171 146
        curr= vv.elementAt(i);
172 147
        next= vv.elementAt(n);
173 148
      
174
        tmp1.vx = curr.x;
175
        tmp1.vy = curr.y;
176
        tmp1.vz = curr.z;
177
        tmp1.vw = curr.w;
149
        tmp1.cached[0] = curr.x;
150
        tmp1.cached[1] = curr.y;
151
        tmp1.cached[2] = curr.z;
152
        tmp1.cached[3] = curr.w;
178 153
        
179
        tmp1.ax =  2*curr.x +   tmp1.x - 2*next.x + tmp2.x;
180
        tmp1.bx = -3*curr.x - 2*tmp1.x + 3*next.x - tmp2.x;
181
        tmp1.cx = tmp1.x;
182
        tmp1.dx = curr.x;
154
        tmp1.a[0] =  2*curr.x +   tmp1.tangent[0] - 2*next.x + tmp2.tangent[0];
155
        tmp1.b[0] = -3*curr.x - 2*tmp1.tangent[0] + 3*next.x - tmp2.tangent[0];
156
        tmp1.c[0] = tmp1.tangent[0];
157
        tmp1.d[0] = curr.x;
183 158
      
184
        tmp1.ay =  2*curr.y +   tmp1.y - 2*next.y + tmp2.y;
185
        tmp1.by = -3*curr.y - 2*tmp1.y + 3*next.y - tmp2.y;
186
        tmp1.cy = tmp1.y;
187
        tmp1.dy = curr.y;
159
        tmp1.a[1] =  2*curr.y +   tmp1.tangent[1] - 2*next.y + tmp2.tangent[1];
160
        tmp1.b[1] = -3*curr.y - 2*tmp1.tangent[1] + 3*next.y - tmp2.tangent[1];
161
        tmp1.c[1] = tmp1.tangent[1];
162
        tmp1.d[1] = curr.y;
188 163
      
189
        tmp1.az =  2*curr.z +   tmp1.z - 2*next.z + tmp2.z;
190
        tmp1.bz = -3*curr.z - 2*tmp1.z + 3*next.z - tmp2.z;
191
        tmp1.cz = tmp1.z;
192
        tmp1.dz = curr.z;
164
        tmp1.a[2] =  2*curr.z +   tmp1.tangent[2] - 2*next.z + tmp2.tangent[2];
165
        tmp1.b[2] = -3*curr.z - 2*tmp1.tangent[2] + 3*next.z - tmp2.tangent[2];
166
        tmp1.c[2] = tmp1.tangent[2];
167
        tmp1.d[2] = curr.z;
193 168
        
194
        tmp1.aw =  2*curr.w +   tmp1.w - 2*next.w + tmp2.w;
195
        tmp1.bw = -3*curr.w - 2*tmp1.w + 3*next.w - tmp2.w;
196
        tmp1.cw = tmp1.w;
197
        tmp1.dw = curr.w;
169
        tmp1.a[3] =  2*curr.w +   tmp1.tangent[3] - 2*next.w + tmp2.tangent[3];
170
        tmp1.b[3] = -3*curr.w - 2*tmp1.tangent[3] + 3*next.w - tmp2.tangent[3];
171
        tmp1.c[3] = tmp1.tangent[3];
172
        tmp1.d[3] = curr.w;
198 173
        }
199 174
      }
200 175
   
201 176
    cacheDirty = false;
202 177
    }
203 178

  
204
///////////////////////////////////////////////////////////////////////////////////////////////////
205
// v is the speed vector (i.e. position p(t) differentiated by time)
206
// a is the acceleration vector (differentiate once more)
207
//
208
// Now we construct orthogonal basis with Gram-Schmidt:  
209
// vec1 = a-delta*v where delta = (v*a)/|v|^2
210
// vec2 = (0,0,1,0) - coeff1*(vx,vy,vz,vw) - coeff2*(vec1x,vec1y,vec1z,vec1w)                                     where coeff1 = vz/|v|^2, coeff2 = vec1Z/|vec1|^2
211
// vec3 = (0,0,0,1) - coeff1*(vx,vy,vz,vw) - coeff2*(vec1x,vec1y,vec1z,vec1w) - coeff3*(vec2x,vec2y,vec2z,vec2w)  where coeff1 = vw/|v|^2, coeff2 = vec1W/|vec1|^2, coeff3 = vec2W/|vec2|^2
212
    
213
  private void setUpVectors(float time,VectorCache vc)
214
    {
215
    if( vc!=null )
216
      {
217
      float vx = (3*vc.ax*time+2*vc.bx)*time+vc.cx;
218
      float vy = (3*vc.ay*time+2*vc.by)*time+vc.cy;
219
      float vz = (3*vc.az*time+2*vc.bz)*time+vc.cz;
220
      float vw = (3*vc.aw*time+2*vc.bw)*time+vc.cw;
221
     
222
      float ax = 6*vc.ax*time+2*vc.bx;
223
      float ay = 6*vc.ay*time+2*vc.by;
224
      float az = 6*vc.az*time+2*vc.bz;
225
      float aw = 6*vc.aw*time+2*vc.bw;
226
     
227
      float v_sq = vx*vx+vy*vy+vz*vz+vw*vw;
228
      float delta = (vx*ax+vy*ay+vz*az+vw*aw)/v_sq;
229
     
230
      vec1X = ax-delta*vx;
231
      vec1Y = ay-delta*vy;
232
      vec1Z = az-delta*vz;
233
      vec1W = aw-delta*vw;
234
     
235
      float vec1_sq = vec1X*vec1X+vec1Y*vec1Y+vec1Z*vec1Z+vec1W*vec1W;
236
     
237
      // construct vec2 and vec3. Cross product does not work in 4th dimension!
238
      float coeff21 = vz/v_sq;
239
      float coeff22 = vec1Z/vec1_sq;
240
      vec2X = 0.0f - coeff21*vx - coeff22*vec1X;
241
      vec2Y = 0.0f - coeff21*vy - coeff22*vec1Y;
242
      vec2Z = 1.0f - coeff21*vz - coeff22*vec1Z;
243
      vec2W = 0.0f - coeff21*vw - coeff22*vec1W;
244
     
245
      float vec2_sq = vec2X*vec2X+vec2Y*vec2Y+vec2Z*vec2Z+vec2W*vec2W;
246
      float coeff31 = vw/v_sq;
247
      float coeff32 = vec1W/vec1_sq;
248
      float coeff33 = vec2W/vec2_sq;
249
      vec3X = 0.0f - coeff31*vx - coeff32*vec1X - coeff33*vec2X;
250
      vec3Y = 0.0f - coeff31*vy - coeff32*vec1Y - coeff33*vec2Y;
251
      vec3Z = 0.0f - coeff31*vz - coeff32*vec1Z - coeff33*vec2Z;
252
      vec3W = 1.0f - coeff31*vw - coeff32*vec1W - coeff33*vec2W;
253
     
254
      float vec3_sq = vec3X*vec3X+vec3Y*vec3Y+vec3Z*vec3Z+vec3W*vec3W;
255
     
256
      float len1 = (float)Math.sqrt(v_sq/vec1_sq);   
257
      float len2 = (float)Math.sqrt(v_sq/vec2_sq);   
258
      float len3 = (float)Math.sqrt(v_sq/vec3_sq);
259
     
260
      vec1X*=len1;
261
      vec1Y*=len1;
262
      vec1Z*=len1;
263
      vec1W*=len1;
264
     
265
      vec2X*=len2;
266
      vec2Y*=len2;
267
      vec2Z*=len2;
268
      vec2W*=len2;
269
     
270
      vec3X*=len3;
271
      vec3Y*=len3;
272
      vec3Z*=len3;
273
      vec3W*=len3;
274
      }
275
    else
276
      {
277
      curr = vv.elementAt(0);
278
      next = vv.elementAt(1); 
279
     
280
      float vx = (next.x-curr.x);
281
      float vy = (next.y-curr.y);
282
      float vz = (next.z-curr.z);
283
      float vw = (next.w-curr.w);
284
     
285
      float b = (float)Math.sqrt(vx*vx+vy*vy+vz*vz);
286
     
287
      if( b>0.0f )
288
        {
289
        vec1X = vx*vw/b;
290
        vec1Y = vy*vw/b;
291
        vec1Z = vz*vw/b;
292
        vec1W = -b;
293
      
294
        float v_sq = vx*vx+vy*vy+vz*vz+vw*vw;
295
        float vec1_sq = vec1X*vec1X+vec1Y*vec1Y+vec1Z*vec1Z+vec1W*vec1W;
296
     
297
        // construct vec2 and vec3. Cross product does not work in 4th dimension!
298
        float coeff21 = vz/v_sq;
299
        float coeff22 = vec1Z/vec1_sq;
300
        vec2X = 0.0f - coeff21*vx - coeff22*vec1X;
301
        vec2Y = 0.0f - coeff21*vy - coeff22*vec1Y;
302
        vec2Z = 1.0f - coeff21*vz - coeff22*vec1Z;
303
        vec2W = 0.0f - coeff21*vw - coeff22*vec1W;
304
     
305
        float vec2_sq = vec2X*vec2X+vec2Y*vec2Y+vec2Z*vec2Z+vec2W*vec2W;
306
        float coeff31 = vw/v_sq;
307
        float coeff32 = vec1W/vec1_sq;
308
        float coeff33 = vec2W/vec2_sq;
309
        vec3X = 0.0f - coeff31*vx - coeff32*vec1X - coeff33*vec2X;
310
        vec3Y = 0.0f - coeff31*vy - coeff32*vec1Y - coeff33*vec2Y;
311
        vec3Z = 0.0f - coeff31*vz - coeff32*vec1Z - coeff33*vec2Z;
312
        vec3W = 1.0f - coeff31*vw - coeff32*vec1W - coeff33*vec2W;
313
     
314
        float vec3_sq = vec3X*vec3X+vec3Y*vec3Y+vec3Z*vec3Z+vec3W*vec3W;
315
     
316
        float len1 = (float)Math.sqrt(v_sq/vec1_sq);    
317
        float len2 = (float)Math.sqrt(v_sq/vec2_sq);    
318
        float len3 = (float)Math.sqrt(v_sq/vec3_sq);
319
     
320
        vec1X*=len1;
321
        vec1Y*=len1;
322
        vec1Z*=len1;
323
        vec1W*=len1;
324
     
325
        vec2X*=len2;
326
        vec2Y*=len2;
327
        vec2Z*=len2;
328
        vec2W*=len2;
329
     
330
        vec3X*=len3;
331
        vec3Y*=len3;
332
        vec3Z*=len3;
333
        vec3W*=len3;
334
        }
335
      else
336
        {
337
        vec1X = vw;
338
        vec1Y = 0.0f;
339
        vec1Z = 0.0f;
340
        vec1W = 0.0f;
341
      
342
        vec2X = 0.0f;
343
        vec2Y = vw;
344
        vec2Z = 0.0f;
345
        vec2W = 0.0f;
346
      
347
        vec3X = 0.0f;
348
        vec3Y = 0.0f;
349
        vec3Z = vw;
350
        vec3W = 0.0f;
351
        }
352
      }
353
    }
354
  
355 179
///////////////////////////////////////////////////////////////////////////////////////////////////
356 180
// PUBLIC API
357 181
///////////////////////////////////////////////////////////////////////////////////////////////////
......
360 184
 */
361 185
  public Dynamic4D()
362 186
    {
363
    this(0,0.5f);
187
    super(0,0.5f,4);
188
    vv = new Vector<>();
364 189
    }
365 190

  
366 191
///////////////////////////////////////////////////////////////////////////////////////////////////
......
375 200
 */
376 201
  public Dynamic4D(int duration, float count)
377 202
    {
203
    super(duration,count,4);
378 204
    vv = new Vector<>();
379
    vc = new Vector<>();
380
    vn = null;
381
    numPoints = 0;
382
    cacheDirty = false;
383
    mMode = MODE_LOOP;
384
    mDuration = duration;
385
    mCount = count;
386
    mDimension = 4;
387 205
    }
388 206

  
389 207
///////////////////////////////////////////////////////////////////////////////////////////////////
......
442 260
       switch(numPoints)
443 261
         {
444 262
         case 0: break;
445
         case 1: setUpVectors(0.0f,null);
263
         case 1: computeOrthonormalBase2(vv.elementAt(0),v);
446 264
                 break;
447
         case 2: vc.add(new VectorCache());
448
                 vc.add(new VectorCache());
449
                 vc.add(new VectorCache());
265
         case 2: vc.add(new VectorCache(4));
266
                 vc.add(new VectorCache(4));
267
                 vc.add(new VectorCache(4));
450 268
                 break;
451
         default:vc.add(new VectorCache());
269
         default:vc.add(new VectorCache(4));
452 270
         }
453 271

  
454 272
       numPoints++;
......
474 292
      switch(numPoints)
475 293
        {
476 294
        case 0: break;
477
        case 1: setUpVectors(0.0f,null);
295
        case 1: computeOrthonormalBase2(vv.elementAt(0),v);
478 296
                break;
479
        case 2: vc.add(new VectorCache());
480
                vc.add(new VectorCache());
481
                vc.add(new VectorCache());
297
        case 2: vc.add(new VectorCache(4));
298
                vc.add(new VectorCache(4));
299
                vc.add(new VectorCache(4));
482 300
                break;
483
        default:vc.add(location,new VectorCache());
301
        default:vc.add(location,new VectorCache(4));
484 302
        }
485 303

  
486 304
      numPoints++;
......
512 330
        case 1: 
513 331
        case 2: break;
514 332
        case 3: vc.removeAllElements();
515
                setUpVectors(0.0f,null);
333
                computeOrthonormalBase2(vv.elementAt(0),vv.elementAt(1));
516 334
                break;
517 335
        default:vc.remove(n);
518 336
        }
......
551 369
        case 1: 
552 370
        case 2: break;
553 371
        case 3: vc.removeAllElements();
554
                setUpVectors(0.0f,null);
372
                computeOrthonormalBase2(vv.elementAt(0),vv.elementAt(1));
555 373
                break;
556 374
        default:vc.removeElementAt(location);
557 375
        }
......
613 431
              if( vn!=null )
614 432
                {
615 433
                time = noise(time,0);
616
            
617
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (vec1X*mFactor[0] + vec2X*mFactor[1] + vec3X*mFactor[2]);
618
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (vec1Y*mFactor[0] + vec2Y*mFactor[1] + vec3Y*mFactor[2]);
619
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (vec1Z*mFactor[0] + vec2Z*mFactor[1] + vec3Z*mFactor[2]);
620
                buffer[offset+3] = (next.w-curr.w)*time + curr.w + (vec1W*mFactor[0] + vec2W*mFactor[1] + vec3W*mFactor[2]);
434

  
435
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (baseV[0][0]*mFactor[0] + baseV[1][0]*mFactor[1] + baseV[2][0]*mFactor[2]);
436
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (baseV[0][1]*mFactor[0] + baseV[1][1]*mFactor[1] + baseV[2][1]*mFactor[2]);
437
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (baseV[0][2]*mFactor[0] + baseV[1][2]*mFactor[1] + baseV[2][2]*mFactor[2]);
438
                buffer[offset+3] = (next.z-curr.z)*time + curr.z + (baseV[0][3]*mFactor[0] + baseV[1][3]*mFactor[1] + baseV[2][3]*mFactor[2]);
621 439
                }
622 440
              else
623 441
                {
......
666 484
                  next = vv.elementAt(vecNext);
667 485
                  tmp2 = vc.elementAt(vecNext);
668 486
              
669
                  if( tmp2.vx!=next.x || tmp2.vy!=next.y || tmp2.vz!=next.z || tmp2.vw!=next.w ) recomputeCache();
487
                  if( tmp2.cached[0]!=next.x || tmp2.cached[1]!=next.y || tmp2.cached[2]!=next.z || tmp2.cached[3]!=next.w ) recomputeCache();
670 488
                  }
671 489
            
672 490
                tmp1 = vc.elementAt(vecCurr);
......
675 493
                  {
676 494
                  time = noise(time,vecCurr);
677 495
              
678
                  setUpVectors(time,tmp1);
679
                 
680
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx + (vec1X*mFactor[0] + vec2X*mFactor[1] + vec3X*mFactor[2]);
681
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy + (vec1Y*mFactor[0] + vec2Y*mFactor[1] + vec3Y*mFactor[2]);
682
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz + (vec1Z*mFactor[0] + vec2Z*mFactor[1] + vec3Z*mFactor[2]);
683
                  buffer[offset+3]= ((tmp1.aw*time+tmp1.bw)*time+tmp1.cw)*time+tmp1.dw + (vec1W*mFactor[0] + vec2W*mFactor[1] + vec3W*mFactor[2]);
496
                  computeOrthonormalBaseMore(time,tmp1);
497

  
498
                  buffer[offset  ]= ((tmp1.a[0]*time+tmp1.b[0])*time+tmp1.c[0])*time+tmp1.d[0] + (baseV[0][0]*mFactor[0] + baseV[1][0]*mFactor[1] + baseV[2][0]*mFactor[2]);
499
                  buffer[offset+1]= ((tmp1.a[1]*time+tmp1.b[1])*time+tmp1.c[1])*time+tmp1.d[1] + (baseV[0][1]*mFactor[0] + baseV[1][1]*mFactor[1] + baseV[2][1]*mFactor[2]);
500
                  buffer[offset+2]= ((tmp1.a[2]*time+tmp1.b[2])*time+tmp1.c[2])*time+tmp1.d[2] + (baseV[0][2]*mFactor[0] + baseV[1][2]*mFactor[1] + baseV[2][2]*mFactor[2]);
501
                  buffer[offset+3]= ((tmp1.a[3]*time+tmp1.b[3])*time+tmp1.c[3])*time+tmp1.d[3] + (baseV[0][3]*mFactor[0] + baseV[1][3]*mFactor[1] + baseV[2][3]*mFactor[2]);
684 502
                  }
685 503
                else
686 504
                  {
687
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx;
688
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy;
689
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz;
690
                  buffer[offset+3]= ((tmp1.aw*time+tmp1.bw)*time+tmp1.cw)*time+tmp1.dw;
505
                  buffer[offset  ]= ((tmp1.a[0]*time+tmp1.b[0])*time+tmp1.c[0])*time+tmp1.d[0];
506
                  buffer[offset+1]= ((tmp1.a[1]*time+tmp1.b[1])*time+tmp1.c[1])*time+tmp1.d[1];
507
                  buffer[offset+2]= ((tmp1.a[2]*time+tmp1.b[2])*time+tmp1.c[2])*time+tmp1.d[2];
508
                  buffer[offset+3]= ((tmp1.a[3]*time+tmp1.b[3])*time+tmp1.c[3])*time+tmp1.d[3];
691 509
                  }
692 510
 
693 511
                break;

Also available in: Unified diff