Sfoglia il codice sorgente

Generalize Reflector/Refractor geometry

WestLangley 7 anni fa
parent
commit
1663e818b6

+ 2 - 2
examples/js/objects/ReflectorRTT.js

@@ -1,6 +1,6 @@
-THREE.ReflectorRTT = function ( width, height, options ) {
+THREE.ReflectorRTT = function ( geometry, options ) {
 
 
-	THREE.Reflector.call( this, width, height, options );
+	THREE.Reflector.call( this, geometry, options );
 
 
 	this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
 	this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
 
 

+ 2 - 2
examples/js/objects/Refractor.js

@@ -3,9 +3,9 @@
  *
  *
  */
  */
 
 
-THREE.Refractor = function ( width, height, options ) {
+THREE.Refractor = function ( geometry, options ) {
 
 
-	THREE.Mesh.call( this, new THREE.PlaneBufferGeometry( width, height ) );
+	THREE.Mesh.call( this, geometry );
 
 
 	this.type = 'Refractor';
 	this.type = 'Refractor';
 
 

+ 2 - 1
examples/webgl_mirror_nodes.html

@@ -153,7 +153,8 @@
 				var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
 				var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
 
 
 				// reflector/mirror plane
 				// reflector/mirror plane
-				var groundMirror = new THREE.ReflectorRTT( 100, 100, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT } );
+				var geometry = new THREE.PlaneBufferGeometry( 100, 100 );
+				var groundMirror = new THREE.ReflectorRTT( geometry, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT } );
 
 
 				var mask = new THREE.SwitchNode( new THREE.TextureNode( decalDiffuse ), 'w' );
 				var mask = new THREE.SwitchNode( new THREE.TextureNode( decalDiffuse ), 'w' );
 				var maskFlip = new THREE.Math1Node( mask, THREE.Math1Node.INVERT );
 				var maskFlip = new THREE.Math1Node( mask, THREE.Math1Node.INVERT );

+ 2 - 1
examples/webvr_sandbox.html

@@ -85,7 +85,8 @@
 
 
 				//
 				//
 
 
-				reflector = new THREE.Reflector( 1.4, 1.4, {
+				var geometry = new THREE.PlaneBufferGeometry( 1.4, 1.4 );
+				reflector = new THREE.Reflector( geometry, {
 					textureWidth: window.innerWidth * window.devicePixelRatio,
 					textureWidth: window.innerWidth * window.devicePixelRatio,
 					textureHeight: window.innerHeight * window.devicePixelRatio
 					textureHeight: window.innerHeight * window.devicePixelRatio
 				} );
 				} );