Browse Source

- Fixed opacity being ignored when setted to 0
- Added wireframe view on VR demo

Mr.doob 15 years ago
parent
commit
9a823c2f6b

File diff suppressed because it is too large
+ 0 - 0
build/three.js


+ 9 - 3
examples/geometry/vr.html

@@ -39,7 +39,8 @@
 
 			var camera, scene, renderer;
 
-			var texture_placeholder, isUserInteracting = false,
+			var texture_placeholder, wireframe,
+			isUserInteracting = false,
 			onMouseDownMouseX = 0, onMouseDownMouseY = 0,
 			lon = 90, onMouseDownLon = 0,
 			lat = 0, onMouseDownLat = 0,
@@ -62,6 +63,8 @@
 				texture_placeholder.width = 128;
 				texture_placeholder.height = 128;
 
+				wireframe = new THREE.ColorStrokeMaterial(1, 0xffffff, 0);
+
 				var context = texture_placeholder.getContext( '2d' );
 				context.fillStyle = 'rgba( 200, 200, 200, 1 )';
 				context.fillRect( 0, 0, texture_placeholder.width, texture_placeholder.height );
@@ -125,8 +128,7 @@
 
 				texture.src = path;
 
-				// return [ material, new THREE.ColorStrokeMaterial(1, Math.random() * 0xffffff, 0.2) ];
-				return material;
+				return [ material, wireframe ];
 			}
 
 			function onDocumentMouseDown( event ) {
@@ -135,6 +137,8 @@
 
 				isUserInteracting = true;
 
+				wireframe.color.setRGBA(255, 255, 255, 64);
+
 				onPointerDownPointerX = event.clientX;
 				onPointerDownPointerY = event.clientY;
 
@@ -159,6 +163,8 @@
 
 				isUserInteracting = false;
 
+				wireframe.color.setRGBA(255, 255, 255, 0);
+				render();
 			}
 
 

+ 1 - 1
src/materials/ColorFillMaterial.js

@@ -4,7 +4,7 @@
 
 THREE.ColorFillMaterial = function ( hex, opacity ) {
 
-	this.color = new THREE.Color( ( opacity ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
+	this.color = new THREE.Color( ( opacity !== null ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
 
 	this.toString = function () {
 

+ 1 - 1
src/materials/ColorStrokeMaterial.js

@@ -5,7 +5,7 @@
 THREE.ColorStrokeMaterial = function ( lineWidth, hex, opacity ) {
 
 	this.lineWidth = lineWidth || 1;
-	this.color = new THREE.Color( ( opacity ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
+	this.color = new THREE.Color( ( opacity !== null ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
 
 	this.toString = function () {
 

Some files were not shown because too many files changed in this diff