Project

General

Profile

« Previous | Next » 

Revision 3002bef3

Added by Leszek Koltunski about 8 years ago

Move most of the NOISE complications from DynamicND classes to the parent Dynamic class.

View differences:

src/main/java/org/distorted/library/type/Dynamic.java
20 20
package org.distorted.library.type;
21 21

  
22 22
import java.util.Random;
23
import java.util.Vector;
23 24

  
24 25
///////////////////////////////////////////////////////////////////////////////////////////////////
25 26
/** A class to interpolate between a List of Static{1,2,3,4}Ds.
......
64 65
   * We just jump back from the last point to the first.
65 66
   */
66 67
  public static final int MODE_JUMP = 2; 
67
 
68

  
68 69
  protected static Random mRnd = new Random();
69 70
  
70 71
  protected static final int NUM_NOISE = 5; // used iff mNoise>0.0. Number of intermediary points between each pair of adjacent vectors
71 72
                                            // where we randomize noise factors to make the way between the two vectors not so smooth.
73

  
74
  protected int mDimension;
72 75
  protected int numPoints;
73 76
  protected int mVecCurr;    
74 77
  protected boolean cacheDirty; // VectorCache not up to date
......
76 79
  protected long mDuration;     // number of milliseconds it takes to do a full loop/path from first vector to the last and back to the first
77 80
  protected float mCount;       // number of loops/paths we will do; mCount = 1.5 means we go from the first vector to the last, back to first, and to the last again. 
78 81
  protected float mNoise;       // how 'smooth' our path form each vector to the next is. mNoise = 0.0 (min) --> completely smooth; mNoise==1.0 (max) --> very uneven
79
  
82

  
83
  protected class VectorNoise
84
    {
85
    float[][] n;
86

  
87
    VectorNoise(int dim)
88
      {
89
      n = new float[dim][NUM_NOISE];
90

  
91
      n[0][0] = mRnd.nextFloat();
92
      for(int i=1; i<NUM_NOISE; i++) n[0][i] = n[0][i-1]+mRnd.nextFloat();
93
      float sum = n[0][NUM_NOISE-1] + mRnd.nextFloat();
94
      for(int i=0; i<NUM_NOISE; i++) n[0][i] /=sum;
95

  
96
      for(int j=1; j<dim; j++)
97
        {
98
        for(int i=0; i<NUM_NOISE; i++) n[j][i] = mRnd.nextFloat()-0.5f;
99
        }
100
      }
101
    }
102

  
103
  protected Vector<VectorNoise> vn;
104
  protected float[] mFactor;
105

  
80 106
///////////////////////////////////////////////////////////////////////////////////////////////////
81 107
// hide this from Javadoc
82 108
  
......
128 154
    
129 155
    return false;
130 156
    }
131
 
157

  
158
///////////////////////////////////////////////////////////////////////////////////////////////////
159

  
160
  protected float noise(float time,int vecNum)
161
    {
162
    float lower, upper, len;
163
    float d = time*(NUM_NOISE+1);
164
    int index = (int)d;
165
    if( index>=NUM_NOISE+1 ) index=NUM_NOISE;
166
    VectorNoise tmpN = vn.elementAt(vecNum);
167

  
168
    float t = d-index;
169
    t = t*t*(3-2*t);
170

  
171
    switch(index)
172
      {
173
      case 0        : for(int i=0;i<mDimension-1;i++) mFactor[i] = mNoise*tmpN.n[i+1][0]*t;
174
                      return time + mNoise*(d*tmpN.n[0][0]-time);
175
      case NUM_NOISE: for(int i=0;i<mDimension-1;i++) mFactor[i] = mNoise*tmpN.n[i+1][NUM_NOISE-1]*(1-t);
176
                      len = ((float)NUM_NOISE)/(NUM_NOISE+1);
177
                      lower = len + mNoise*(tmpN.n[0][NUM_NOISE-1]-len);
178
                      return (1.0f-lower)*(d-NUM_NOISE) + lower;
179
      default       : float ya,yb;
180

  
181
                      for(int i=0;i<mDimension-1;i++)
182
                        {
183
                        yb = tmpN.n[i+1][index  ];
184
                        ya = tmpN.n[i+1][index-1];
185
                        mFactor[i] = mNoise*((yb-ya)*t+ya);
186
                        }
187

  
188
                      len = ((float)index)/(NUM_NOISE+1);
189
                      lower = len + mNoise*(tmpN.n[0][index-1]-len);
190
                      len = ((float)index+1)/(NUM_NOISE+1);
191
                      upper = len + mNoise*(tmpN.n[0][index  ]-len);
192

  
193
                      return (upper-lower)*(d-index) + lower;
194
      }
195
    }
196

  
132 197
///////////////////////////////////////////////////////////////////////////////////////////////////
133 198
// internal debugging only!
134 199
  
......
136 201
    {
137 202
    return "duration="+mDuration+" count="+mCount+" Noise="+mNoise+" numVectors="+numPoints+" mMode="+mMode;
138 203
    }
139
  
204

  
140 205
///////////////////////////////////////////////////////////////////////////////////////////////////
141
  
206

  
142 207
  abstract void interpolate(float[] buffer, int offset, float time);
143
  abstract void createNoise();
144 208

  
145 209
///////////////////////////////////////////////////////////////////////////////////////////////////
146 210
// PUBLIC API
......
214 278
 * @param noise The noise level. Permitted range: 0 <= noise <= 1.
215 279
 */
216 280
  
217
  public void setNoise(float noise)
281
  public synchronized void setNoise(float noise)
