Prechádzať zdrojové kódy

Add missing vertex projection

Maciek Jurczyk 4 rokov pred
rodič
commit
11597dc6e4

+ 7 - 1
examples/jsm/modifiers/CurveModifier.js

@@ -180,7 +180,13 @@ vec3 transformed = basis
 	+ spinePos;
 
 vec3 transformedNormal = normalMatrix * (basis * objectNormal);
-`);
+`).replace(
+	'#include <project_vertex>',
+`
+vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
+gl_Position = projectionMatrix * mvPosition;
+`
+);
 
 		shader.vertexShader = vertexShader;
 

+ 4 - 2
examples/webgl_modifier_curve.html

@@ -58,7 +58,7 @@
 				];
 
 				const boxGeometry = new THREE.BoxBufferGeometry( 0.1, 0.1, 0.1 );
-				const boxMaterial = new THREE.MeshBasicMaterial( { color: 0x99ff99 } );
+				const boxMaterial = new THREE.MeshBasicMaterial();
 
 				for ( const handlePos of initialPoints ) {
 
@@ -116,7 +116,9 @@
 
 					geometry.rotateX( Math.PI );
 
-					const material = new THREE.MeshNormalMaterial();
+					const material = new THREE.MeshStandardMaterial( {
+						color: 0x99ffff
+					} );
 
 					const objectToCurve = new THREE.Mesh( geometry, material );