Revision a952192e
Added by Leszek Koltunski about 18 hours ago
src/main/java/org/distorted/library/effect/VertexEffectRotate.java | ||
---|---|---|
65 | 65 |
{ |
66 | 66 |
return |
67 | 67 |
|
68 |
"float angle = vUniforms[effect].x*3.1415/360.0;\n" |
|
69 |
+ "vec3 center = vUniforms[effect+1].yzw; \n" |
|
70 |
+ "float sinHalf =-sin(angle); \n" |
|
71 |
+ "float cosHalf = cos(angle); \n" |
|
68 |
"float angle = vUniforms[effect].x*3.14159265/360.0;\n"
|
|
69 |
+ "vec3 center = vUniforms[effect+1].yzw; \n"
|
|
70 |
+ "float sinHalf =-sin(angle); \n"
|
|
71 |
+ "float cosHalf = cos(angle); \n"
|
|
72 | 72 |
|
73 |
+ "float qx = vUniforms[effect].y * sinHalf; \n" |
|
74 |
+ "float qy = vUniforms[effect].z * sinHalf; \n" |
|
75 |
+ "float qz = vUniforms[effect].w * sinHalf; \n" |
|
76 |
+ "float qw = cosHalf; \n" |
|
73 |
+ "float qx = vUniforms[effect].y * sinHalf; \n"
|
|
74 |
+ "float qy = vUniforms[effect].z * sinHalf; \n"
|
|
75 |
+ "float qz = vUniforms[effect].w * sinHalf; \n"
|
|
76 |
+ "float qw = cosHalf; \n"
|
|
77 | 77 |
|
78 |
+ "v -= center; \n" |
|
78 |
+ "v -= center; \n"
|
|
79 | 79 |
|
80 |
+ "float tx = qx - v.z*qy + v.y*qz + v.x*qw; \n" |
|
81 |
+ "float ty = qy + v.z*qx + v.y*qw - v.x*qz; \n" |
|
82 |
+ "float tz = qz + v.z*qw - v.y*qx + v.x*qy; \n" |
|
83 |
+ "float tw = qw - v.z*qz - v.y*qy - v.x*qx; \n" |
|
80 |
+ "float tx = qx - v.z*qy + v.y*qz + v.x*qw; \n"
|
|
81 |
+ "float ty = qy + v.z*qx + v.y*qw - v.x*qz; \n"
|
|
82 |
+ "float tz = qz + v.z*qw - v.y*qx + v.x*qy; \n"
|
|
83 |
+ "float tw = qw - v.z*qz - v.y*qy - v.x*qx; \n"
|
|
84 | 84 |
|
85 |
+ "v.x = qw*tx + qz*ty - qy*tz - qx*tw; \n" |
|
86 |
+ "v.y = qw*ty - qz*tx - qy*tw + qx*tz; \n" |
|
87 |
+ "v.z = qw*tz - qz*tw + qy*tx - qx*ty; \n" |
|
85 |
+ "v.x = qw*tx + qz*ty - qy*tz - qx*tw; \n"
|
|
86 |
+ "v.y = qw*ty - qz*tx - qy*tw + qx*tz; \n"
|
|
87 |
+ "v.z = qw*tz - qz*tw + qy*tx - qx*ty; \n"
|
|
88 | 88 |
|
89 |
+ "v += center; \n" |
|
89 |
+ "v += center; \n"
|
|
90 | 90 |
|
91 |
+ "float nx = - n.z*qy + n.y*qz + n.x*qw; \n" |
|
92 |
+ "float ny = + n.z*qx + n.y*qw - n.x*qz; \n" |
|
93 |
+ "float nz = + n.z*qw - n.y*qx + n.x*qy; \n" |
|
94 |
+ "float nw = - n.z*qz - n.y*qy - n.x*qx; \n" |
|
91 |
+ "float nx = - n.z*qy + n.y*qz + n.x*qw; \n"
|
|
92 |
+ "float ny = + n.z*qx + n.y*qw - n.x*qz; \n"
|
|
93 |
+ "float nz = + n.z*qw - n.y*qx + n.x*qy; \n"
|
|
94 |
+ "float nw = - n.z*qz - n.y*qy - n.x*qx; \n"
|
|
95 | 95 |
|
96 |
+ "n.x = qw*nx + qz*ny - qy*nz - qx*nw; \n" |
|
97 |
+ "n.y = qw*ny - qz*nx - qy*nw + qx*nz; \n" |
|
98 |
+ "n.z = qw*nz - qz*nw + qy*nx - qx*ny; \n" |
|
96 |
+ "n.x = qw*nx + qz*ny - qy*nz - qx*nw; \n"
|
|
97 |
+ "n.y = qw*ny - qz*nx - qy*nw + qx*nz; \n"
|
|
98 |
+ "n.z = qw*nz - qz*nw + qy*nx - qx*ny; \n"
|
|
99 | 99 |
|
100 | 100 |
+ "n = normalize(n);"; |
101 | 101 |
} |
Also available in: Unified diff
implement correct TouchControlShapeChanging for Ghosts - taking into account the Ghost rotation.