218 282
    {
219
    if( mNoise==0.0f && noise != 0.0f )  
220
      createNoise();
283
    if( mNoise==0.0f && noise != 0.0f && vn==null )
284
      {
285
      vn = new Vector<>();
286
      for(int i=0; i<numPoints; i++) vn.add(new VectorNoise(mDimension));
287

  
288
      if( mDimension>=2 )
289
        {
290
        mFactor = new float[mDimension-1];
291
        }
292
      }
221 293
   
222 294
    if( mNoise<0.0f ) mNoise = 0.0f;
223 295
    if( mNoise>1.0f ) mNoise = 1.0f;
src/main/java/org/distorted/library/type/Dynamic1D.java
43 43
    float x;
44 44
    float vx;
45 45
    }
46
  
47
  private class VectorNoise
48
    {
49
    float[] nx;
50
   
51
    VectorNoise()
52
      {
53
      nx = new float[NUM_NOISE]; 
54
      nx[0] = mRnd.nextFloat();
55
      for(int i=1; i<NUM_NOISE; i++) nx[i] = nx[i-1]+mRnd.nextFloat();
56
      float sum = nx[NUM_NOISE-1] + mRnd.nextFloat();
57
      for(int i=0; i<NUM_NOISE; i++) nx[i] /=sum;
58
      }
59
    }
60
  
46

  
61 47
  private Vector<VectorCache> vc;
62 48
  private VectorCache tmp1, tmp2;
63 49
 
64 50
  private Vector<Static1D> vv;
65 51
  private Static1D prev, curr, next;
66
 
67
  private Vector<VectorNoise> vn;
68
  private VectorNoise tmpN;
69
  
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71 52

  
72
  synchronized void createNoise()
73
    {
74
    if( vn==null )
75
      {
76
      vn = new Vector<>();
77
      for(int i=0; i<numPoints; i++) vn.add(new VectorNoise());
78
      }
79
    }
80
  
81 53
///////////////////////////////////////////////////////////////////////////////////////////////////
82 54
// no array bounds checking!
83 55
  
......
173 145
   
174 146
    cacheDirty = false;
175 147
    }
176
  
177
///////////////////////////////////////////////////////////////////////////////////////////////////
178 148

  
179
  private float noise(float time,int vecNum)
180
    {
181
    float lower, upper, len;  
182
    float d = time*(NUM_NOISE+1);
183
    int index = (int)d;
184
    if( index>=NUM_NOISE+1 ) index=NUM_NOISE;
185
    tmpN = vn.elementAt(vecNum);
186
   
187
    if( index==0 )
188
      {
189
      len = 1.0f/(NUM_NOISE+1);  
190
      return (len + mNoise*(tmpN.nx[0]-len))*d;
191
      }
192
    if( index==NUM_NOISE )
193
      {
194
      len = ((float)NUM_NOISE)/(NUM_NOISE+1);
195
      lower = len + mNoise*(tmpN.nx[NUM_NOISE-1]-len);   
196
      return (1.0f-lower)*(d-NUM_NOISE) + lower;   
197
      }
198
   
199
    len = ((float)index)/(NUM_NOISE+1);
200
    lower = len + mNoise*(tmpN.nx[index-1]-len);   
201
    len = ((float)index+1)/(NUM_NOISE+1); 
202
    upper = len + mNoise*(tmpN.nx[index  ]-len);
203
            
204
    return (upper-lower)*(d-index) + lower; 
205
    }
206
   
207 149
///////////////////////////////////////////////////////////////////////////////////////////////////
208 150
// PUBLIC API
209 151
///////////////////////////////////////////////////////////////////////////////////////////////////
......
212 154
 */
213 155
  public Dynamic1D()
214 156
    {
215
    vv = new Vector<>();
216
    vc = new Vector<>();
217
    vn = null;
218
    numPoints = 0;
219
    cacheDirty = false;
220
    mMode = MODE_LOOP;
221
    mDuration = 0;
222
    mCount = 0.5f;
157
    this(0,0.5f);
223 158
    }
224 159

  
225 160
///////////////////////////////////////////////////////////////////////////////////////////////////
......
242 177
    mMode = MODE_LOOP;
243 178
    mDuration = duration;
244 179
    mCount = count;
180
    mDimension = 1;
245 181
    }
