Revision 457bd08e
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/library/effect/VertexEffectDeform.java | ||
---|---|---|
145 | 145 |
+ "v.z += force.z*d*d*(3.0*d*d -8.0*d +6.0); \n" // thick bubble |
146 | 146 |
+ "float b = -(12.0*force.z*d*(1.0-d)*(1.0-d)*(1.0-d))*one_over_denom; \n" |
147 | 147 |
|
148 |
+ "n.xy += n.z*b*ps.xy;"; |
|
148 |
+ "n.xy += n.z*b*ps.xy; \n" |
|
149 |
+ "n = normalize(n);"; |
|
149 | 150 |
} |
150 | 151 |
|
151 | 152 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectQuaternion.java | ||
---|---|---|
78 | 78 |
|
79 | 79 |
+ "n.x = qw*nx + qz*ny - qy*nz - qx*nw; \n" |
80 | 80 |
+ "n.y = qw*ny - qz*nx - qy*nw + qx*nz; \n" |
81 |
+ "n.z = qw*nz - qz*nw + qy*nx - qx*ny; \n"; |
|
81 |
+ "n.z = qw*nz - qz*nw + qy*nx - qx*ny; \n" |
|
82 |
|
|
83 |
+ "n = normalize(n);"; |
|
82 | 84 |
} |
83 | 85 |
|
84 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectRotate.java | ||
---|---|---|
94 | 94 |
|
95 | 95 |
+ "n.x = qw*nx + qz*ny - qy*nz - qx*nw; \n" |
96 | 96 |
+ "n.y = qw*ny - qz*nx - qy*nw + qx*nz; \n" |
97 |
+ "n.z = qw*nz - qz*nw + qy*nx - qx*ny; \n"; |
|
97 |
+ "n.z = qw*nz - qz*nw + qy*nx - qx*ny; \n" |
|
98 |
|
|
99 |
+ "n = normalize(n);"; |
|
98 | 100 |
} |
99 | 101 |
|
100 | 102 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectScale.java | ||
---|---|---|
53 | 53 |
"float X = vUniforms[effect].y*vUniforms[effect].z; \n" + |
54 | 54 |
"float Y = vUniforms[effect].x*vUniforms[effect].z; \n" + |
55 | 55 |
"float Z = vUniforms[effect].x*vUniforms[effect].y; \n" + |
56 |
"n *= vec3(X,Y,Z); \n"; |
|
56 |
"n *= vec3(X,Y,Z); \n" + |
|
57 |
"n = normalize(n); \n"; |
|
57 | 58 |
} |
58 | 59 |
|
59 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectShear.java | ||
---|---|---|
72 | 72 |
+ "float new_nx = n.x - sy*n.y + sy*sz*n.z; \n" |
73 | 73 |
+ "float new_ny =-sx*n.x + tmp*(n.y - sz*n.z); \n" |
74 | 74 |
+ "n.x = new_nx; \n" |
75 |
+ "n.y = new_ny; \n"; |
|
75 |
+ "n.y = new_ny; \n" |
|
76 |
|
|
77 |
+ "n = normalize(n);"; |
|
76 | 78 |
} |
77 | 79 |
|
78 | 80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectWave.java | ||
---|---|---|
181 | 181 |
+ "n.x = (n.x*normal.z + n.z*normal.x); \n" // |
182 | 182 |
+ "n.y = (n.y*normal.z + n.z*normal.y); \n" // ? Because if we do the above, my Nexus4 crashes |
183 | 183 |
+ "n.z = (n.z*normal.z); \n" // during shader compilation! |
184 |
+ "n = normalize(n); \n" |
|
184 | 185 |
+ "} \n" |
185 | 186 |
+ "}"; |
186 | 187 |
} |
Also available in: Unified diff
Bugfix: always normalize the normal vector after modifying it, otherwise the next effect might not work correctly (Distort!)