浏览代码

update mirror nodes

sunag 8 年之前
父节点
当前提交
fae0177d6f
共有 2 个文件被更改,包括 4 次插入5 次删除
  1. 3 3
      examples/js/nodes/inputs/MirrorNode.js
  2. 1 2
      examples/webgl_mirror_nodes.html

+ 3 - 3
examples/js/nodes/inputs/MirrorNode.js

@@ -1,10 +1,10 @@
-THREE.MirrorNode = function( renderer, camera, options ) {
+THREE.MirrorNode = function( mirror, camera, options ) {
 
 	THREE.TempNode.call( this, 'v4' );
 
-	this.mirror = renderer instanceof THREE.Mirror ? renderer : new THREE.Mirror( renderer, camera, options );
+	this.mirror = mirror;
 
-	this.textureMatrix = new THREE.Matrix4Node( this.mirror.textureMatrix );
+	this.textureMatrix = new THREE.Matrix4Node( this.mirror.material.uniforms.textureMatrix.value );
 
 	this.worldPosition = new THREE.PositionNode( THREE.PositionNode.WORLD );
 

+ 1 - 2
examples/webgl_mirror_nodes.html

@@ -119,7 +119,6 @@
 
 			var gui = new dat.GUI();
 
-			var groundMirror;
 			var sphereGroup, smallSphere;
 			var groundMirrorMaterial;
 
@@ -153,7 +152,7 @@
 				var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
 
 				// MIRROR planes
-				groundMirror = new THREE.Mirror( renderer, camera, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT, color: 0x777777 } );
+				var groundMirror = new THREE.Mirror( 100, 100, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT } );
 
 				var mask = new THREE.SwitchNode( new THREE.TextureNode( decalDiffuse ), 'w' );
 				var maskFlip = new THREE.Math1Node( mask, THREE.Math1Node.INVERT );