246 182

  
247 183
///////////////////////////////////////////////////////////////////////////////////////////////////
......
295 231
      {
296 232
      vv.add(v);
297 233
     
298
      if( vn!=null ) vn.add(new VectorNoise());
234
      if( vn!=null ) vn.add(new VectorNoise(1));
299 235
       
300 236
      switch(numPoints)
301 237
        {
......
327 263
      {
328 264
      vv.add(location, v);
329 265
      
330
      if( vn!=null ) vn.add(new VectorNoise());
266
      if( vn!=null ) vn.add(new VectorNoise(1));
331 267
             
332 268
      switch(numPoints)
333 269
        {
src/main/java/org/distorted/library/type/Dynamic2D.java
44 44
    float x,y;
45 45
    float vx,vy;
46 46
    }
47
  
48
  private class VectorNoise
49
    {    
50
    float[] nx;
51
    float[] ny;
52
   
53
    VectorNoise()
54
      {
55
      nx = new float[NUM_NOISE]; 
56
      nx[0] = mRnd.nextFloat();
57
      for(int i=1; i<NUM_NOISE; i++) nx[i] = nx[i-1]+mRnd.nextFloat();
58
      float sum = nx[NUM_NOISE-1] + mRnd.nextFloat();
59
      for(int i=0; i<NUM_NOISE; i++) nx[i] /=sum;
60
     
61
      ny = new float[NUM_NOISE];
62
      for(int i=0; i<NUM_NOISE; i++) ny[i] = mRnd.nextFloat()-0.5f;
63
      }
64
    }
65
    
47

  
66 48
  private Vector<VectorCache> vc;
67 49
  private VectorCache tmp1, tmp2;
68 50
   
69 51
  private Vector<Static2D> vv;
70 52
  private Static2D prev, curr, next;
71
 
72
  private Vector<VectorNoise> vn;
73
  private VectorNoise tmpN;
74
  
75
  private float mFactor;
76
 
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78 53

  
79
  synchronized void createNoise()
80
    {
81
    if( vn==null )
82
      {
83
      vn = new Vector<>();
84
      for(int i=0; i<numPoints; i++) vn.add(new VectorNoise());
85
      }
86
    }
87
 
88 54
///////////////////////////////////////////////////////////////////////////////////////////////////
89 55
// no array bounds checking!
90 56
  
......
196 162
    
197 163
    cacheDirty = false;
198 164
    }
199
 
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201 165

  
202
  private float noise(float time,int vecNum)
203
    {
204
    float lower, upper, len;  
205
    float d = time*(NUM_NOISE+1);
206
    int index = (int)d;
207
    if( index>=NUM_NOISE+1 ) index=NUM_NOISE;
208
    tmpN = vn.elementAt(vecNum);
209
   
210
    float x = d-index;
211
    x = x*x*(3-2*x);
212
   
213
    switch(index)
214
      {
215
      case 0        : mFactor = mNoise*tmpN.ny[0]*x;  
216
                      return time + mNoise*(d*tmpN.nx[0]-time);                
217
      case NUM_NOISE: mFactor= mNoise*tmpN.ny[NUM_NOISE-1]*(1-x);
218
                      len = ((float)NUM_NOISE)/(NUM_NOISE+1);
219
                      lower = len + mNoise*(tmpN.nx[NUM_NOISE-1]-len);  
220
                      return (1.0f-lower)*(d-NUM_NOISE) + lower;
221
      default       : float yb = tmpN.ny[index  ];
222
                      float ya = tmpN.ny[index-1];
223
                      mFactor  = mNoise*((yb-ya)*x+ya);
224
   
225
                      len = ((float)index)/(NUM_NOISE+1);
226
                      lower = len + mNoise*(tmpN.nx[index-1]-len);   
227
                      len = ((float)index+1)/(NUM_NOISE+1); 
228
                      upper = len + mNoise*(tmpN.nx[index  ]-len);
229
            
230
                      return (upper-lower)*(d-index) + lower; 
231
      }
232
    }
233
  
234 166
///////////////////////////////////////////////////////////////////////////////////////////////////
235 167
// PUBLIC API 
236 168
///////////////////////////////////////////////////////////////////////////////////////////////////
......
239 171
 */
240 172
  public Dynamic2D()
241 173
    {
242
    vv = new Vector<>();
243
    vc = new Vector<>();
244
    vn = null;
245
    numPoints = 0;
246
    cacheDirty = false;
247
    mMode = MODE_LOOP;
248
    mDuration = 0;
249
    mCount = 0.5f;
250
    mNoise = 0.0f;
174
    this(0,0.5f);
251 175
    }
252 176

  
253 177
///////////////////////////////////////////////////////////////////////////////////////////////////
......
270 194
    mMode = MODE_LOOP;
271 195
    mDuration = duration;
272 196
    mCount = count;
197
    mDimension = 2;
273 198
    }
274 199

  
275 200
///////////////////////////////////////////////////////////////////////////////////////////////////
......
323 248
      {
324 249
      vv.add(v);
325 250
     
326
      if( vn!=null ) vn.add(new VectorNoise());
251
      if( vn!=null ) vn.add(new VectorNoise(2));
327 252
       
328 253
      switch(numPoints)
329 254
        {
......
354 279
      {
355 280
      vv.add(location, v);
356 281
      
357
      if( vn!=null ) vn.add(new VectorNoise());
282
      if( vn!=null ) vn.add(new VectorNoise(2));
358 283
      
359 284
      switch(numPoints)
360 285
        {
......
495 420
                float dx2 = next.x-curr.x;
496 421
                float dy2 = next.y-curr.y;
497 422
   
498
                buffer[offset  ] = dx2*time + curr.x +dy2*mFactor;
499
                buffer[offset+1] = dy2*time + curr.y -dx2*mFactor;
423
                buffer[offset  ] = dx2*time + curr.x +dy2*mFactor[0];
424
                buffer[offset+1] = dy2*time + curr.y -dx2*mFactor[0];
500 425
                }
501 426
              else
502 427
                {
......
554 479
                  float dx2 = (3*tmp1.ax*time+2*tmp1.bx)*time + tmp1.cx;
555 480
                  float dy2 = (3*tmp1.ay*time+2*tmp1.by)*time + tmp1.cy;
556 481
                 
557
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx +dy2*mFactor;
558
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy -dx2*mFactor;
482
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx +dy2*mFactor[0];
483
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy -dx2*mFactor[0];
559 484
                  } 
560 485
                else
561 486
                  {
src/main/java/org/distorted/library/type/Dynamic3D.java
45 45
    float x,y,z;
46 46
    float vx,vy,vz;
47 47
    }
48
  
49
  private class VectorNoise
50
    {
51
    float[] nx;
52
    float[] ny;
53
    float[] nz;
54
   
55
    VectorNoise()
56
      {
57
      nx = new float[NUM_NOISE]; 
58
      nx[0] = mRnd.nextFloat();
59
      for(int i=1; i<NUM_NOISE; i++) nx[i] = nx[i-1]+mRnd.nextFloat();
60
      float sum = nx[NUM_NOISE-1] + mRnd.nextFloat();
61
      for(int i=0; i<NUM_NOISE; i++) nx[i] /=sum;
62
     
63
      ny = new float[NUM_NOISE];
64
      for(int i=0; i<NUM_NOISE; i++) ny[i] = mRnd.nextFloat()-0.5f;
65
     
66
      nz = new float[NUM_NOISE];
67
      for(int i=0; i<NUM_NOISE; i++) nz[i] = mRnd.nextFloat()-0.5f;  
68
      }
69
    }
70
  
48

  
71 49
  private Vector<VectorCache> vc;
72 50
  private VectorCache tmp1, tmp2;
73 51

  
74 52
  private Vector<Static3D> vv;
75 53
  private Static3D prev, curr, next;
76
  
77
  private Vector<VectorNoise> vn;
78
  private VectorNoise tmpN;
79
  
80
  private float mFactor1, mFactor2;  // used in Noise only. Those are noise factors; 1=noise of the (vec1X,vec1Y,vec1Z) vector; 2=noise of (vec2X,vec2Y,vec2Z)
54

  
81 55
  private float vec1X,vec1Y,vec1Z;   // 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)
82 56
  private float vec2X,vec2Y,vec2Z;   // vector perpendicular to v(t0 and to vec1.
83
  
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85 57

  
86
  synchronized void createNoise()
87
    {
88
    if( vn==null )
89
      {  
90
      vn = new Vector<>();
91
      for(int i=0; i<numPoints; i++) vn.add(new VectorNoise());
92
      }
93
    }
94
   
95 58
///////////////////////////////////////////////////////////////////////////////////////////////////
96 59
// no array bounds checking!
97 60
  
......
219 182
   
220 183
    cacheDirty = false;
221 184
    }
222
  
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224 185

  
225
  private float noise(float time,int vecNum)
226
    {
227
    float lower, upper, len;  
228
    float d = time*(NUM_NOISE+1);
229
    int index = (int)d;
230
    if( index>=NUM_NOISE+1 ) index=NUM_NOISE;
231
    tmpN = vn.elementAt(vecNum);
232
   
233
    float t = d-index;
234
    t = t*t*(3-2*t);
235
   
236
    switch(index)
237
      {
238
      case 0        : mFactor1 = mNoise*tmpN.ny[0]*t;
239
                      mFactor2 = mNoise*tmpN.nz[0]*t;
240
                      return time + mNoise*(d*tmpN.nx[0]-time);
241
      case NUM_NOISE: mFactor1= mNoise*tmpN.ny[NUM_NOISE-1]*(1-t);
242
                      mFactor2= mNoise*tmpN.nz[NUM_NOISE-1]*(1-t);
243
                      len = ((float)NUM_NOISE)/(NUM_NOISE+1);
244
                      lower = len + mNoise*(tmpN.nx[NUM_NOISE-1]-len);  
245
                      return (1.0f-lower)*(d-NUM_NOISE) + lower;
246
      default       : float ya,yb;
247
                      yb = tmpN.ny[index  ];
248
                      ya = tmpN.ny[index-1];
249
                      mFactor1 = mNoise*((yb-ya)*t+ya);
250
                      yb = tmpN.nz[index  ];
251
                      ya = tmpN.nz[index-1];
252
                      mFactor2 = mNoise*((yb-ya)*t+ya);
253
   
254
                      len = ((float)index)/(NUM_NOISE+1);
255
                      lower = len + mNoise*(tmpN.nx[index-1]-len);   
256
                      len = ((float)index+1)/(NUM_NOISE+1); 
257
                      upper = len + mNoise*(tmpN.nx[index  ]-len);
258
            
259
                      return (upper-lower)*(d-index) + lower; 
260
      }
261
    }
262
     
263 186
///////////////////////////////////////////////////////////////////////////////////////////////////
264 187
// v is the speed vector (i.e. position p(t) differentiated by time)
265 188
// a is the acceleration vector (differentiate once more)
......
350 273
 */
351 274
  public Dynamic3D()
352 275
    {
353
    vv = new Vector<>();
354
    vc = new Vector<>();
355
    vn = null;
356
    numPoints = 0;
357
    cacheDirty = false;
358
    mMode = MODE_LOOP;
359
    mDuration = 0;
360
    mCount = 0.5f;
361
    mNoise = 0.0f;
276
    this(0,0.5f);
362 277
    }
363 278

  
364 279
///////////////////////////////////////////////////////////////////////////////////////////////////
......
381 296
    mMode = MODE_LOOP;
382 297
    mDuration = duration;
383 298
    mCount = count;
299
    mDimension = 3;
384 300
    }
385 301

  
386 302
///////////////////////////////////////////////////////////////////////////////////////////////////
......
434 350
      {
435 351
      vv.add(v);
436 352
        
437
      if( vn!=null ) vn.add(new VectorNoise());
353
      if( vn!=null ) vn.add(new VectorNoise(3));
438 354
       
439 355
      switch(numPoints)
440 356
        {
......
466 382
      {
467 383
      vv.add(location, v);
468 384
      
469
      if( vn!=null ) vn.add(new VectorNoise());
385
      if( vn!=null ) vn.add(new VectorNoise(3));
470 386
      
471 387
      switch(numPoints)
472 388
        {
......
609 525
                {
610 526
                time = noise(time,0);
611 527
            
612
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (vec1X*mFactor1 + vec2X*mFactor2);
613
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (vec1Y*mFactor1 + vec2Y*mFactor2);
614
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (vec1Z*mFactor1 + vec2Z*mFactor2); 
528
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (vec1X*mFactor[0] + vec2X*mFactor[1]);
529
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (vec1Y*mFactor[0] + vec2Y*mFactor[1]);
530
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (vec1Z*mFactor[0] + vec2Z*mFactor[1]);
615 531
                }
616 532
              else
617 533
                {
......
670 586
              
671 587
                  setUpVectors(time,tmp1);
672 588
                 
673
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx + (vec1X*mFactor1 + vec2X*mFactor2);
674
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy + (vec1Y*mFactor1 + vec2Y*mFactor2);
675
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz + (vec1Z*mFactor1 + vec2Z*mFactor2);
589
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx + (vec1X*mFactor[0] + vec2X*mFactor[1]);
590
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy + (vec1Y*mFactor[0] + vec2Y*mFactor[1]);
591
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz + (vec1Z*mFactor[0] + vec2Z*mFactor[1]);
676 592
                  }
677 593
                else
678 594
                  {
src/main/java/org/distorted/library/type/Dynamic4D.java
46 46
    float x,y,z,w;
47 47
    float vx,vy,vz,vw;
48 48
    }
49
  
50
  private class VectorNoise
51
    {
52
    float[] nx;
53
    float[] ny;
54
    float[] nz;
55
    float[] nw;
56
   
57
    VectorNoise()
58
      {
59
      nx = new float[NUM_NOISE]; 
60
      nx[0] = mRnd.nextFloat();
61
      for(int i=1; i<NUM_NOISE; i++) nx[i] = nx[i-1] + mRnd.nextFloat();
62
      float sum = nx[NUM_NOISE-1] + mRnd.nextFloat();
63
      for(int i=0; i<NUM_NOISE; i++) nx[i] /=sum;
64
     
65
      ny = new float[NUM_NOISE];
66
      for(int i=0; i<NUM_NOISE; i++) ny[i] = mRnd.nextFloat()-0.5f;
67
     
68
      nz = new float[NUM_NOISE];
69
      for(int i=0; i<NUM_NOISE; i++) nz[i] = mRnd.nextFloat()-0.5f;
70
     
71
      nw = new float[NUM_NOISE];
72
      for(int i=0; i<NUM_NOISE; i++) nw[i] = mRnd.nextFloat()-0.5f;  
73
      }
74
    }
75
  
49

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

  
79 53
  private Vector<Static4D> vv;
80 54
  private Static4D prev, curr, next;
81
  
82
  private Vector<VectorNoise> vn;
83
  private VectorNoise tmpN;
84
  
85
  private float mFactor1, mFactor2, mFactor3; // used in Noise only. FactorN = noise factor of vecN.
55

  
86 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)
87 57
  private float vec2X,vec2Y,vec2Z,vec2W;      // vector perpendicular to v(t) and to vec1.
88 58
  private float vec3X,vec3Y,vec3Z,vec3W;      // vector perpendicular to v(t) and to vec1.
89
  
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91 59

  
92
  synchronized void createNoise()
93
    {
94
    if( vn==null )
95
      {  
96
      vn = new Vector<>();
97
      for(int i=0; i<numPoints; i++) vn.add(new VectorNoise());
98
      }
99
    }
100
   
101 60
///////////////////////////////////////////////////////////////////////////////////////////////////
102 61
// no array bounds checking!
103 62
  
......
241 200
   
242 201
    cacheDirty = false;
243 202
    }
244
  
245
///////////////////////////////////////////////////////////////////////////////////////////////////
246 203

  
247
  private float noise(float time,int vecNum)
248
    {
249
    float lower, upper, len;  
250
    float d = time*(NUM_NOISE+1);
251
    int index = (int)d;
252
    if( index>=NUM_NOISE+1 ) index=NUM_NOISE;
253
    tmpN = vn.elementAt(vecNum);
254
   
255
    float t = d-index;
256
    t = t*t*(3-2*t);
257
   
258
    switch(index)
259
      {
260
      case 0        : mFactor1 = mNoise*tmpN.ny[0]*t;
261
                      mFactor2 = mNoise*tmpN.nz[0]*t;
262
                      mFactor3 = mNoise*tmpN.nw[0]*t;
263
                      return time + mNoise*(d*tmpN.nx[0]-time);
264
      case NUM_NOISE: mFactor1= mNoise*tmpN.ny[NUM_NOISE-1]*(1-t);
265
                      mFactor2= mNoise*tmpN.nz[NUM_NOISE-1]*(1-t);
266
                      mFactor3= mNoise*tmpN.nw[NUM_NOISE-1]*(1-t);
267
                      len = ((float)NUM_NOISE)/(NUM_NOISE+1);
268
                      lower = len + mNoise*(tmpN.nx[NUM_NOISE-1]-len);  
269
                      return (1.0f-lower)*(d-NUM_NOISE) + lower;
270
      default       : float ya,yb;
271
                      yb = tmpN.ny[index  ];
272
                      ya = tmpN.ny[index-1];
273
                      mFactor1 = mNoise*((yb-ya)*t+ya);
274
                      yb = tmpN.nz[index  ];
275
                      ya = tmpN.nz[index-1];
276
                      mFactor2 = mNoise*((yb-ya)*t+ya);
277
                      yb = tmpN.nw[index  ];
278
                      ya = tmpN.nw[index-1];
279
                      mFactor3 = mNoise*((yb-ya)*t+ya);
280
   
281
                      len = ((float)index)/(NUM_NOISE+1);
282
                      lower = len + mNoise*(tmpN.nx[index-1]-len);   
283
                      len = ((float)index+1)/(NUM_NOISE+1); 
284
                      upper = len + mNoise*(tmpN.nx[index  ]-len);
285
            
286
                      return (upper-lower)*(d-index) + lower; 
287
      }
288
    }
289
     
290 204
///////////////////////////////////////////////////////////////////////////////////////////////////
291 205
// v is the speed vector (i.e. position p(t) differentiated by time)
292 206
// a is the acceleration vector (differentiate once more)
......
446 360
 */
447 361
  public Dynamic4D()
448 362
    {
449
    vv = new Vector<>();
450
    vc = new Vector<>();
451
    vn = null;
452
    numPoints = 0;
453
    cacheDirty = false;
454
    mMode = MODE_LOOP;
455
    mDuration = 0;
456
    mCount = 0.5f;
457
    mNoise = 0.0f;
363
    this(0,0.5f);
458 364
    }
459 365

  
460 366
///////////////////////////////////////////////////////////////////////////////////////////////////
......
477 383
    mMode = MODE_LOOP;
478 384
    mDuration = duration;
479 385
    mCount = count;
386
    mDimension = 4;
480 387
    }
481 388

  
482 389
///////////////////////////////////////////////////////////////////////////////////////////////////
......
530 437
      {
531 438
      vv.add(v);
532 439
        
533
      if( vn!=null ) vn.add(new VectorNoise());
440
      if( vn!=null ) vn.add(new VectorNoise(4));
534 441
       
535 442
       switch(numPoints)
536 443
         {
......
562 469
      {
563 470
      vv.add(location, v);
564 471
      
565
      if( vn!=null ) vn.add(new VectorNoise());
472
      if( vn!=null ) vn.add(new VectorNoise(4));
566 473
      
567 474
      switch(numPoints)
568 475
        {
......
707 614
                {
708 615
                time = noise(time,0);
709 616
            
710
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (vec1X*mFactor1 + vec2X*mFactor2 + vec3X*mFactor3);
711
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (vec1Y*mFactor1 + vec2Y*mFactor2 + vec3Y*mFactor3);
712
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (vec1Z*mFactor1 + vec2Z*mFactor2 + vec3Z*mFactor3);
713
                buffer[offset+3] = (next.w-curr.w)*time + curr.w + (vec1W*mFactor1 + vec2W*mFactor2 + vec3W*mFactor3); 
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]);
714 621
                }
715 622
              else
716 623
                {
......
770 677
              
771 678
                  setUpVectors(time,tmp1);
772 679
                 
773
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx + (vec1X*mFactor1 + vec2X*mFactor2 + vec3X*mFactor3);
774
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy + (vec1Y*mFactor1 + vec2Y*mFactor2 + vec3Y*mFactor3);
775
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz + (vec1Z*mFactor1 + vec2Z*mFactor2 + vec3Z*mFactor3);
776
                  buffer[offset+3]= ((tmp1.aw*time+tmp1.bw)*time+tmp1.cw)*time+tmp1.dw + (vec1W*mFactor1 + vec2W*mFactor2 + vec3W*mFactor3);
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]);
777 684
                  }
778 685
                else
779 686
                  {
src/main/java/org/distorted/library/type/Dynamic5D.java
47 47
    float x,y,z,w,v;
48 48
    float vx,vy,vz,vw,vv;
49 49
    }
50
  
51
  private class VectorNoise
52
    {
53
    float[] nx;
54
    float[] ny;
55
    float[] nz;
56
    float[] nw;
57
    float[] nv;
58
   
59
    VectorNoise()
60
      {
61
      nx = new float[NUM_NOISE]; 
62
      nx[0] = mRnd.nextFloat();
63
      for(int i=1; i<NUM_NOISE; i++) nx[i] = nx[i-1] + mRnd.nextFloat();
64
      float sum = nx[NUM_NOISE-1] + mRnd.nextFloat();
65
      for(int i=0; i<NUM_NOISE; i++) nx[i] /=sum;
66
     
67
      ny = new float[NUM_NOISE];
68
      for(int i=0; i<NUM_NOISE; i++) ny[i] = mRnd.nextFloat()-0.5f;
69
     
70
      nz = new float[NUM_NOISE];
71
      for(int i=0; i<NUM_NOISE; i++) nz[i] = mRnd.nextFloat()-0.5f;
72
     
73
      nw = new float[NUM_NOISE];
74
      for(int i=0; i<NUM_NOISE; i++) nw[i] = mRnd.nextFloat()-0.5f;  
75 50

  
76
      nv = new float[NUM_NOISE];
77
      for(int i=0; i<NUM_NOISE; i++) nv[i] = mRnd.nextFloat()-0.5f;  
78
      }
79
    }
80
  
81 51
  private Vector<VectorCache> vc;
82 52
  private VectorCache tmp1, tmp2;
83 53

  
84 54
  private Vector<Static5D> vv;
85 55
  private Static5D prev, curr, next;
86
  
87
  private Vector<VectorNoise> vn;
88
  private VectorNoise tmpN;
89
  
90
  private float mFactor1, mFactor2, mFactor3, mFactor4;  // used in Noise only. FactorN = noise factor of vector vecN.
56

  
91 57
  private float vec1X,vec1Y,vec1Z,vec1W,vec1V; //
92
  private float vec2X,vec2Y,vec2Z,vec2W,vec2V; // 4 noise vectors.
58
  private float vec2X,vec2Y,vec2Z,vec2W,vec2V; // 4 base noise vectors.
93 59
  private float vec3X,vec3Y,vec3Z,vec3W,vec3V; // 
94 60
  private float vec4X,vec4Y,vec4Z,vec4W,vec4V; // 
95
  
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97 61

  
98
  synchronized void createNoise()
99
    {
100
    if( vn==null )
101
      {  
102
      vn = new Vector<>();
103
      for(int i=0; i<numPoints; i++) vn.add(new VectorNoise());
104
      }
105
    }
106
   
107 62
///////////////////////////////////////////////////////////////////////////////////////////////////
108 63
// no array bounds checking!
109 64
  
......
263 218
   
264 219
    cacheDirty = false;
265 220
    }
266
  
267
///////////////////////////////////////////////////////////////////////////////////////////////////
268 221

  
269
  private float noise(float time,int vecNum)
270
    {
271
    float lower, upper, len;  
272
    float d = time*(NUM_NOISE+1);
273
    int index = (int)d;
274
    if( index>=NUM_NOISE+1 ) index=NUM_NOISE;
275
    tmpN = vn.elementAt(vecNum);
276
   
277
    float t = d-index;
278
    t = t*t*(3-2*t);
279
   
280
    switch(index)
281
      {
282
      case 0        : mFactor1 = mNoise*tmpN.ny[0]*t;
283
                      mFactor2 = mNoise*tmpN.nz[0]*t;
284
                      mFactor3 = mNoise*tmpN.nw[0]*t;
285
                      mFactor4 = mNoise*tmpN.nv[0]*t;
286
                      return time + mNoise*(d*tmpN.nx[0]-time);
287
      case NUM_NOISE: mFactor1= mNoise*tmpN.ny[NUM_NOISE-1]*(1-t);
288
                      mFactor2= mNoise*tmpN.nz[NUM_NOISE-1]*(1-t);
289
                      mFactor3= mNoise*tmpN.nw[NUM_NOISE-1]*(1-t);
290
                      mFactor4= mNoise*tmpN.nv[NUM_NOISE-1]*(1-t);
291
                      len = ((float)NUM_NOISE)/(NUM_NOISE+1);
292
                      lower = len + mNoise*(tmpN.nx[NUM_NOISE-1]-len);  
293
                      return (1.0f-lower)*(d-NUM_NOISE) + lower;
294
      default       : float ya,yb;
295
                      yb = tmpN.ny[index  ];
296
                      ya = tmpN.ny[index-1];
297
                      mFactor1 = mNoise*((yb-ya)*t+ya);
298
                      yb = tmpN.nz[index  ];
299
                      ya = tmpN.nz[index-1];
300
                      mFactor2 = mNoise*((yb-ya)*t+ya);
301
                      yb = tmpN.nw[index  ];
302
                      ya = tmpN.nw[index-1];
303
                      mFactor3 = mNoise*((yb-ya)*t+ya);
304
                      yb = tmpN.nv[index  ];
305
                      ya = tmpN.nv[index-1];
306
                      mFactor4 = mNoise*((yb-ya)*t+ya);
307
   
308
                      len = ((float)index)/(NUM_NOISE+1);
309
                      lower = len + mNoise*(tmpN.nx[index-1]-len);   
310
                      len = ((float)index+1)/(NUM_NOISE+1); 
311
                      upper = len + mNoise*(tmpN.nx[index  ]-len);
312
            
313
                      return (upper-lower)*(d-index) + lower; 
314
      }
315
    }
316
     
317 222
///////////////////////////////////////////////////////////////////////////////////////////////////
318 223
// v is the speed vector (i.e. position p(t) differentiated by time)
319 224
// a is the acceleration vector (differentiate once more)
......
450 355
        vec2Z = 1.0f - coeff21*vz - coeff22*vec1Z;
451 356
        vec2W = 0.0f - coeff21*vw - coeff22*vec1W;
452 357
        vec2V = 0.0f - coeff21*vv - coeff22*vec1V;
453
     
358

  
454 359
        float vec2_sq = vec2X*vec2X+vec2Y*vec2Y+vec2Z*vec2Z+vec2W*vec2W+vec2V*vec2V;
455 360
        float coeff31 = vw/v_sq;
456 361
        float coeff32 = vec1W/vec1_sq;
......
478 383
        float len2 = (float)Math.sqrt(v_sq/vec2_sq);    
479 384
        float len3 = (float)Math.sqrt(v_sq/vec3_sq);
480 385
        float len4 = (float)Math.sqrt(v_sq/vec4_sq);
481
     
386

  
482 387
        vec1X*=len1;
483 388
        vec1Y*=len1;
484 389
        vec1Z*=len1;
......
540 445
 */
541 446
  public Dynamic5D()
542 447
    {
543
    vv = new Vector<>();
544
    vc = new Vector<>();
545
    vn = null;
546
    numPoints = 0;
547
    cacheDirty = false;
548
    mMode = MODE_LOOP;
549
    mDuration = 0;
550
    mCount = 0.5f;
551
    mNoise = 0.0f;
448
    this(0,0.5f);
552 449
    }
553 450

  
554 451
///////////////////////////////////////////////////////////////////////////////////////////////////
......
571 468
    mMode = MODE_LOOP;
572 469
    mDuration = duration;
573 470
    mCount = count;
471
    mDimension = 5;
574 472
    }
575 473

  
576 474
///////////////////////////////////////////////////////////////////////////////////////////////////
......
624 522
      {
625 523
      vv.add(v);
626 524
        
627
      if( vn!=null ) vn.add(new VectorNoise());
525
      if( vn!=null ) vn.add(new VectorNoise(5));
628 526
       
629
       switch(numPoints)
630
         {
631
         case 0: break;
632
         case 1: setUpVectors(0.0f,null);
633
                 break;
634
         case 2: vc.add(new VectorCache());
635
                 vc.add(new VectorCache());
636
                 vc.add(new VectorCache());
637
                 break;
638
         default:vc.add(new VectorCache());
639
         }
527
      switch(numPoints)
528
        {
529
        case 0: break;
530
        case 1: setUpVectors(0.0f,null);
531
                break;
532
        case 2: vc.add(new VectorCache());
533
                vc.add(new VectorCache());
534
                vc.add(new VectorCache());
535
                break;
536
        default:vc.add(new VectorCache());
537
        }
640 538

  
641
       numPoints++;
642
       cacheDirty = true;
643
       }
539
      numPoints++;
540
      cacheDirty = true;
541
      }
