提交 cfb584d9 编写于 作者: G Garrett Johnson

Share isPerspective code

上级 656cc039
...@@ -106,5 +106,11 @@ float linearToRelativeLuminance( const in vec3 color ) { ...@@ -106,5 +106,11 @@ float linearToRelativeLuminance( const in vec3 color ) {
return dot( weights, color.rgb ); return dot( weights, color.rgb );
}
bool isPerspectiveMatrix( mat4 projectionMatrix ) {
return projectionMatrix[ 2 ][ 3 ] == - 1.0;
} }
`; `;
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
#ifdef USE_SIZEATTENUATION #ifdef USE_SIZEATTENUATION
bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
#ifndef USE_SIZEATTENUATION #ifndef USE_SIZEATTENUATION
bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z; if ( isPerspective ) scale *= - mvPosition.z;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册