Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/MatrixEffectQuaternion.java | ||
---|---|---|
25 | 25 |
import org.distorted.library.type.Data4D; |
26 | 26 |
|
27 | 27 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 |
|
|
28 |
/** |
|
29 |
* Rotate the Mesh by a quaternion. |
|
30 |
*/ |
|
29 | 31 |
public class MatrixEffectQuaternion extends MatrixEffect |
30 | 32 |
{ |
31 | 33 |
private Data4D mQuaternion; |
... | ... | |
36 | 38 |
|
37 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 40 |
/** |
39 |
* Rotates the Object by quaternion.
|
|
41 |
* Only for use by the library itself.
|
|
40 | 42 |
* |
41 |
* @param quaternion Quaternion describing the rotation. |
|
42 |
* @param center Coordinates of the Point we are rotating around. |
|
43 |
* @y.exclude |
|
43 | 44 |
*/ |
44 |
public MatrixEffectQuaternion(Data4D quaternion, Data3D center ) |
|
45 |
{ |
|
46 |
super(EffectName.QUATERNION); |
|
47 |
mQuaternion = quaternion; |
|
48 |
mCenter = center; |
|
49 |
} |
|
50 |
|
|
51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
52 |
|
|
53 | 45 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
54 | 46 |
{ |
55 | 47 |
mCenter.get(uniforms,index+4,currentDuration,step); |
... | ... | |
57 | 49 |
} |
58 | 50 |
|
59 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
60 |
|
|
52 |
/** |
|
53 |
* Only for use by the library itself. |
|
54 |
* |
|
55 |
* @y.exclude |
|
56 |
*/ |
|
61 | 57 |
public void apply(float[] matrix, float[] uniforms, int index) |
62 | 58 |
{ |
63 | 59 |
float qX = uniforms[NUM_UNIFORMS*index ]; |
... | ... | |
119 | 115 |
matrix[14] = mTmpMatrix2[14]; |
120 | 116 |
matrix[15] = mTmpMatrix2[15]; |
121 | 117 |
} |
118 |
|
|
119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
120 |
// PUBLIC API |
|
121 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
122 |
/** |
|
123 |
* Rotate the Mesh by a quaternion. |
|
124 |
* |
|
125 |
* @param quaternion Quaternion describing the rotation. |
|
126 |
* @param center Coordinates of the Point we are rotating around. |
|
127 |
*/ |
|
128 |
public MatrixEffectQuaternion(Data4D quaternion, Data3D center ) |
|
129 |
{ |
|
130 |
super(EffectName.QUATERNION); |
|
131 |
mQuaternion = quaternion; |
|
132 |
mCenter = center; |
|
133 |
} |
|
122 | 134 |
} |
Also available in: Unified diff
Javadoc.