|
@@ -11,19 +11,26 @@ void main() {
|
|
|
|
|
|
#include <uv_vertex>
|
|
|
|
|
|
+ vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
|
+
|
|
|
vec2 scale;
|
|
|
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
|
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
|
|
|
|
+ #ifndef USE_SIZEATTENUATION
|
|
|
+
|
|
|
+ bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );
|
|
|
+
|
|
|
+ if ( isPerspective ) scale *= - mvPosition.z;
|
|
|
+
|
|
|
+ #endif
|
|
|
+
|
|
|
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
|
|
|
|
vec2 rotatedPosition;
|
|
|
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
|
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
|
|
|
|
- vec4 mvPosition;
|
|
|
-
|
|
|
- mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
|
mvPosition.xy += rotatedPosition;
|
|
|
|
|
|
gl_Position = projectionMatrix * mvPosition;
|