644 542
    }
645 543

  
646 544
///////////////////////////////////////////////////////////////////////////////////////////////////
......
656 554
      {
657 555
      vv.add(location, v);
658 556
      
659
      if( vn!=null ) vn.add(new VectorNoise());
557
      if( vn!=null ) vn.add(new VectorNoise(5));
660 558
      
661 559
      switch(numPoints)
662 560
        {
......
803 701
                {
804 702
                time = noise(time,0);
805 703
            
806
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (vec1X*mFactor1 + vec2X*mFactor2 + vec3X*mFactor3 + vec4X*mFactor4);
807
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (vec1Y*mFactor1 + vec2Y*mFactor2 + vec3Y*mFactor3 + vec4Y*mFactor4);
808
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (vec1Z*mFactor1 + vec2Z*mFactor2 + vec3Z*mFactor3 + vec4Z*mFactor4);
809
                buffer[offset+3] = (next.w-curr.w)*time + curr.w + (vec1W*mFactor1 + vec2W*mFactor2 + vec3W*mFactor3 + vec4W*mFactor4); 
810
                buffer[offset+4] = (next.v-curr.v)*time + curr.v + (vec1V*mFactor1 + vec2V*mFactor2 + vec3V*mFactor3 + vec4V*mFactor4); 
704
                buffer[offset  ] = (next.x-curr.x)*time + curr.x + (vec1X*mFactor[0] + vec2X*mFactor[1] + vec3X*mFactor[2] + vec4X*mFactor[3]);
705
                buffer[offset+1] = (next.y-curr.y)*time + curr.y + (vec1Y*mFactor[0] + vec2Y*mFactor[1] + vec3Y*mFactor[2] + vec4Y*mFactor[3]);
706
                buffer[offset+2] = (next.z-curr.z)*time + curr.z + (vec1Z*mFactor[0] + vec2Z*mFactor[1] + vec3Z*mFactor[2] + vec4Z*mFactor[3]);
707
                buffer[offset+3] = (next.w-curr.w)*time + curr.w + (vec1W*mFactor[0] + vec2W*mFactor[1] + vec3W*mFactor[2] + vec4W*mFactor[3]);
708
                buffer[offset+4] = (next.v-curr.v)*time + curr.v + (vec1V*mFactor[0] + vec2V*mFactor[1] + vec3V*mFactor[2] + vec4V*mFactor[3]);
811 709
                }
812 710
              else
813 711
                {
......
868 766
              
869 767
                  setUpVectors(time,tmp1);
870 768
                 
871
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx + (vec1X*mFactor1 + vec2X*mFactor2 + vec3X*mFactor3 + vec4X*mFactor4);
872
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy + (vec1Y*mFactor1 + vec2Y*mFactor2 + vec3Y*mFactor3 + vec4Y*mFactor4);
873
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz + (vec1Z*mFactor1 + vec2Z*mFactor2 + vec3Z*mFactor3 + vec4Z*mFactor4);
874
                  buffer[offset+3]= ((tmp1.aw*time+tmp1.bw)*time+tmp1.cw)*time+tmp1.dw + (vec1W*mFactor1 + vec2W*mFactor2 + vec3W*mFactor3 + vec4W*mFactor4);
875
                  buffer[offset+4]= ((tmp1.av*time+tmp1.bv)*time+tmp1.cv)*time+tmp1.dv + (vec1V*mFactor1 + vec2V*mFactor2 + vec3V*mFactor3 + vec4V*mFactor4);
769
                  buffer[offset  ]= ((tmp1.ax*time+tmp1.bx)*time+tmp1.cx)*time+tmp1.dx + (vec1X*mFactor[0] + vec2X*mFactor[1] + vec3X*mFactor[2] + vec4X*mFactor[3]);
770
                  buffer[offset+1]= ((tmp1.ay*time+tmp1.by)*time+tmp1.cy)*time+tmp1.dy + (vec1Y*mFactor[0] + vec2Y*mFactor[1] + vec3Y*mFactor[2] + vec4Y*mFactor[3]);
771
                  buffer[offset+2]= ((tmp1.az*time+tmp1.bz)*time+tmp1.cz)*time+tmp1.dz + (vec1Z*mFactor[0] + vec2Z*mFactor[1] + vec3Z*mFactor[2] + vec4Z*mFactor[3]);
772
                  buffer[offset+3]= ((tmp1.aw*time+tmp1.bw)*time+tmp1.cw)*time+tmp1.dw + (vec1W*mFactor[0] + vec2W*mFactor[1] + vec3W*mFactor[2] + vec4W*mFactor[3]);
773
                  buffer[offset+4]= ((tmp1.av*time+tmp1.bv)*time+tmp1.cv)*time+tmp1.dv + (vec1V*mFactor[0] + vec2V*mFactor[1] + vec3V*mFactor[2] + vec4V*mFactor[3]);
876 774
                  }
877 775
                else
878 776
                  {
src/main/java/org/distorted/library/type/DynamicQuat.java
61 61
    return (float)Math.sqrt(1-x)*(1.5707288f - 0.2121144f*x + 0.074261f*x*x - 0.0187293f*x*x*x);
62 62
    }
63 63

  
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65
// Quaternion Dynamic doesn't support noise
66
  
67
  synchronized void createNoise()
68
    {
69

  
70
    }
71
  
72 64
///////////////////////////////////////////////////////////////////////////////////////////////////
73 65
  
74 66
  private void recomputeCache()
......
118 110
 */
119 111
  public DynamicQuat()
120 112
    {
121
    vv = new Vector<>();
122
    vc = new Vector<>();
123
    numPoints = 0;
124
    cacheDirty = false;
125
    mMode = MODE_LOOP;
126
    mDuration = 0;
127
    mCount = 0.5f;
128
    mNoise = 0.0f;
113
    this(0,0.5f);
129 114
    }
130 115

  
131 116
///////////////////////////////////////////////////////////////////////////////////////////////////
......
148 133
    mDuration = duration;
149 134
    mCount = count;
150 135
    mNoise = 0.0f;
136
    mDimension = 4;
151 137
    }
152 138

  
153 139
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff