Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/MatrixEffectScale.java | ||
---|---|---|
25 | 25 |
import org.distorted.library.type.Static3D; |
26 | 26 |
|
27 | 27 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 |
|
|
28 |
/** |
|
29 |
* Scale the Mesh by 3D scale factors. |
|
30 |
*/ |
|
29 | 31 |
public class MatrixEffectScale extends MatrixEffect |
30 | 32 |
{ |
31 | 33 |
private Data3D mScale; |
32 | 34 |
|
33 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 36 |
/** |
35 |
* Scales the Object by (possibly changing in time) 3D scale factors.
|
|
37 |
* Only for use by the library itself.
|
|
36 | 38 |
* |
37 |
* @param scale current x- , y- and z- scale factors.
|
|
39 |
* @y.exclude
|
|
38 | 40 |
*/ |
39 |
public MatrixEffectScale(Data3D scale)
|
|
41 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step )
|
|
40 | 42 |
{ |
41 |
super(EffectName.SCALE); |
|
42 |
mScale = scale; |
|
43 |
return mScale.get(uniforms,index,currentDuration,step); |
|
43 | 44 |
} |
44 | 45 |
|
45 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 47 |
/** |
47 |
* Scales the Object by (possibly changing in time) 3D scale factors.
|
|
48 |
* Only for use by the library itself.
|
|
48 | 49 |
* |
49 |
* @param scale Common x,y, and z scale factor.
|
|
50 |
* @y.exclude
|
|
50 | 51 |
*/ |
51 |
public MatrixEffectScale(float scale)
|
|
52 |
public void apply(float[] matrix, float[] uniforms, int index)
|
|
52 | 53 |
{ |
53 |
super(EffectName.SCALE); |
|
54 |
mScale = new Static3D(scale,scale,scale); |
|
54 |
float sx = uniforms[NUM_UNIFORMS*index ]; |
|
55 |
float sy = uniforms[NUM_UNIFORMS*index+1]; |
|
56 |
float sz = uniforms[NUM_UNIFORMS*index+2]; |
|
57 |
|
|
58 |
Matrix.scaleM(matrix, 0, sx, sy, sz); |
|
55 | 59 |
} |
56 | 60 |
|
57 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
58 |
|
|
59 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
|
62 |
// PUBLIC API |
|
63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
64 |
/** |
|
65 |
* Scale the Mesh by 3D scale factors. |
|
66 |
* |
|
67 |
* @param scale current x- , y- and z- scale factors. |
|
68 |
*/ |
|
69 |
public MatrixEffectScale(Data3D scale) |
|
60 | 70 |
{ |
61 |
return mScale.get(uniforms,index,currentDuration,step); |
|
71 |
super(EffectName.SCALE); |
|
72 |
mScale = scale; |
|
62 | 73 |
} |
63 | 74 |
|
64 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
65 |
|
|
66 |
public void apply(float[] matrix, float[] uniforms, int index) |
|
76 |
/** |
|
77 |
* Scale the Mesh by 3D scale factors. |
|
78 |
* |
|
79 |
* @param scale Common x,y, and z scale factor. |
|
80 |
*/ |
|
81 |
public MatrixEffectScale(float scale) |
|
67 | 82 |
{ |
68 |
float sx = uniforms[NUM_UNIFORMS*index ]; |
|
69 |
float sy = uniforms[NUM_UNIFORMS*index+1]; |
|
70 |
float sz = uniforms[NUM_UNIFORMS*index+2]; |
|
71 |
|
|
72 |
Matrix.scaleM(matrix, 0, sx, sy, sz); |
|
83 |
super(EffectName.SCALE); |
|
84 |
mScale = new Static3D(scale,scale,scale); |
|
73 | 85 |
} |
74 | 86 |
} |
Also available in: Unified diff
Javadoc.