Explorar el Código

SpriteNodeMaterial: size attenuation support orthographic camera (#29517)

Renaud Rohlinger hace 1 año
padre
commit
efb7510951
Se han modificado 1 ficheros con 11 adiciones y 2 borrados
  1. 11 2
      src/materials/nodes/SpriteNodeMaterial.js

+ 11 - 2
src/materials/nodes/SpriteNodeMaterial.js

@@ -59,9 +59,18 @@ class SpriteNodeMaterial extends NodeMaterial {
 		}
 
 
-		if ( ! sizeAttenuation && camera.isPerspectiveCamera ) {
+		if ( ! sizeAttenuation ) {
 
-			scale = scale.mul( mvPosition.z.negate() );
+			if ( camera.isPerspectiveCamera ) {
+
+				scale = scale.mul( mvPosition.z.negate() );
+
+			} else {
+
+				const orthoScale = float( 2.0 ).div( cameraProjectionMatrix.element( 1 ).element( 1 ) );
+				scale = scale.mul( orthoScale.mul( 2 ) );
+
+			}
 
 		}
 

粤ICP备19079148号