Revision bdb341bc
Added by Leszek Koltunski about 8 years ago
src/main/java/org/distorted/library/EffectQueueFragment.java | ||
---|---|---|
89 | 89 |
|
90 | 90 |
if( mInter[1][i]!=null ) |
91 | 91 |
{ |
92 |
mInter[1][i].interpolateMain( mUniforms, NUM_UNIFORMS*i+4, mCurrentDuration[i]); |
|
92 |
mInter[1][i].interpolateMain( mUniforms, NUM_UNIFORMS*i+4, mCurrentDuration[i], step);
|
|
93 | 93 |
|
94 | 94 |
mUniforms[NUM_UNIFORMS*i+4] = mUniforms[NUM_UNIFORMS*i+4]-mObjHalfX; |
95 | 95 |
mUniforms[NUM_UNIFORMS*i+5] =-mUniforms[NUM_UNIFORMS*i+5]+mObjHalfY; |
96 | 96 |
} |
97 | 97 |
|
98 |
if( mInter[2][i]!=null ) mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+1, mCurrentDuration[i]); |
|
98 |
if( mInter[2][i]!=null ) mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+1, mCurrentDuration[i], step);
|
|
99 | 99 |
|
100 | 100 |
mCurrentDuration[i] += step; |
101 | 101 |
} |
... | ... | |
151 | 151 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
152 | 152 |
|
153 | 153 |
if( data instanceof Dynamic1D) |
154 |
{ |
|
154 | 155 |
mInter[0][mNumEffects] = (Dynamic1D)data; |
156 |
} |
|
155 | 157 |
else if( data instanceof Static1D ) |
156 | 158 |
{ |
157 | 159 |
mInter[0][mNumEffects] = null; |
... | ... | |
181 | 183 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
182 | 184 |
|
183 | 185 |
if( data instanceof Dynamic1D) |
186 |
{ |
|
184 | 187 |
mInter[0][mNumEffects] = (Dynamic1D)data; |
188 |
} |
|
185 | 189 |
else if( data instanceof Static1D ) |
186 | 190 |
{ |
187 | 191 |
mInter[0][mNumEffects] = null; |
... | ... | |
190 | 194 |
else return -1; |
191 | 195 |
|
192 | 196 |
if( region instanceof Dynamic4D) |
197 |
{ |
|
193 | 198 |
mInter[1][mNumEffects] = (Dynamic4D)region; |
199 |
} |
|
194 | 200 |
else if( region instanceof Static4D ) |
195 | 201 |
{ |
196 | 202 |
mInter[1][mNumEffects] = null; |
... | ... | |
219 | 225 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
220 | 226 |
|
221 | 227 |
if( level instanceof Dynamic1D) |
228 |
{ |
|
222 | 229 |
mInter[0][mNumEffects] = (Dynamic1D)level; |
230 |
} |
|
223 | 231 |
else if( level instanceof Static1D ) |
224 | 232 |
{ |
225 | 233 |
mInter[0][mNumEffects] = null; |
... | ... | |
241 | 249 |
else return -1; |
242 | 250 |
|
243 | 251 |
if( region instanceof Dynamic4D) |
252 |
{ |
|
244 | 253 |
mInter[1][mNumEffects] = (Dynamic4D)region; |
254 |
} |
|
245 | 255 |
else if( region instanceof Static4D ) |
246 | 256 |
{ |
247 | 257 |
mInter[1][mNumEffects] = null; |
... | ... | |
268 | 278 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
269 | 279 |
|
270 | 280 |
if( level instanceof Dynamic1D) |
281 |
{ |
|
271 | 282 |
mInter[0][mNumEffects] = (Dynamic1D)level; |
283 |
} |
|
272 | 284 |
else if( level instanceof Static1D ) |
273 | 285 |
{ |
274 | 286 |
mInter[0][mNumEffects] = null; |
src/main/java/org/distorted/library/EffectQueueMatrix.java | ||
---|---|---|
126 | 126 |
|
127 | 127 |
if( mInter[1][i]!=null ) |
128 | 128 |
{ |
129 |
mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+4, mCurrentDuration[i]); |
|
129 |
mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+4, mCurrentDuration[i], step);
|
|
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
mCurrentDuration[i] += step; |
... | ... | |
260 | 260 |
{ |
261 | 261 |
mInter[1][mNumEffects] = null; |
262 | 262 |
|
263 |
if( vector instanceof Dynamic3D) mInter[0][mNumEffects] = (Dynamic3D)vector; |
|
263 |
if( vector instanceof Dynamic3D) |
|
264 |
{ |
|
265 |
mInter[0][mNumEffects] = (Dynamic3D)vector; |
|
266 |
} |
|
264 | 267 |
else if( vector instanceof Static3D ) |
265 | 268 |
{ |
266 | 269 |
mInter[0][mNumEffects] = null; |
... | ... | |
283 | 286 |
{ |
284 | 287 |
if( mMax[INDEX]>mNumEffects ) |
285 | 288 |
{ |
286 |
if( angle instanceof Dynamic1D) mInter[0][mNumEffects] = (Dynamic1D)angle; |
|
289 |
if( angle instanceof Dynamic1D) |
|
290 |
{ |
|
291 |
mInter[0][mNumEffects] = (Dynamic1D)angle; |
|
292 |
} |
|
287 | 293 |
else if( angle instanceof Static1D) |
288 | 294 |
{ |
289 | 295 |
mInter[0][mNumEffects] = null; |
... | ... | |
295 | 301 |
mUniforms[NUM_UNIFORMS*mNumEffects+2] = axis.getY(); |
296 | 302 |
mUniforms[NUM_UNIFORMS*mNumEffects+3] = axis.getZ(); |
297 | 303 |
|
298 |
if( center instanceof Dynamic3D) mInter[1][mNumEffects] = (Dynamic3D)center; |
|
304 |
if( center instanceof Dynamic3D) |
|
305 |
{ |
|
306 |
mInter[1][mNumEffects] = (Dynamic3D)center; |
|
307 |
} |
|
299 | 308 |
else if( center instanceof Static3D ) |
300 | 309 |
{ |
301 | 310 |
mInter[1][mNumEffects] = null; |
... | ... | |
318 | 327 |
{ |
319 | 328 |
if( mMax[INDEX]>mNumEffects ) |
320 | 329 |
{ |
321 |
if( data instanceof Dynamic4D ) mInter[0][mNumEffects] = (Dynamic4D)data; |
|
322 |
else if( data instanceof DynamicQuat) mInter[0][mNumEffects] = (DynamicQuat)data; |
|
330 |
if( data instanceof Dynamic4D ) |
|
331 |
{ |
|
332 |
mInter[0][mNumEffects] = (Dynamic4D)data; |
|
333 |
} |
|
334 |
else if( data instanceof DynamicQuat) |
|
335 |
{ |
|
336 |
mInter[0][mNumEffects] = (DynamicQuat)data; |
|
337 |
} |
|
323 | 338 |
else if( data instanceof Static4D ) |
324 | 339 |
{ |
325 | 340 |
mInter[0][mNumEffects] = null; |
... | ... | |
330 | 345 |
} |
331 | 346 |
else return -1; |
332 | 347 |
|
333 |
if( center instanceof Dynamic3D) mInter[1][mNumEffects] = (Dynamic3D)center; |
|
348 |
if( center instanceof Dynamic3D) |
|
349 |
{ |
|
350 |
mInter[1][mNumEffects] = (Dynamic3D)center; |
|
351 |
} |
|
334 | 352 |
else if( center instanceof Static3D ) |
335 | 353 |
{ |
336 | 354 |
mInter[1][mNumEffects] = null; |
... | ... | |
353 | 371 |
{ |
354 | 372 |
if( mMax[INDEX]>mNumEffects ) |
355 | 373 |
{ |
356 |
if( shear instanceof Dynamic3D) mInter[0][mNumEffects] = (Dynamic3D)shear; |
|
374 |
if( shear instanceof Dynamic3D) |
|
375 |
{ |
|
376 |
mInter[0][mNumEffects] = (Dynamic3D)shear; |
|
377 |
} |
|
357 | 378 |
else if( shear instanceof Static3D ) |
358 | 379 |
{ |
359 | 380 |
mInter[0][mNumEffects] = null; |
... | ... | |
363 | 384 |
} |
364 | 385 |
else return -1; |
365 | 386 |
|
366 |
if( center instanceof Dynamic3D) mInter[1][mNumEffects] = (Dynamic3D)center; |
|
387 |
if( center instanceof Dynamic3D) |
|
388 |
{ |
|
389 |
mInter[1][mNumEffects] = (Dynamic3D)center; |
|
390 |
} |
|
367 | 391 |
else if( center instanceof Static3D ) |
368 | 392 |
{ |
369 | 393 |
mInter[1][mNumEffects] = null; |
src/main/java/org/distorted/library/EffectQueueVertex.java | ||
---|---|---|
104 | 104 |
|
105 | 105 |
if( mInter[1][i]!=null ) // region |
106 | 106 |
{ |
107 |
mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+8, mCurrentDuration[i]); |
|
107 |
mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+8, mCurrentDuration[i], step);
|
|
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
if( mInter[2][i]!=null ) // center |
111 | 111 |
{ |
112 |
mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+6, mCurrentDuration[i]); |
|
112 |
mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+6, mCurrentDuration[i], step);
|
|
113 | 113 |
|
114 | 114 |
mUniforms[NUM_UNIFORMS*i+6] = mUniforms[NUM_UNIFORMS*i+6]-mObjHalfX; |
115 | 115 |
mUniforms[NUM_UNIFORMS*i+7] =-mUniforms[NUM_UNIFORMS*i+7]+mObjHalfY; |
... | ... | |
194 | 194 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
195 | 195 |
|
196 | 196 |
if( data instanceof Dynamic5D) |
197 |
{ |
|
197 | 198 |
mInter[0][mNumEffects] = (Dynamic5D)data; |
199 |
} |
|
198 | 200 |
else if( data instanceof Static5D) |
199 | 201 |
{ |
200 | 202 |
Static5D tmp = (Static5D)data; |
... | ... | |
223 | 225 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
224 | 226 |
|
225 | 227 |
if( data instanceof Dynamic3D) |
228 |
{ |
|
226 | 229 |
mInter[0][mNumEffects] = (Dynamic3D)data; |
230 |
} |
|
227 | 231 |
else if( data instanceof Static3D) |
228 | 232 |
{ |
229 | 233 |
Static3D tmp = (Static3D)data; |
... | ... | |
250 | 254 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
251 | 255 |
|
252 | 256 |
if( data instanceof Dynamic1D) |
257 |
{ |
|
253 | 258 |
mInter[0][mNumEffects] = (Dynamic1D)data; |
259 |
} |
|
254 | 260 |
else if( data instanceof Static1D) |
255 | 261 |
{ |
256 | 262 |
mInter[0][mNumEffects] = null; |
... | ... | |
273 | 279 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
274 | 280 |
|
275 | 281 |
if( data instanceof Dynamic1D) |
282 |
{ |
|
276 | 283 |
mInter[0][mNumEffects] = (Dynamic1D)data; |
284 |
} |
|
277 | 285 |
else if( data instanceof Static1D) |
278 | 286 |
{ |
279 | 287 |
mInter[0][mNumEffects] = null; |
... | ... | |
320 | 328 |
} |
321 | 329 |
|
322 | 330 |
if( center instanceof Dynamic2D) |
331 |
{ |
|
323 | 332 |
mInter[2][mNumEffects] = (Dynamic2D)center; |
333 |
} |
|
324 | 334 |
else if( center instanceof Static2D) |
325 | 335 |
{ |
326 | 336 |
mInter[2][mNumEffects] = null; |
src/main/java/org/distorted/library/type/Dynamic.java | ||
---|---|---|
66 | 66 |
*/ |
67 | 67 |
public static final int MODE_JUMP = 2; |
68 | 68 |
|
69 |
/** |
|
70 |
* The default mode of access. When in this mode, we are able to call interpolate() with points in time |
|
71 |
* in any random order. This means one single Dynamic can be used in many effects simultaneously. |
|
72 |
* On the other hand, when in this mode, it is not possible to smoothly interpolate when mDuration suddenly |
|
73 |
* changes. |
|
74 |
*/ |
|
75 |
public static final int ACCESS_RANDOM = 0; |
|
76 |
/** |
|
77 |
* Set the mode to ACCESS_SEQUENTIAL if you need to change mDuration and you would rather have the Dynamic |
|
78 |
* keep on smoothly interpolating. |
|
79 |
* On the other hand, in this mode, a Dynamic can only be accessed in sequential manner, which means one |
|
80 |
* one Dynamic can only be used in one effect at a time. |
|
81 |
*/ |
|
82 |
public static final int ACCESS_SEQUENTIAL = 1; |
|
83 |
|
|
69 | 84 |
protected int mDimension; |
70 | 85 |
protected int numPoints; |
71 | 86 |
protected int mSegment; // between which pair of points are we currently? (in case of PATH this is a bit complicated!) |
... | ... | |
73 | 88 |
protected int mMode; // LOOP, PATH or JUMP |
74 | 89 |
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 |
75 | 90 |
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. |
91 |
protected double mLastPos; |
|
92 |
protected int mAccessMode; |
|
76 | 93 |
|
77 | 94 |
protected class VectorNoise |
78 | 95 |
{ |
... | ... | |
160 | 177 |
mCount = count; |
161 | 178 |
mDimension = dimension; |
162 | 179 |
mSegment = -1; |
180 |
mLastPos = -1; |
|
181 |
mAccessMode= ACCESS_RANDOM; |
|
163 | 182 |
|
164 | 183 |
baseV = new float[mDimension][mDimension]; |
165 | 184 |
buf = new float[mDimension]; |
166 | 185 |
old = new float[mDimension]; |
167 | 186 |
} |
168 | 187 |
|
169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
170 |
|
|
171 |
public void interpolateMain(float[] buffer, int offset, long currentDuration) |
|
172 |
{ |
|
173 |
if( mDuration<=0.0f ) |
|
174 |
{ |
|
175 |
interpolate(buffer,offset,mCount-(int)mCount); |
|
176 |
} |
|
177 |
else |
|
178 |
{ |
|
179 |
double x = (double)currentDuration/mDuration; |
|
180 |
|
|
181 |
if( x<=mCount || mCount<=0.0f ) |
|
182 |
{ |
|
183 |
interpolate(buffer,offset, (float)(x-(int)x) ); |
|
184 |
} |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
189 |
|
|
190 |
public boolean interpolateMain(float[] buffer, int offset, long currentDuration, long step) |
|
191 |
{ |
|
192 |
if( mDuration<=0.0f ) |
|
193 |
{ |
|
194 |
interpolate(buffer,offset,mCount-(int)mCount); |
|
195 |
return false; |
|
196 |
} |
|
197 |
|
|
198 |
double x = (double)currentDuration/mDuration; |
|
199 |
|
|
200 |
if( x<=mCount || mCount<=0.0f ) |
|
201 |
{ |
|
202 |
interpolate(buffer,offset, (float)(x-(int)x) ); |
|
203 |
|
|
204 |
if( currentDuration+step > mDuration*mCount && mCount>0.0f ) |
|
205 |
{ |
|
206 |
interpolate(buffer,offset,mCount-(int)mCount); |
|
207 |
return true; |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
return false; |
|
212 |
} |
|
213 |
|
|
214 | 188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
215 | 189 |
|
216 | 190 |
protected float noise(float time,int vecNum) |
... | ... | |
626 | 600 |
mDuration = duration; |
627 | 601 |
} |
628 | 602 |
|
603 |
|
|
604 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
605 |
/** |
|
606 |
* Sets the access mode this Dynamic will be working in. |
|
607 |
* |
|
608 |
* @param mode ACCESS_RANDOM or ACCESS_SEQUENTIAL. |
|
609 |
* see {@link Dynamic#ACCESS_RANDOM}. |
|
610 |
* see {@link Dynamic#ACCESS_SEQUENTIAL}. |
|
611 |
*/ |
|
612 |
public void setAccessMode(int mode) |
|
613 |
{ |
|
614 |
mAccessMode = mode; |
|
615 |
mLastPos = -1; |
|
616 |
} |
|
617 |
|
|
618 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
619 |
/** |
|
620 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
621 |
* |
|
622 |
* @param buffer Float buffer we will write the resulting Static1D to. |
|
623 |
* @param offset Offset in the buffer where to write the result. |
|
624 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
625 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
626 |
*/ |
|
627 |
|
|
628 |
public void interpolateMain(float[] buffer, int offset, long time) |
|
629 |
{ |
|
630 |
if( mDuration<=0.0f ) |
|
631 |
{ |
|
632 |
interpolate(buffer,offset,mCount-(int)mCount); |
|
633 |
} |
|
634 |
else |
|
635 |
{ |
|
636 |
double pos = (double)time/mDuration; |
|
637 |
|
|
638 |
if( pos<=mCount || mCount<=0.0f ) |
|
639 |
{ |
|
640 |
interpolate(buffer,offset, (float)(pos-(int)pos) ); |
|
641 |
} |
|
642 |
} |
|
643 |
} |
|
644 |
|
|
645 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
646 |
/** |
|
647 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
648 |
* <p> |
|
649 |
* This version differs from the previous in that it returns a boolean value which indicates whether |
|
650 |
* the interpolation is finished. |
|
651 |
* |
|
652 |
* @param buffer Float buffer we will write the resulting Static1D to. |
|
653 |
* @param offset Offset in the buffer where to write the result. |
|
654 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
655 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
656 |
* @param step Time difference between now and the last time we called this function. Needed to figure out |
|
657 |
* if the previous time we were called the effect wasn't finished yet, but now it is. |
|
658 |
* @return true if the interpolation reached its end. |
|
659 |
*/ |
|
660 |
public boolean interpolateMain(float[] buffer, int offset, long time, long step) |
|
661 |
{ |
|
662 |
if( mDuration<=0.0f ) |
|
663 |
{ |
|
664 |
interpolate(buffer,offset,mCount-(int)mCount); |
|
665 |
return false; |
|
666 |
} |
|
667 |
|
|
668 |
double pos; |
|
669 |
|
|
670 |
if( mAccessMode==ACCESS_SEQUENTIAL ) |
|
671 |
{ |
|
672 |
pos = mLastPos<0 ? (double)time/mDuration : (double)step/mDuration + mLastPos; |
|
673 |
mLastPos = pos; |
|
674 |
} |
|
675 |
else |
|
676 |
{ |
|
677 |
pos = (double)time/mDuration; |
|
678 |
} |
|
679 |
|
|
680 |
if( pos<=mCount || mCount<=0.0f ) |
|
681 |
{ |
|
682 |
interpolate(buffer,offset, (float)(pos-(int)pos) ); |
|
683 |
|
|
684 |
if( time+step > mDuration*mCount && mCount>0.0f ) |
|
685 |
{ |
|
686 |
interpolate(buffer,offset,mCount-(int)mCount); |
|
687 |
return true; |
|
688 |
} |
|
689 |
} |
|
690 |
|
|
691 |
return false; |
|
692 |
} |
|
693 |
|
|
629 | 694 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
630 |
// end of DistortedInterpolator |
|
631 | 695 |
} |
src/main/java/org/distorted/library/type/Dynamic1D.java | ||
---|---|---|
375 | 375 |
} |
376 | 376 |
|
377 | 377 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
378 |
/** |
|
379 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
380 |
* <p> |
|
381 |
* Since this is a 1-dimensional Dynamic, the resulting interpolated Static1D gets written |
|
382 |
* to a single location in the buffer: buffer[offset]. |
|
383 |
* |
|
384 |
* @param buffer Float buffer we will write the resulting Static1D to. |
|
385 |
* @param offset Offset in the buffer where to write the result. |
|
386 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
387 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
388 |
*/ |
|
378 |
|
|
389 | 379 |
synchronized void interpolate(float[] buffer, int offset, float time) |
390 | 380 |
{ |
391 | 381 |
switch(numPoints) |
src/main/java/org/distorted/library/type/Dynamic2D.java | ||
---|---|---|
396 | 396 |
} |
397 | 397 |
|
398 | 398 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
399 |
/** |
|
400 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
401 |
* <p> |
|
402 |
* Since this is a 2-dimensional Dynamic, the resulting interpolated Static2D gets written |
|
403 |
* to two locations in the buffer: buffer[offset] and buffer[offset+1]. |
|
404 |
* |
|
405 |
* @param buffer Float buffer we will write the resulting Static2D to. |
|
406 |
* @param offset Offset in the buffer where to write the result. |
|
407 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
408 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
409 |
*/ |
|
399 |
|
|
410 | 400 |
synchronized void interpolate(float[] buffer, int offset, float time) |
411 | 401 |
{ |
412 | 402 |
switch(numPoints) |
src/main/java/org/distorted/library/type/Dynamic3D.java | ||
---|---|---|
426 | 426 |
} |
427 | 427 |
|
428 | 428 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
429 |
/** |
|
430 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
431 |
* <p> |
|
432 |
* Since this is a 3-dimensional Dynamic, the resulting interpolated Static3D gets written |
|
433 |
* to three locations in the buffer: buffer[offset], buffer[offset+1] and buffer[offset+2]. |
|
434 |
* |
|
435 |
* @param buffer Float buffer we will write the resulting Static3D to. |
|
436 |
* @param offset Offset in the buffer where to write the result. |
|
437 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
438 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
439 |
*/ |
|
429 |
|
|
440 | 430 |
synchronized void interpolate(float[] buffer, int offset, float time) |
441 | 431 |
{ |
442 | 432 |
switch(numPoints) |
src/main/java/org/distorted/library/type/Dynamic4D.java | ||
---|---|---|
438 | 438 |
} |
439 | 439 |
|
440 | 440 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
441 |
/** |
|
442 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
443 |
* <p> |
|
444 |
* Since this is a 4-dimensional Dynamic, the resulting interpolated Static4D gets written |
|
445 |
* to four locations in the buffer: buffer[offset], buffer[offset+1], buffer[offset+2] and buffer[offset+3]. |
|
446 |
* |
|
447 |
* @param buffer Float buffer we will write the resulting Static4D to. |
|
448 |
* @param offset Offset in the buffer where to write the result. |
|
449 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
450 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
451 |
*/ |
|
441 |
|
|
452 | 442 |
synchronized void interpolate(float[] buffer, int offset, float time) |
453 | 443 |
{ |
454 | 444 |
switch(numPoints) |
src/main/java/org/distorted/library/type/Dynamic5D.java | ||
---|---|---|
457 | 457 |
} |
458 | 458 |
|
459 | 459 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
460 |
/** |
|
461 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
|
462 |
* <p> |
|
463 |
* Since this is a 5-dimensional Dynamic, the resulting interpolated Static5D gets written |
|
464 |
* to five locations in the buffer: buffer[offset],...,buffer[offset+4]. |
|
465 |
* |
|
466 |
* @param buffer Float buffer we will write the resulting Static5D to. |
|
467 |
* @param offset Offset in the buffer where to write the result. |
|
468 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
|
469 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
|
470 |
*/ |
|
460 |
|
|
471 | 461 |
synchronized void interpolate(float[] buffer, int offset, float time) |
472 | 462 |
{ |
473 | 463 |
switch(numPoints) |
src/main/java/org/distorted/library/type/DynamicQuat.java | ||
---|---|---|
133 | 133 |
mMode = MODE_LOOP; |
134 | 134 |
mDuration = duration; |
135 | 135 |
mCount = count; |
136 |
mLastPos = -1; |
|
137 |
mAccessMode= ACCESS_RANDOM; |
|
136 | 138 |
mDimension = 4; |
137 | 139 |
} |
138 | 140 |
|
... | ... | |
321 | 323 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
322 | 324 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
323 | 325 |
*/ |
324 |
public synchronized void interpolate(float[] buffer, int offset, float time)
|
|
326 |
synchronized void interpolate(float[] buffer, int offset, float time) |
|
325 | 327 |
{ |
326 | 328 |
switch(numPoints) |
327 | 329 |
{ |
Also available in: Unified diff
Dynamics: Introduce 2 Modes of operation:
- 'random access' mode, where we are able to call a single Dynamic from multiple thread simultaneously.
- 'sequential' mode, which only permits sequential interpolation from one client.
The second mode has an advantage when one needs to change mDuration: it keeps on interpolating smoothly. In the first mode, this is not possible.