@@ -106,5 +106,11 @@ float linearToRelativeLuminance( const in vec3 color ) {
return dot( weights, color.rgb );
+}
+
+bool isPerspectiveMatrix( mat4 projectionMatrix ) {
+ return projectionMatrix[ 2 ][ 3 ] == - 1.0;
}
`;
@@ -20,7 +20,7 @@ void main() {
#ifdef USE_SIZEATTENUATION
- bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#ifndef USE_SIZEATTENUATION
if ( isPerspective ) scale *= - mvPosition.z;