Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/MatrixEffectMove.java | ||
---|---|---|
24 | 24 |
import org.distorted.library.type.Data3D; |
25 | 25 |
|
26 | 26 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 |
|
|
27 |
/** |
|
28 |
* Move the Mesh by a 3D vector. |
|
29 |
*/ |
|
28 | 30 |
public class MatrixEffectMove extends MatrixEffect |
29 | 31 |
{ |
30 | 32 |
private Data3D mVector; |
31 | 33 |
|
32 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
33 | 35 |
/** |
34 |
* Moves the Object by a (possibly changing in time) vector.
|
|
36 |
* Only for use by the library itself.
|
|
35 | 37 |
* |
36 |
* @param vector current coordinates of the vector we want to move the Object with.
|
|
38 |
* @y.exclude
|
|
37 | 39 |
*/ |
38 |
public MatrixEffectMove(Data3D vector) |
|
39 |
{ |
|
40 |
super(EffectName.MOVE); |
|
41 |
mVector = vector; |
|
42 |
} |
|
43 |
|
|
44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
45 |
|
|
46 | 40 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
47 | 41 |
{ |
48 | 42 |
return mVector.get(uniforms,index,currentDuration,step); |
49 | 43 |
} |
50 | 44 |
|
51 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 |
|
|
46 |
/** |
|
47 |
* Only for use by the library itself. |
|
48 |
* |
|
49 |
* @y.exclude |
|
50 |
*/ |
|
53 | 51 |
public void apply(float[] matrix, float[] uniforms, int index) |
54 | 52 |
{ |
55 | 53 |
float sx = uniforms[NUM_UNIFORMS*index ]; |
... | ... | |
58 | 56 |
|
59 | 57 |
Matrix.translateM(matrix, 0, sx,-sy, sz); |
60 | 58 |
} |
59 |
|
|
60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
61 |
// PUBLIC API |
|
62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
63 |
/** |
|
64 |
* Move the Mesh by a 3D vector. |
|
65 |
* |
|
66 |
* @param vector current coordinates of the vector we want to move the Mesh with. |
|
67 |
*/ |
|
68 |
public MatrixEffectMove(Data3D vector) |
|
69 |
{ |
|
70 |
super(EffectName.MOVE); |
|
71 |
mVector = vector; |
|
72 |
} |
|
61 | 73 |
} |
Also available in: Unified diff
Javadoc.